mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-23 11:50:15 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
Vendored
+440
-241
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -394,7 +394,7 @@ declare class Promise<R> implements Promise.Thenable<R> {
|
||||
* Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method.
|
||||
*/
|
||||
// TODO how to model promisifyAll?
|
||||
static promisifyAll(target: Object): Object;
|
||||
static promisifyAll(target: Object): any;
|
||||
|
||||
/**
|
||||
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
|
||||
Vendored
+1
-1
@@ -421,7 +421,7 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
* Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method.
|
||||
*/
|
||||
// TODO how to model promisifyAll?
|
||||
static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): Object;
|
||||
static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Vendored
-2
@@ -41,9 +41,7 @@ declare module CodeMirror {
|
||||
off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void;
|
||||
}
|
||||
|
||||
/** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/
|
||||
interface Doc {
|
||||
state: any;
|
||||
showHint: (options: ShowHintOptions) => void;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
@@ -390,6 +390,9 @@ declare module CodeMirror {
|
||||
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;
|
||||
|
||||
/** Expose the state object, so that the Editor.state.completionActive property is reachable*/
|
||||
state: any;
|
||||
}
|
||||
|
||||
interface EditorFromTextArea extends Editor {
|
||||
@@ -589,6 +592,8 @@ declare module CodeMirror {
|
||||
/** The reverse of posFromIndex. */
|
||||
indexFromPos(object: CodeMirror.Position): number;
|
||||
|
||||
/** Expose the state object, so that the Doc.state.completionActive property is reachable*/
|
||||
state: any;
|
||||
}
|
||||
|
||||
interface LineHandle {
|
||||
|
||||
Vendored
+4
@@ -6,3 +6,7 @@ declare class ConvexHullGrahamScan {
|
||||
addPoint(x: number, y: number): void;
|
||||
getHull(): {x: number, y: number}[];
|
||||
}
|
||||
|
||||
declare module 'graham_scan' {
|
||||
export = ConvexHullGrahamScan;
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -7,6 +7,8 @@
|
||||
declare module Handlebars {
|
||||
export function registerHelper(name: string, fn: Function, inverse?: boolean): void;
|
||||
export function registerPartial(name: string, str: any): void;
|
||||
export function unregisterHelper(name: string): void;
|
||||
export function unregisterPartial(name: string): void;
|
||||
export function K(): void;
|
||||
export function createFrame(object: any): any;
|
||||
export function Exception(message: string): void;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/// <reference path="hopscotch.d.ts" />
|
||||
|
||||
var tourDefinition = {
|
||||
id: 'intro-tour',
|
||||
steps: [
|
||||
{
|
||||
target: '.popupTarget',
|
||||
placement: 'bottom',
|
||||
title: 'A tour step',
|
||||
content: 'A tour message'
|
||||
},
|
||||
{
|
||||
target: [".aSelector"],
|
||||
placement: 'bottom',
|
||||
|
||||
yOffset: 10,
|
||||
width: 400,
|
||||
xOffset: -420,
|
||||
arrowOffset: 380
|
||||
},
|
||||
{
|
||||
target: '.domainPatterns form',
|
||||
placement: 'right',
|
||||
title: 'A question?',
|
||||
content: "Hello!",
|
||||
onShow: function () { }
|
||||
},
|
||||
{
|
||||
target: '.home-button',
|
||||
placement: 'left',
|
||||
title: "Let's get started",
|
||||
content: "Content",
|
||||
|
||||
multipage: true,
|
||||
nextOnTargetClick: true,
|
||||
showNextButton: false
|
||||
},
|
||||
{
|
||||
target: '.buttons',
|
||||
placement: 'top',
|
||||
|
||||
title: 'Another title',
|
||||
content: "A message",
|
||||
|
||||
showNextButton: false,
|
||||
nextOnTargetClick: true,
|
||||
onShow: function () { }
|
||||
}
|
||||
],
|
||||
skipIfNoElement: false,
|
||||
onClose: function () { },
|
||||
onEnd: function () { }
|
||||
};
|
||||
|
||||
hopscotch.startTour(tourDefinition);
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for Hopscotch v0.2.5
|
||||
// Project: http://linkedin.github.io/hopscotch/
|
||||
// Definitions by: Tim Perry <https://github.com/pimterry>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface TourDefinition {
|
||||
id: string;
|
||||
steps: StepDefinition[];
|
||||
|
||||
skipIfNoElement: boolean;
|
||||
|
||||
onEnd: () => void;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
interface StepDefinition {
|
||||
placement: string;
|
||||
target: string | HTMLElement | Array<string | HTMLElement>
|
||||
|
||||
title?: string;
|
||||
content?: string;
|
||||
|
||||
xOffset?: number;
|
||||
yOffset?: number;
|
||||
arrowOffset?: number;
|
||||
|
||||
height?: number;
|
||||
width?: number;
|
||||
|
||||
multipage?: boolean;
|
||||
showNextButton?: boolean;
|
||||
nextOnTargetClick?: boolean;
|
||||
|
||||
onShow?: () => void;
|
||||
}
|
||||
|
||||
interface HopscotchStatic {
|
||||
startTour(tour: TourDefinition, stepNum?: number): void;
|
||||
}
|
||||
|
||||
declare var hopscotch: HopscotchStatic;
|
||||
|
||||
declare module "hopscotch" {
|
||||
export = hopscotch;
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
var intro = introJs();
|
||||
|
||||
intro.setOption('doneLabel', 'Next page');
|
||||
intro.setOption('overlayOpacity', 50);
|
||||
intro.setOption('showProgress', true);
|
||||
intro.setOptions({
|
||||
steps: [
|
||||
{
|
||||
|
||||
Vendored
+4
-11
@@ -1,20 +1,13 @@
|
||||
// Type definitions for intro.js 1.0.0
|
||||
// Type definitions for intro.js 1.1.1
|
||||
// Project: https://github.com/usablica/intro.js
|
||||
// Definitions by: Maxime Fabre <https://github.com/anahkiasen/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module IntroJs {
|
||||
enum Positions {
|
||||
top,
|
||||
left,
|
||||
right,
|
||||
bottom
|
||||
}
|
||||
|
||||
interface Step {
|
||||
intro: string;
|
||||
element?: string|HTMLElement;
|
||||
position?: string|Positions;
|
||||
element?: string|HTMLElement|Element;
|
||||
position?: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
@@ -49,7 +42,7 @@ declare module IntroJs {
|
||||
|
||||
refresh(): IntroJs;
|
||||
|
||||
setOption(option: string, value: string|number): IntroJs;
|
||||
setOption(option: string, value: string|number|boolean): IntroJs;
|
||||
setOptions(options: Options): IntroJs;
|
||||
|
||||
onexit(callback: Function): IntroJs;
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
/// <reference path="jssha-1.6.0.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
var imported = require("jssha");
|
||||
|
||||
var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8");
|
||||
var shaObj2 = new imported("This is a Test", "TEXT");
|
||||
|
||||
var hash1:string = shaObj2.getHash("SHA-512", "HEX");
|
||||
var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2);
|
||||
var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"});
|
||||
|
||||
var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"};
|
||||
var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX");
|
||||
var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format);
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
// Type definitions for jsSHA-1.6.0
|
||||
// Project: https://github.com/Caligatio/jsSHA
|
||||
// Definitions by: David Li <https://github.com/randombk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module jsSHA {
|
||||
export interface OutputFormatOptions {
|
||||
outputUpper? : boolean;
|
||||
b64Pad? : string;
|
||||
}
|
||||
|
||||
export interface jsSHA {
|
||||
/**
|
||||
* jsSHA is the workhorse of the library. Instantiate it with the string to
|
||||
* be hashed as the parameter
|
||||
*
|
||||
* @constructor
|
||||
* @this {jsSHA}
|
||||
* @param {string} srcString The string to be hashed
|
||||
* @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES
|
||||
* @param {string=} encoding The text encoding to use to encode the source
|
||||
* string
|
||||
*/
|
||||
new (srcString:string, inputFormat:string, encoding?:string):jsSHA;
|
||||
|
||||
/**
|
||||
* Returns the desired SHA hash of the string specified at instantiation
|
||||
* using the specified parameters
|
||||
*
|
||||
* @param {string} variant The desired SHA variant (SHA-1, SHA-224,
|
||||
* SHA-256, SHA-384, or SHA-512)
|
||||
* @param {string} format The desired output formatting (B64, HEX, or BYTES)
|
||||
* @param {number=} numRounds The number of rounds of hashing to be
|
||||
* executed
|
||||
* @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts
|
||||
* Hash list of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHash(variant:string, format:string, numRounds?:number, outputFormatOpts?:OutputFormatOptions):string;
|
||||
|
||||
/**
|
||||
* Returns the desired HMAC of the string specified at instantiation
|
||||
* using the key and variant parameter
|
||||
*
|
||||
* @param {string} key The key used to calculate the HMAC
|
||||
* @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES
|
||||
* @param {string} variant The desired SHA variant (SHA-1, SHA-224,
|
||||
* SHA-256, SHA-384, or SHA-512)
|
||||
* @param {string} outputFormat The desired output formatting
|
||||
* (B64, HEX, or BYTES)
|
||||
* @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts
|
||||
* associative array of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var jsSHA: jsSHA.jsSHA;
|
||||
declare module 'jssha' {
|
||||
export = jsSHA;
|
||||
}
|
||||
Executable → Regular
+43
-9
@@ -1,15 +1,49 @@
|
||||
/// <reference path="jssha.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
var imported = require("jssha");
|
||||
import imported = require("jssha");
|
||||
|
||||
var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8");
|
||||
var shaObj2 = new imported("This is a Test", "TEXT");
|
||||
// constructor
|
||||
let shaObj1:jsSHA.jsSHA = new imported("SHA-512", "TEXT");
|
||||
let shaObj2:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { });
|
||||
let shaObj3:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8" });
|
||||
let shaObj4:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { numRounds: 1 });
|
||||
let shaObj5:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8", numRounds: 1 });
|
||||
|
||||
var hash1:string = shaObj2.getHash("SHA-512", "HEX");
|
||||
var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2);
|
||||
var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"});
|
||||
// setHMACKey
|
||||
shaObj1.setHMACKey("key", "TEXT");
|
||||
shaObj2.setHMACKey("key", "TEXT", { });
|
||||
shaObj3.setHMACKey("key", "TEXT", { encoding: "UTF8" });
|
||||
|
||||
var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"};
|
||||
var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX");
|
||||
var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format);
|
||||
// update
|
||||
shaObj1.update("This is a test");
|
||||
|
||||
// getHash
|
||||
let hash1:string = shaObj4.getHash("HEX");
|
||||
let hash2:string = shaObj4.getHash("HEX", {});
|
||||
let hash3:string = shaObj4.getHash("HEX", { b64Pad: "=" });
|
||||
let hash4:string = shaObj4.getHash("HEX", { outputUpper: true });
|
||||
let hash5:string = shaObj4.getHash("HEX", { outputUpper: true, b64Pad: '=' });
|
||||
|
||||
// getHMAC
|
||||
let hmac1:string = shaObj1.getHMAC("HEX");
|
||||
let hmac2:string = shaObj1.getHMAC("HEX", {});
|
||||
let hmac3:string = shaObj1.getHMAC("HEX", { b64Pad: "=" });
|
||||
let hmac4:string = shaObj1.getHMAC("HEX", { outputUpper: true });
|
||||
let hmac5:string = shaObj1.getHMAC("HEX", { outputUpper: true, b64Pad: '=' });
|
||||
|
||||
|
||||
// examples from the readme.md (https://github.com/Caligatio/jsSHA/blob/v2.0.2/README.md)
|
||||
{
|
||||
var shaObj = new imported("SHA-512", "TEXT");
|
||||
shaObj.update("This is a test");
|
||||
var hash = shaObj.getHash("HEX");
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
let shaObj = new imported("SHA-256", "TEXT");
|
||||
shaObj.setHMACKey("abc", "TEXT");
|
||||
shaObj.update("This is a test");
|
||||
let hmac = shaObj.getHMAC("HEX");
|
||||
}
|
||||
+62
-42
@@ -1,13 +1,22 @@
|
||||
// Type definitions for jsSHA
|
||||
// Project: https://github.com/Caligatio/jsSHA
|
||||
// Definitions by: David Li <https://github.com/randombk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Definitions by: David Li <https://github.com/randombk>, Tobias Kahlert <https://github.com/SrTobi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module jsSHA {
|
||||
|
||||
export interface EncodingOptions {
|
||||
encoding? : string;
|
||||
}
|
||||
|
||||
export interface Options extends EncodingOptions {
|
||||
numRounds? : number;
|
||||
}
|
||||
|
||||
export interface OutputFormatOptions {
|
||||
outputUpper : boolean;
|
||||
b64Pad : string;
|
||||
outputUpper? : boolean;
|
||||
b64Pad? : string;
|
||||
}
|
||||
|
||||
export interface jsSHA {
|
||||
@@ -15,51 +24,62 @@ declare module jsSHA {
|
||||
* jsSHA is the workhorse of the library. Instantiate it with the string to
|
||||
* be hashed as the parameter
|
||||
*
|
||||
* @constructor
|
||||
* @this {jsSHA}
|
||||
* @param {string} srcString The string to be hashed
|
||||
* @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES
|
||||
* @param {string=} encoding The text encoding to use to encode the source
|
||||
* string
|
||||
* @param {string} variant The desired SHA variant (SHA-1, SHA-224, SHA-256,
|
||||
* SHA-384, or SHA-512)
|
||||
* @param {string} inputFormat The format of srcString: HEX, TEXT, B64, or BYTES
|
||||
* @param {{encoding: (string|undefined), numRounds: (string|undefined)}=}
|
||||
* options Optional values
|
||||
*/
|
||||
new (srcString:string, inputFormat:string, encoding?:string):jsSHA;
|
||||
new (variant:string, inputFormat:string, options?:Options):jsSHA;
|
||||
|
||||
/**
|
||||
* Returns the desired SHA hash of the string specified at instantiation
|
||||
* using the specified parameters
|
||||
*
|
||||
* @param {string} variant The desired SHA variant (SHA-1, SHA-224,
|
||||
* SHA-256, SHA-384, or SHA-512)
|
||||
* @param {string} format The desired output formatting (B64, HEX, or BYTES)
|
||||
* @param {number=} numRounds The number of rounds of hashing to be
|
||||
* executed
|
||||
* @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts
|
||||
* Hash list of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHash(variant:string, format:string, numRounds?:number, outputFormatOpts?:OutputFormatOptions):string;
|
||||
* Sets the HMAC key for an eventual getHMAC call. Must be called
|
||||
* immediately after jsSHA object instantiation
|
||||
*
|
||||
* @param {string} key The key used to calculate the HMAC
|
||||
* @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES
|
||||
* @param {{encoding : (string|undefined)}=} encodingOpts Associative array
|
||||
* of input format options
|
||||
*/
|
||||
setHMACKey(key:string, inputFormat:string, encodingOpts?:EncodingOptions):void;
|
||||
|
||||
/**
|
||||
* Takes strString and hashes as many blocks as possible. Stores the
|
||||
* rest for either a future update or getHash call.
|
||||
*
|
||||
* @param {string} srcString The string to be hashed
|
||||
*/
|
||||
update(srcString:string):void;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the desired HMAC of the string specified at instantiation
|
||||
* using the key and variant parameter
|
||||
*
|
||||
* @param {string} key The key used to calculate the HMAC
|
||||
* @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES
|
||||
* @param {string} variant The desired SHA variant (SHA-1, SHA-224,
|
||||
* SHA-256, SHA-384, or SHA-512)
|
||||
* @param {string} outputFormat The desired output formatting
|
||||
* (B64, HEX, or BYTES)
|
||||
* @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts
|
||||
* associative array of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string;
|
||||
* Returns the desired SHA hash of the string specified at instantiation
|
||||
* using the specified parameters
|
||||
*
|
||||
* @param {string} format The desired output formatting (B64, HEX, or BYTES)
|
||||
* @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=}
|
||||
* outputFormatOpts Hash list of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHash(format:string, outputFormatOpts?:OutputFormatOptions):string;
|
||||
|
||||
/**
|
||||
* Returns the the HMAC in the specified format using the key given by
|
||||
* a previous setHMACKey call.
|
||||
*
|
||||
* @param {string} format The desired output formatting
|
||||
* (B64, HEX, or BYTES)
|
||||
* @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=}
|
||||
* outputFormatOpts associative array of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHMAC(format:string, outputFormatOpts?:OutputFormatOptions):string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var jsSHA: jsSHA.jsSHA;
|
||||
declare module 'jssha' {
|
||||
var jsSHA: jsSHA.jsSHA;
|
||||
export = jsSHA;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ var anyObjectSeq: LazyJS.ObjectLikeSequence<any>;
|
||||
var fooAsyncSeq: LazyJS.AsyncSequence<Foo>;
|
||||
|
||||
var strSequence: LazyJS.Sequence<string>;
|
||||
var anySequence: LazyJS.Sequence<any>;
|
||||
var stringSeq: LazyJS.StringLikeSequence;
|
||||
|
||||
var obj: Object;
|
||||
@@ -44,7 +45,6 @@ function fnCallback(): void {
|
||||
}
|
||||
|
||||
function fnErrorCallback(error: any): void {
|
||||
|
||||
}
|
||||
|
||||
function fnValueCallback(value: Foo): void {
|
||||
@@ -108,8 +108,8 @@ fooSequence = fooSequence.dropWhile(fnTestCallback);
|
||||
fooSequence = fooSequence.each(fnValueCallback);
|
||||
bool = fooSequence.every(fnTestCallback);
|
||||
fooSequence = fooSequence.filter(fnTestCallback);
|
||||
fooSequence = fooSequence.find(fnTestCallback);
|
||||
fooSequence = fooSequence.findWhere(obj);
|
||||
foo = fooSequence.find(fnTestCallback);
|
||||
foo = fooSequence.findWhere(obj);
|
||||
|
||||
x = fooSequence.first();
|
||||
fooSequence = fooSequence.first(num);
|
||||
@@ -134,7 +134,7 @@ foo = fooSequence.max();
|
||||
foo = fooSequence.max(fnNumberCallback);
|
||||
foo = fooSequence.min();
|
||||
foo = fooSequence.min(fnNumberCallback);
|
||||
fooSequence = fooSequence.pluck(str);
|
||||
anySequence = fooSequence.pluck(str);
|
||||
bar = fooSequence.reduce(fnMemoCallback);
|
||||
bar = fooSequence.reduce(fnMemoCallback, bar);
|
||||
bar = fooSequence.reduceRight(fnMemoCallback, bar);
|
||||
@@ -152,8 +152,8 @@ fooSequence = fooSequence.sortBy(str, bool);
|
||||
fooSequence = fooSequence.sortBy(fnNumberCallback);
|
||||
fooSequence = fooSequence.sortBy(fnNumberCallback, bool);
|
||||
fooSequence = fooSequence.sortedIndex(foo);
|
||||
fooSequence = fooSequence.sum();
|
||||
fooSequence = fooSequence.sum(fnNumberCallback);
|
||||
foo = fooSequence.sum();
|
||||
foo = fooSequence.sum(fnNumberCallback);
|
||||
fooSequence = fooSequence.takeWhile(fnTestCallback);
|
||||
fooSequence = fooSequence.union(fooArr);
|
||||
fooSequence = fooSequence.uniq();
|
||||
|
||||
Vendored
+4
-4
@@ -135,8 +135,8 @@ declare module LazyJS {
|
||||
dropWhile(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
every(predicateFn: TestCallback<T>): boolean;
|
||||
filter(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
find(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
findWhere(properties: Object): Sequence<T>;
|
||||
find(predicateFn: TestCallback<T>): T;
|
||||
findWhere(properties: Object): T;
|
||||
|
||||
flatten(): Sequence<T>;
|
||||
groupBy(keyFn: GetKeyCallback<T>): ObjectLikeSequence<T>;
|
||||
@@ -150,7 +150,7 @@ declare module LazyJS {
|
||||
max(valueFn?: NumberCallback<T>): T;
|
||||
min(valueFn?: NumberCallback<T>): T;
|
||||
none(valueFn?: TestCallback<T>): boolean;
|
||||
pluck(propertyName: string): Sequence<T>;
|
||||
pluck(propertyName: string): Sequence<any>;
|
||||
reduce<U>(aggregatorFn: MemoCallback<T, U>, memo?: U): U;
|
||||
reduceRight<U>(aggregatorFn: MemoCallback<T, U>, memo: U): U;
|
||||
reject(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
@@ -162,7 +162,7 @@ declare module LazyJS {
|
||||
sortBy(sortFn: NumberCallback<T>, descending?: boolean): Sequence<T>;
|
||||
sortedIndex(value: T): Sequence<T>;
|
||||
size(): number;
|
||||
sum(valueFn?: NumberCallback<T>): Sequence<T>;
|
||||
sum(valueFn?: NumberCallback<T>): T;
|
||||
takeWhile(predicateFn: TestCallback<T>): Sequence<T>;
|
||||
union(var_args: T[]): Sequence<T>;
|
||||
uniq(): Sequence<T>;
|
||||
|
||||
+99
-17
@@ -1315,17 +1315,86 @@ module TestSortedIndex {
|
||||
|
||||
// _.sortedLastIndex
|
||||
module TestSortedLastIndex {
|
||||
result = <number>_.sortedLastIndex([20, 30, 50], 40);
|
||||
result = <number>_.sortedLastIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
|
||||
var sortedLastIndexDict: { wordToNumber: { [idx: string]: number } } = {
|
||||
'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
|
||||
};
|
||||
result = <number>_.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) {
|
||||
return sortedLastIndexDict.wordToNumber[word];
|
||||
});
|
||||
result = <number>_.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) {
|
||||
return this.wordToNumber[word];
|
||||
}, sortedLastIndexDict);
|
||||
type SampleType = {a: number; b: string; c: boolean;};
|
||||
|
||||
let array: SampleType[];
|
||||
let list: _.List<SampleType>;
|
||||
|
||||
let value: SampleType;
|
||||
|
||||
let stringIterator: (x: string) => number;
|
||||
let arrayIterator: (x: SampleType) => number;
|
||||
let listIterator: (x: SampleType) => number;
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = _.sortedLastIndex<string>('', '');
|
||||
result = _.sortedLastIndex<string>('', '', stringIterator);
|
||||
result = _.sortedLastIndex<string>('', '', stringIterator, any);
|
||||
result = _.sortedLastIndex<string, number>('', '', stringIterator);
|
||||
result = _.sortedLastIndex<string, number>('', '', stringIterator, any);
|
||||
|
||||
result = _.sortedLastIndex<SampleType>(array, value);
|
||||
result = _.sortedLastIndex<SampleType>(array, value, arrayIterator);
|
||||
result = _.sortedLastIndex<SampleType>(array, value, arrayIterator, any);
|
||||
result = _.sortedLastIndex<SampleType>(array, value, '');
|
||||
result = _.sortedLastIndex<SampleType>(array, value, {a: 42});
|
||||
result = _.sortedLastIndex<SampleType, number>(array, value, arrayIterator);
|
||||
result = _.sortedLastIndex<SampleType, number>(array, value, arrayIterator, any);
|
||||
result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42});
|
||||
|
||||
result = _.sortedLastIndex<SampleType>(list, value);
|
||||
result = _.sortedLastIndex<SampleType>(list, value, listIterator);
|
||||
result = _.sortedLastIndex<SampleType>(list, value, listIterator, any);
|
||||
result = _.sortedLastIndex<SampleType>(list, value, '');
|
||||
result = _.sortedLastIndex<SampleType>(list, value, {a: 42});
|
||||
result = _.sortedLastIndex<SampleType, number>(list, value, listIterator);
|
||||
result = _.sortedLastIndex<SampleType, number>(list, value, listIterator, any);
|
||||
result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42});
|
||||
|
||||
result = _('').sortedLastIndex('');
|
||||
result = _('').sortedLastIndex<number>('', stringIterator);
|
||||
result = _('').sortedLastIndex<number>('', stringIterator, any);
|
||||
|
||||
result = _(array).sortedLastIndex(value);
|
||||
result = _(array).sortedLastIndex<number>(value, arrayIterator);
|
||||
result = _(array).sortedLastIndex<number>(value, arrayIterator, any);
|
||||
result = _(array).sortedLastIndex(value, '');
|
||||
result = _(array).sortedLastIndex<{a: number}>(value, {a: 42});
|
||||
|
||||
result = _(list).sortedLastIndex<SampleType>(value);
|
||||
result = _(list).sortedLastIndex<SampleType>(value, listIterator);
|
||||
result = _(list).sortedLastIndex<SampleType>(value, listIterator, any);
|
||||
result = _(list).sortedLastIndex<SampleType>(value, '');
|
||||
result = _(list).sortedLastIndex<SampleType>(value, {a: 42});
|
||||
result = _(list).sortedLastIndex<SampleType, number>(value, listIterator);
|
||||
result = _(list).sortedLastIndex<SampleType, number>(value, listIterator, any);
|
||||
result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42});
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<number>;
|
||||
|
||||
result = _('').chain().sortedLastIndex('');
|
||||
result = _('').chain().sortedLastIndex<number>('', stringIterator);
|
||||
result = _('').chain().sortedLastIndex<number>('', stringIterator, any);
|
||||
|
||||
result = _(array).chain().sortedLastIndex(value);
|
||||
result = _(array).chain().sortedLastIndex<number>(value, arrayIterator);
|
||||
result = _(array).chain().sortedLastIndex<number>(value, arrayIterator, any);
|
||||
result = _(array).chain().sortedLastIndex(value, '');
|
||||
result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42});
|
||||
|
||||
result = _(list).chain().sortedLastIndex<SampleType>(value);
|
||||
result = _(list).chain().sortedLastIndex<SampleType>(value, listIterator);
|
||||
result = _(list).chain().sortedLastIndex<SampleType>(value, listIterator, any);
|
||||
result = _(list).chain().sortedLastIndex<SampleType>(value, '');
|
||||
result = _(list).chain().sortedLastIndex<SampleType>(value, {a: 42});
|
||||
result = _(list).chain().sortedLastIndex<SampleType, number>(value, listIterator);
|
||||
result = _(list).chain().sortedLastIndex<SampleType, number>(value, listIterator, any);
|
||||
result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42});
|
||||
}
|
||||
}
|
||||
|
||||
// _.tail
|
||||
@@ -5397,12 +5466,25 @@ result = <boolean>_({}).isMatch({}, testIsMatchCustiomizerFn);
|
||||
result = <boolean>_({}).isMatch({}, testIsMatchCustiomizerFn, {});
|
||||
|
||||
// _.isNaN
|
||||
result = <boolean>_.isNaN(NaN);
|
||||
result = <boolean>_.isNaN(new Number(NaN));
|
||||
result = <boolean>_.isNaN(undefined);
|
||||
result = <boolean>_(NaN).isNaN();
|
||||
result = <boolean>_(new Number(NaN)).isNaN();
|
||||
result = <boolean>_(undefined).isNaN();
|
||||
module TestIsNaN {
|
||||
{
|
||||
let result: boolean;
|
||||
|
||||
result = _.isNaN(any);
|
||||
|
||||
result = _(1).isNaN();
|
||||
result = _<any>([]).isNaN();
|
||||
result = _({}).isNaN();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<boolean>;
|
||||
|
||||
result = _(1).chain().isNaN();
|
||||
result = _<any>([]).chain().isNaN();
|
||||
result = _({}).chain().isNaN();
|
||||
}
|
||||
}
|
||||
|
||||
// _.isNative
|
||||
result = <boolean>_.isNative(Array.prototype.push);
|
||||
|
||||
Vendored
+209
-49
@@ -2156,71 +2156,222 @@ declare module _ {
|
||||
//_.sortedLastIndex
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Uses a binary search to determine the highest index at which a value should be inserted
|
||||
* into a given sorted array in order to maintain the sort order of the array. If a callback
|
||||
* is provided it will be executed for value and each element of array to compute their sort
|
||||
* ranking. The callback is bound to thisArg and invoked with one argument; (value).
|
||||
*
|
||||
* If a property name is provided for callback the created "_.pluck" style callback will
|
||||
* return the property value of the given element.
|
||||
*
|
||||
* If an object is provided for callback the created "_.where" style callback will return
|
||||
* true for elements that have the properties of the given object, else false.
|
||||
* @param array The sorted list.
|
||||
* @param value The value to determine its index within `list`.
|
||||
* @param callback Iterator to compute the sort ranking of each value, optional.
|
||||
* @return The index at which value should be inserted into array.
|
||||
**/
|
||||
sortedLastIndex<T, TSort>(
|
||||
array: Array<T>,
|
||||
value: T,
|
||||
callback?: (x: T) => TSort,
|
||||
thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
**/
|
||||
* This method is like _.sortedIndex except that it returns the highest index at which value should be
|
||||
* inserted into array in order to maintain its sort order.
|
||||
*
|
||||
* @param array The sorted array to inspect.
|
||||
* @param value The value to evaluate.
|
||||
* @param iteratee The function invoked per iteration.
|
||||
* @param thisArg The this binding of iteratee.
|
||||
* @return Returns the index at which value should be inserted into array.
|
||||
*/
|
||||
sortedLastIndex<T, TSort>(
|
||||
array: List<T>,
|
||||
value: T,
|
||||
callback?: (x: T) => TSort,
|
||||
thisArg?: any): number;
|
||||
iteratee?: (x: T) => TSort,
|
||||
thisArg?: any
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
* @param pluckValue the _.pluck style callback
|
||||
**/
|
||||
sortedLastIndex<T>(
|
||||
array: Array<T>,
|
||||
value: T,
|
||||
pluckValue: string): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
* @param pluckValue the _.pluck style callback
|
||||
**/
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
array: List<T>,
|
||||
value: T,
|
||||
pluckValue: string): number;
|
||||
iteratee?: (x: T) => any,
|
||||
thisArg?: any
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
* @param pluckValue the _.where style callback
|
||||
**/
|
||||
sortedLastIndex<W, T>(
|
||||
array: Array<T>,
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
array: List<T>,
|
||||
value: T,
|
||||
whereValue: W): number;
|
||||
iteratee: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
* @param pluckValue the _.where style callback
|
||||
**/
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<W, T>(
|
||||
array: List<T>,
|
||||
value: T,
|
||||
whereValue: W): number;
|
||||
iteratee: W
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
array: List<T>,
|
||||
value: T,
|
||||
iteratee: Object
|
||||
): number;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<TSort>(
|
||||
value: string,
|
||||
iteratee?: (x: string) => TSort,
|
||||
thisArg?: any
|
||||
): number;
|
||||
}
|
||||
|
||||
interface LoDashImplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<TSort>(
|
||||
value: T,
|
||||
iteratee?: (x: T) => TSort,
|
||||
thisArg?: any
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex(
|
||||
value: T,
|
||||
iteratee: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<W>(
|
||||
value: T,
|
||||
iteratee: W
|
||||
): number;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T, TSort>(
|
||||
value: T,
|
||||
iteratee?: (x: T) => TSort,
|
||||
thisArg?: any
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
value: T,
|
||||
iteratee?: (x: T) => any,
|
||||
thisArg?: any
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
value: T,
|
||||
iteratee: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<W, T>(
|
||||
value: T,
|
||||
iteratee: W
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
value: T,
|
||||
iteratee: Object
|
||||
): number;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<TSort>(
|
||||
value: string,
|
||||
iteratee?: (x: string) => TSort,
|
||||
thisArg?: any
|
||||
): LoDashExplicitWrapper<number>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<TSort>(
|
||||
value: T,
|
||||
iteratee?: (x: T) => TSort,
|
||||
thisArg?: any
|
||||
): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex(
|
||||
value: T,
|
||||
iteratee: string
|
||||
): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<W>(
|
||||
value: T,
|
||||
iteratee: W
|
||||
): LoDashExplicitWrapper<number>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T, TSort>(
|
||||
value: T,
|
||||
iteratee?: (x: T) => TSort,
|
||||
thisArg?: any
|
||||
): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
value: T,
|
||||
iteratee?: (x: T) => any,
|
||||
thisArg?: any
|
||||
): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
value: T,
|
||||
iteratee: string
|
||||
): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<W, T>(
|
||||
value: T,
|
||||
iteratee: W
|
||||
): LoDashExplicitWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.sortedLastIndex
|
||||
*/
|
||||
sortedLastIndex<T>(
|
||||
value: T,
|
||||
iteratee: Object
|
||||
): LoDashExplicitWrapper<number>;
|
||||
}
|
||||
|
||||
//_.tail
|
||||
@@ -9272,7 +9423,9 @@ declare module _ {
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if value is NaN.
|
||||
*
|
||||
* Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values.
|
||||
*
|
||||
* @param value The value to check.
|
||||
* @return Returns true if value is NaN, else false.
|
||||
*/
|
||||
@@ -9286,6 +9439,13 @@ declare module _ {
|
||||
isNaN(): boolean;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.isNaN
|
||||
*/
|
||||
isNaN(): LoDashExplicitWrapper<boolean>;
|
||||
}
|
||||
|
||||
//_.isNative
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import * as React from "react";
|
||||
import * as LinkedStateMixin from "react-addons-linked-state-mixin";
|
||||
import Checkbox = require("material-ui/lib/checkbox");
|
||||
import Colors = require("material-ui/lib/styles/colors");
|
||||
import Spacing = require("material-ui/lib/styles/spacing");
|
||||
import AppBar = require("material-ui/lib/app-bar");
|
||||
import Badge = require("material-ui/lib/badge");
|
||||
import IconButton = require("material-ui/lib/icon-button");
|
||||
@@ -47,7 +48,13 @@ type CheckboxProps = __MaterialUI.CheckboxProps;
|
||||
type MuiTheme = __MaterialUI.Styles.MuiTheme;
|
||||
type TouchTapEvent = __MaterialUI.TouchTapEvent;
|
||||
|
||||
class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin {
|
||||
interface MaterialUiTestsState {
|
||||
showDialogStandardActions: boolean;
|
||||
showDialogCustomActions: boolean;
|
||||
showDialogScrollable: boolean;
|
||||
}
|
||||
|
||||
class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implements React.LinkedStateMixin {
|
||||
|
||||
// injected with mixin
|
||||
linkState: <T>(key: string) => React.ReactLink<T>;
|
||||
@@ -60,6 +67,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
}
|
||||
private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) {
|
||||
}
|
||||
private handleRequestClose(buttonClicked: boolean) {
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -193,7 +202,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
title="Dialog With Standard Actions"
|
||||
actions={standardActions}
|
||||
actionFocus="submit"
|
||||
modal={true}>
|
||||
open={this.state.showDialogStandardActions}
|
||||
onRequestClose={this.handleRequestClose}>
|
||||
The actions in this window are created from the json that's passed in.
|
||||
</Dialog>;
|
||||
|
||||
@@ -212,12 +222,23 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
element = <Dialog
|
||||
title="Dialog With Custom Actions"
|
||||
actions={customActions}
|
||||
modal={false}
|
||||
autoDetectWindowHeight={true}
|
||||
autoScrollBodyContent={true}>
|
||||
open={this.state.showDialogCustomActions}
|
||||
onRequestClose={this.handleRequestClose}>
|
||||
The actions in this window were passed in as an array of react objects.
|
||||
</Dialog>;
|
||||
|
||||
element = <Dialog
|
||||
title="Dialog With Scrollable Content"
|
||||
actions={customActions}
|
||||
autoDetectWindowHeight={true}
|
||||
autoScrollBodyContent={true}
|
||||
open={this.state.showDialogScrollable}
|
||||
onRequestClose={this.handleRequestClose}>
|
||||
<div style={{ height: '1000px' }}>
|
||||
Really long content
|
||||
</div>
|
||||
</Dialog>;
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/dropdown-menu"
|
||||
let menuItems = [
|
||||
@@ -488,7 +509,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
element = <GridList
|
||||
cols={3}
|
||||
padding={50}
|
||||
cellHeight={200} />;
|
||||
cellHeight={200}
|
||||
style={{ color: 'red' }} />;
|
||||
|
||||
element = <GridTile
|
||||
title="GridTileTitle"
|
||||
@@ -497,7 +519,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
titlePosition="top"
|
||||
titleBackground="rgba(0, 0, 0, 0.4)"
|
||||
cols={2}
|
||||
rows={1} >
|
||||
rows={1}
|
||||
style={{ color: 'red' }}>
|
||||
<h1>Children are Required!</h1>
|
||||
</GridTile>;
|
||||
|
||||
|
||||
Vendored
+10
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for material-ui v0.13.1
|
||||
// Type definitions for material-ui v0.13.4
|
||||
// Project: https://github.com/callemall/material-ui
|
||||
// Definitions by: Nathan Brown <https://github.com/ngbrown>, Oliver Herrmann <https://github.com/herrmanno>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -379,14 +379,18 @@ declare namespace __MaterialUI {
|
||||
openImmediately?: boolean;
|
||||
repositionOnUpdate?: boolean;
|
||||
title?: React.ReactNode;
|
||||
defaultOpen?: boolean;
|
||||
open?: boolean;
|
||||
|
||||
onClickAway?: () => void;
|
||||
onDismiss?: () => void;
|
||||
onShow?: () => void;
|
||||
onRequestClose?: (buttonClicked: boolean) => void;
|
||||
}
|
||||
export class Dialog extends React.Component<DialogProps, {}> {
|
||||
dismiss(): void;
|
||||
show(): void;
|
||||
isOpen(): boolean;
|
||||
}
|
||||
|
||||
interface DropDownIconProps extends React.Props<DropDownIcon> {
|
||||
@@ -567,6 +571,7 @@ declare namespace __MaterialUI {
|
||||
nestedItems?: React.ReactElement<any>[];
|
||||
onKeyboardFocus?: React.FocusEventHandler;
|
||||
onNestedListToggle?: (item: ListItem) => void;
|
||||
onClick?: React.MouseEventHandler;
|
||||
rightAvatar?: React.ReactElement<any>;
|
||||
rightIcon?: React.ReactElement<any>;
|
||||
rightIconButton?: React.ReactElement<any>;
|
||||
@@ -870,6 +875,8 @@ declare namespace __MaterialUI {
|
||||
desktopSubheaderHeight?: number;
|
||||
desktopToolbarHeight?: number;
|
||||
}
|
||||
export var Spacing: Spacing;
|
||||
|
||||
interface ThemePalette {
|
||||
primary1Color?: string;
|
||||
primary2Color?: string;
|
||||
@@ -1532,6 +1539,7 @@ declare namespace __MaterialUI {
|
||||
cols?: number;
|
||||
padding?: number;
|
||||
cellHeight?: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
export class GridList extends React.Component<GridListProps, {}>{
|
||||
@@ -1547,6 +1555,7 @@ declare namespace __MaterialUI {
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
rootClass?: string | __React.Component<any,any>;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
export class GridTile extends React.Component<GridTileProps, {}>{
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="tsd.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
module ngCordova {
|
||||
'use strict';
|
||||
|
||||
angular.module('test')
|
||||
// Adapted from http://ngcordova.com/docs/plugins/actionSheet/
|
||||
.controller('ThisCtrl', function($cordovaActionSheet: ngCordova.IActionSheetService) {
|
||||
|
||||
var options = {
|
||||
title: 'What do you want with this image?',
|
||||
buttonLabels: ['Share via Facebook', 'Share via Twitter'],
|
||||
addCancelButtonWithLabel: 'Cancel',
|
||||
androidEnableCancelButton: true,
|
||||
winphoneEnableCancelButton: true,
|
||||
addDestructiveButtonWithLabel: 'Delete it'
|
||||
};
|
||||
|
||||
document.addEventListener("deviceready", function() {
|
||||
$cordovaActionSheet.show(options)
|
||||
.then(function(btnIndex) {
|
||||
var index: number = btnIndex;
|
||||
});
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for ngCordova Action Sheet plugin
|
||||
// Project: https://github.com/driftyco/ng-cordova
|
||||
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ngCordova {
|
||||
export interface IActionSheetService {
|
||||
show(options: ShowOptions): ng.IPromise<number>;
|
||||
hide(): ng.IPromise<void>;
|
||||
}
|
||||
|
||||
export interface ShowOptions {
|
||||
title?: string;
|
||||
buttonLabels?: string[];
|
||||
addCancelButtonWithLabel?: string;
|
||||
addDestructiveButtonWithLabel?: string;
|
||||
androidEnableCancelButton?: boolean;
|
||||
winphoneEnableCancelButton?: boolean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/// <reference path="tsd.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
module ngCordova {
|
||||
'use strict';
|
||||
|
||||
angular.module('test')
|
||||
// Adapted from http://ngcordova.com/docs/plugins/badge/
|
||||
.controller('ThisCtrl', function($cordovaBadge: ngCordova.IBadgeService) {
|
||||
|
||||
$cordovaBadge.hasPermission().then(function(yes) {
|
||||
// You have permission
|
||||
}, function(no) {
|
||||
// You do not have permission
|
||||
});
|
||||
|
||||
$cordovaBadge.set(3).then(function() {
|
||||
// You have permission, badge set.
|
||||
}, function(err) {
|
||||
// You do not have permission.
|
||||
});
|
||||
|
||||
$cordovaBadge.get().then(function(badge) {
|
||||
// You have permission, badge returned.
|
||||
var badgeNo: number = badge;
|
||||
}, function(err) {
|
||||
// You do not have permission.
|
||||
});
|
||||
|
||||
$cordovaBadge.clear().then(function() {
|
||||
// You have permission, badge cleared.
|
||||
}, function(err) {
|
||||
// You do not have permission.
|
||||
});
|
||||
|
||||
$cordovaBadge.increase().then(function() {
|
||||
// You have permission, badge increased.
|
||||
}, function(err) {
|
||||
// You do not have permission.
|
||||
});
|
||||
$cordovaBadge.increase(3).then(function() {
|
||||
// You have permission, badge increased.
|
||||
}, function(err) {
|
||||
// You do not have permission.
|
||||
});
|
||||
|
||||
$cordovaBadge.decrease().then(function() {
|
||||
// You have permission, badge increased.
|
||||
}, function(err) {
|
||||
// You do not have permission.
|
||||
});
|
||||
$cordovaBadge.decrease(2).then(function() {
|
||||
// You have permission, badge increased.
|
||||
}, function(err) {
|
||||
// You do not have permission.
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for ngCordova badge plugin
|
||||
// Project: https://github.com/driftyco/ng-cordova
|
||||
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ngCordova {
|
||||
export interface IBadgeService {
|
||||
hasPermission(): ng.IPromise<boolean>;
|
||||
promptForPermission(): ng.IPromise<any>;
|
||||
set(badge: number, callback?: Function, scope?: {}): ng.IPromise<any>;
|
||||
get(): ng.IPromise<number>;
|
||||
clear(callback?: Function, scope?: {}): ng.IPromise<any>;
|
||||
increase(count?: number, callback?: Function, scope?: {}): ng.IPromise<any>;
|
||||
decrease(count?: number, callback?: Function, scope?: {}): ng.IPromise<any>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/// <reference path="tsd.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../cordova/cordova.d.ts" />
|
||||
|
||||
module ngCordova {
|
||||
'use strict';
|
||||
|
||||
|
||||
angular.module('test')
|
||||
// Adapted from http://ngcordova.com/docs/plugins/file/
|
||||
.controller('MyCtrl', function($scope: ng.IScope, $cordovaFile: ngCordova.IFileService) {
|
||||
|
||||
document.addEventListener('deviceready', function() {
|
||||
|
||||
$cordovaFile.getFreeDiskSpace()
|
||||
.then(function(success) {
|
||||
// success in kilobytes
|
||||
var freeSpace: number = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
// CHECK
|
||||
$cordovaFile.checkDir(cordova.file.dataDirectory, "dir/other_dir")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var dir: DirectoryEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
$cordovaFile.checkFile(cordova.file.dataDirectory, "some_file.txt")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var fileResult: FileEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
// CREATE
|
||||
$cordovaFile.createDir(cordova.file.dataDirectory, "new_dir", false)
|
||||
.then(function(success) {
|
||||
// success
|
||||
var dir: DirectoryEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.createFile(cordova.file.dataDirectory, "new_file.txt", true)
|
||||
.then(function(success) {
|
||||
// success
|
||||
var fileResult: FileEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
// REMOVE
|
||||
$cordovaFile.removeDir(cordova.file.dataDirectory, "some_dir")
|
||||
.then(function(success) {
|
||||
// success
|
||||
if (success.success) {
|
||||
var dirResult: DirectoryEntry = success.fileRemoved;
|
||||
}
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.removeFile(cordova.file.dataDirectory, "some_file.txt")
|
||||
.then(function(success) {
|
||||
// success
|
||||
if (success.success) {
|
||||
var fileResult: FileEntry = success.fileRemoved;
|
||||
}
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.removeRecursively(cordova.file.dataDirectory, "")
|
||||
.then(function(success) {
|
||||
// success
|
||||
if (success.success) {
|
||||
var dirResult: DirectoryEntry = success.fileRemoved;
|
||||
}
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
// WRITE
|
||||
$cordovaFile.writeFile(cordova.file.dataDirectory, "file.txt", "text", true)
|
||||
.then(function(success) {
|
||||
// success
|
||||
var endEvent: ProgressEvent = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.writeExistingFile(cordova.file.dataDirectory, "file.txt", "text")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var endEvent: ProgressEvent = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
// READ
|
||||
$cordovaFile.readAsText(cordova.file.dataDirectory, "file.txt")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var text: string = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.readAsDataURL(cordova.file.dataDirectory, "file.txt")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var text: string = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.readAsBinaryString(cordova.file.dataDirectory, "file.txt")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var text: string = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.readAsArrayBuffer(cordova.file.dataDirectory, "file.txt")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var buffer: ArrayBuffer = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
// MOVE
|
||||
$cordovaFile.moveDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var dirResult: DirectoryEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.moveFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory)
|
||||
.then(function(success) {
|
||||
// success
|
||||
var fileResult: FileEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
// COPY
|
||||
$cordovaFile.copyDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var dirResult: DirectoryEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
$cordovaFile.copyFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory, "new_file.txt")
|
||||
.then(function(success) {
|
||||
// success
|
||||
var fileResult: FileEntry = success;
|
||||
}, function(error) {
|
||||
// error
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// Type definitions for ngCordova file plugin
|
||||
// Project: https://github.com/driftyco/ng-cordova
|
||||
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../cordova/plugins/FileSystem.d.ts" />
|
||||
|
||||
declare module ngCordova {
|
||||
export interface IFileService {
|
||||
getFreeDiskSpace(): IFilePromise<number>;
|
||||
|
||||
checkDir(path: string, directory: string): IFilePromise<DirectoryEntry>;
|
||||
checkFile(path: string, file: string): IFilePromise<FileEntry>;
|
||||
|
||||
createDir(path: string, directory: string, replace?: boolean): IFilePromise<DirectoryEntry>;
|
||||
createFile(path: string, file: string, replace?: boolean): IFilePromise<FileEntry>;
|
||||
|
||||
removeDir(path: string, directory: string): IFilePromise<IFileRemoveResult<DirectoryEntry>>;
|
||||
removeFile(path: string, file: string): IFilePromise<IFileRemoveResult<FileEntry>>;
|
||||
removeRecursively(path: string, directory: string): IFilePromise<IFileRemoveResult<DirectoryEntry>>;
|
||||
|
||||
writeFile(path: string, file: string, text: string | Blob, replace?: boolean): IFilePromise<ProgressEvent>;
|
||||
writeExistingFile(path: string, file: string, text: string | Blob): IFilePromise<ProgressEvent>;
|
||||
|
||||
readAsText(path: string, file: string): ng.IPromise<string>;
|
||||
readAsDataURL(path: string, file: string): ng.IPromise<string>;
|
||||
readAsBinaryString(path: string, file: string): ng.IPromise<string>;
|
||||
readAsArrayBuffer(path: string, file: string): ng.IPromise<ArrayBuffer>;
|
||||
|
||||
moveDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise<DirectoryEntry>;
|
||||
moveFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise<FileEntry>;
|
||||
|
||||
copyDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise<DirectoryEntry>;
|
||||
copyFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise<FileEntry>;
|
||||
}
|
||||
|
||||
export interface IFilePromise<T> extends ng.IPromise<T> {
|
||||
then<TResult>(successCallback: (promiseValue: T) => ng.IPromise<TResult> | TResult, errorCallback?: (error: IFileError) => ng.IPromise<TResult> | TResult): ng.IPromise<TResult>;
|
||||
catch<TResult>(onRejected: (error: IFileError) => ng.IPromise<TResult> | TResult): ng.IPromise<TResult>;
|
||||
}
|
||||
|
||||
export interface IFileRemoveResult<TEntry> {
|
||||
success: boolean;
|
||||
fileRemoved: TEntry;
|
||||
}
|
||||
|
||||
export interface IFileError extends FileError {
|
||||
message: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/// <reference path="tsd.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../cordova/cordova.d.ts" />
|
||||
|
||||
module ngCordova {
|
||||
'use strict';
|
||||
|
||||
angular.module('test')
|
||||
// Adapted from http://ngcordova.com/docs/plugins/fileTransfer/
|
||||
.controller('MyCtrl', function($scope: ng.IScope & { downloadProgress: number; }, $timeout: ng.ITimeoutService, $cordovaFileTransfer: ngCordova.IFileTransferService) {
|
||||
|
||||
document.addEventListener('deviceready', function() {
|
||||
|
||||
var url = "http://cdn.wall-pix.net/albums/art-space/00030109.jpg";
|
||||
var targetPath = cordova.file.documentsDirectory + "testImage.png";
|
||||
var trustHosts = true
|
||||
var options = {};
|
||||
|
||||
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
|
||||
.then(function(result) {
|
||||
// Success!
|
||||
var file: FileEntry = result;
|
||||
}, function(err) {
|
||||
// Error
|
||||
}, function(progress) {
|
||||
$timeout(function() {
|
||||
$scope.downloadProgress = (progress.loaded / progress.total) * 100;
|
||||
})
|
||||
});
|
||||
|
||||
}, false);
|
||||
|
||||
|
||||
document.addEventListener('deviceready', function() {
|
||||
|
||||
var url = "http://cdn.wall-pix.net/uploads";
|
||||
var filePath = cordova.file.documentsDirectory + "testImage.png";
|
||||
var trustHosts = true
|
||||
var options = {};
|
||||
|
||||
$cordovaFileTransfer.upload(url, filePath, options, trustHosts)
|
||||
.then(function(result) {
|
||||
// Success!
|
||||
var file: FileUploadResult = result;
|
||||
}, function(err) {
|
||||
// Error
|
||||
}, function(progress) {
|
||||
// constant progress updates
|
||||
});
|
||||
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for ngCordova file-transfer plugin
|
||||
// Project: https://github.com/driftyco/ng-cordova
|
||||
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../cordova/plugins/FileTransfer.d.ts" />
|
||||
/// <reference path="../cordova/plugins/FileSystem.d.ts" />
|
||||
|
||||
declare module ngCordova {
|
||||
export interface IFileTransferService {
|
||||
download(url: string, filePath: string, options?: IFileDownloadOptions, trustAllHosts?: boolean): IFileTransferPromise<FileEntry>;
|
||||
upload(url: string, filePath: string, options?: IFileUploadOptions, trustAllHosts?: boolean): IFileTransferPromise<FileUploadResult>;
|
||||
}
|
||||
|
||||
export interface IFileTransferPromise<T> extends ng.IPromise<T> {
|
||||
then<TResult>(successCallback: (promiseValue: T) => ng.IPromise<TResult> | TResult, errorCallback?: (error: FileTransferError) => ng.IPromise<TResult> | TResult, notifyCallback?: (state: any) => any): ng.IPromise<TResult>;
|
||||
catch<TResult>(onRejected: (error: FileTransferError) => ng.IPromise<TResult> | TResult): ng.IPromise<TResult>;
|
||||
}
|
||||
|
||||
export interface IFileDownloadOptions extends FileDownloadOptions {
|
||||
encodeURI?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export interface IFileUploadOptions extends FileUploadOptions {
|
||||
encodeURI?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -15,3 +15,7 @@
|
||||
/// <reference path="datepicker.d.ts"/>
|
||||
/// <reference path="app-version.d.ts"/>
|
||||
/// <reference path="camera.d.ts"/>
|
||||
/// <reference path="actionSheet.d.ts"/>
|
||||
/// <reference path="badge.d.ts"/>
|
||||
/// <reference path="file.d.ts"/>
|
||||
/// <reference path="fileTransfer.d.ts"/>
|
||||
|
||||
+13
-5
@@ -1,10 +1,18 @@
|
||||
/// <reference path="opn.d.ts" />
|
||||
|
||||
import opn = require('opn');
|
||||
import * as opn from "opn";
|
||||
|
||||
var errorCallback: (err: Error) => void;
|
||||
|
||||
opn('foo');
|
||||
opn('foo', 'bar');
|
||||
opn('foo', errorCallback);
|
||||
opn('foo', 'bar', errorCallback);
|
||||
opn("foo");
|
||||
opn("foo", errorCallback);
|
||||
|
||||
opn("foo", { app: "bar" });
|
||||
opn("foo", { app: ["bar", "--arg"] });
|
||||
opn("foo", { app: "bar", wait: false });
|
||||
opn("foo", { app: ["bar", "--arg"] , wait: false});
|
||||
|
||||
opn("foo", { app: "bar" }, errorCallback);
|
||||
opn("foo", { app: ["bar", "--arg"] }, errorCallback);
|
||||
opn("foo", { app: "bar", wait: false }, errorCallback);
|
||||
opn("foo", { app: ["bar", "--arg"], wait: false }, errorCallback);
|
||||
|
||||
Vendored
+78
-6
@@ -1,10 +1,82 @@
|
||||
// Type definitions for opn 1.0.0
|
||||
// Type definitions for opn 3.0.2
|
||||
// Project: https://github.com/sindresorhus/opn
|
||||
// Definitions by: Shinnosuke Watanabe <https://github.com/shinnn>
|
||||
// Definitions by: Shinnosuke Watanabe <https://github.com/shinnn>,
|
||||
// Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'opn' {
|
||||
function opn(target: string, callback?: (err: Error) => void): void;
|
||||
function opn(target: string, app: string, callback?: (err: Error) => void): void;
|
||||
export = opn;
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare namespace Opn {
|
||||
export interface Options {
|
||||
/**
|
||||
* Wait for the opened app to exit before calling the `callback`.
|
||||
* If `false` it's called immediately when opening the app.
|
||||
* On Windows you have to explicitly specify an app for it to be able to wait.
|
||||
*/
|
||||
wait?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the app to open the target with, or an array with the app and app arguments.
|
||||
* The app name is platform dependent. Don't hard code it in reusable modules.
|
||||
* Eg. Chrome is `google chrome` on OS X, `google-chrome` on Linux and `chrome` on Windows.
|
||||
*/
|
||||
app?: string | string[];
|
||||
}
|
||||
}
|
||||
|
||||
declare module "opn" {
|
||||
import * as cp from "child_process";
|
||||
|
||||
interface DefaultFunction {
|
||||
/**
|
||||
* Uses the command open on OS X, start on Windows and xdg-open on other platforms.
|
||||
*
|
||||
* Returns the spawned child process.
|
||||
* You'd normally not need to use this for anything, but it can be useful if you'd like
|
||||
* to attach custom event listeners or perform other operations directly on the spawned process.
|
||||
*
|
||||
* @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser.
|
||||
*/
|
||||
(target: string): cp.ChildProcess;
|
||||
|
||||
/**
|
||||
* Uses the command open on OS X, start on Windows and xdg-open on other platforms.
|
||||
*
|
||||
* Returns the spawned child process.
|
||||
* You'd normally not need to use this for anything, but it can be useful if you'd like
|
||||
* to attach custom event listeners or perform other operations directly on the spawned process.
|
||||
*
|
||||
* @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser.
|
||||
* @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening.
|
||||
*/
|
||||
(target: string, callback: (err: Error) => void): cp.ChildProcess;
|
||||
|
||||
/**
|
||||
* Uses the command open on OS X, start on Windows and xdg-open on other platforms.
|
||||
*
|
||||
* Returns the spawned child process.
|
||||
* You'd normally not need to use this for anything, but it can be useful if you'd like
|
||||
* to attach custom event listeners or perform other operations directly on the spawned process.
|
||||
*
|
||||
* @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser.
|
||||
* @param options - Options to be passed to opn.
|
||||
*/
|
||||
(target: string, options: Opn.Options): cp.ChildProcess;
|
||||
|
||||
/**
|
||||
* Uses the command open on OS X, start on Windows and xdg-open on other platforms.
|
||||
*
|
||||
* Returns the spawned child process.
|
||||
* You'd normally not need to use this for anything, but it can be useful if you'd like
|
||||
* to attach custom event listeners or perform other operations directly on the spawned process.
|
||||
*
|
||||
* @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser.
|
||||
* @param options - Options to be passed to opn.
|
||||
* @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening.
|
||||
*/
|
||||
(target: string, options: Opn.Options, callback: (err: Error) => void): cp.ChildProcess;
|
||||
}
|
||||
|
||||
const opn: DefaultFunction;
|
||||
export = opn;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
///<reference path='../react/react.d.ts' />
|
||||
///<reference path='../react-infinite/react-infinite.d.ts' />
|
||||
|
||||
import * as React from 'react';
|
||||
import Infinite = require('react-infinite');
|
||||
|
||||
class Test1 extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return (
|
||||
<Infinite containerHeight={200} elementHeight={40}>
|
||||
<div className="one"/>
|
||||
<div className="two"/>
|
||||
<div className="three"/>
|
||||
</Infinite>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Test2 extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return (
|
||||
<Infinite containerHeight={200} elementHeight={[111, 252, 143]}>
|
||||
<div className="111-px"/>
|
||||
<div className="252-px"/>
|
||||
<div className="143-px"/>
|
||||
</Infinite>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Test3 extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return (
|
||||
<Infinite containerHeight={200} elementHeight={[111, 252, 143]}
|
||||
useWindowAsScrollContainer>
|
||||
<div className="111-px"/>
|
||||
<div className="252-px"/>
|
||||
<div className="143-px"/>
|
||||
</Infinite>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Test4 extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return (
|
||||
<Infinite containerHeight={200} elementHeight={[111, 252, 143]}
|
||||
displayBottomUpwards>
|
||||
<div className="third-latest-chat"/>
|
||||
<div className="second-latest-chat"/>
|
||||
<div className="latest-chat-message"/>
|
||||
</Infinite>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var ListItem = React.createClass<{key: number; num: number;}, {}>({
|
||||
render: function() {
|
||||
return <div className="infinite-list-item">
|
||||
List Item {this.props.num}
|
||||
</div>;
|
||||
}
|
||||
});
|
||||
|
||||
var InfiniteList = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
elements: this.buildElements(0, 20),
|
||||
isInfiniteLoading: false
|
||||
}
|
||||
},
|
||||
|
||||
buildElements: function(start: number, end: number) {
|
||||
var elements = [] as React.ReactElement<any>[];
|
||||
for (var i = start; i < end; i++) {
|
||||
elements.push(<ListItem key={i} num={i}/>)
|
||||
}
|
||||
return elements;
|
||||
},
|
||||
|
||||
handleInfiniteLoad: function() {
|
||||
var that = this;
|
||||
this.setState({
|
||||
isInfiniteLoading: true
|
||||
});
|
||||
setTimeout(function() {
|
||||
var elemLength = that.state.elements.length,
|
||||
newElements = that.buildElements(elemLength, elemLength + 1000);
|
||||
that.setState({
|
||||
isInfiniteLoading: false,
|
||||
elements: that.state.elements.concat(newElements)
|
||||
});
|
||||
}, 2500);
|
||||
},
|
||||
|
||||
elementInfiniteLoad: function() {
|
||||
return <div className="infinite-list-item">
|
||||
Loading...
|
||||
</div>;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return <Infinite elementHeight={40}
|
||||
containerHeight={250}
|
||||
infiniteLoadBeginEdgeOffset={200}
|
||||
onInfiniteLoad={this.handleInfiniteLoad}
|
||||
loadingSpinnerDelegate={this.elementInfiniteLoad()}
|
||||
isInfiniteLoading={this.state.isInfiniteLoading}
|
||||
>
|
||||
{this.state.elements}
|
||||
</Infinite>;
|
||||
}
|
||||
});
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for react-infinite
|
||||
// Project: https://github.com/seatgeek/react-infinite
|
||||
// Definitions by: rhysd <https://github.com/rhysd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path='../react/react.d.ts' />
|
||||
|
||||
declare module "react-infinite" {
|
||||
import Infinite = ReactInfinite.Infinite;
|
||||
export = Infinite;
|
||||
}
|
||||
|
||||
declare namespace ReactInfinite {
|
||||
import React = __React;
|
||||
|
||||
interface InfiniteProps extends React.Props<Infinite> {
|
||||
elementHeight: number | number[];
|
||||
containerHeight?: number;
|
||||
preloadBatchSize?: number | Object;
|
||||
preloadAdditionalHeight?: number | Object;
|
||||
handleScroll?: (node: React.ReactElement<any>) => void;
|
||||
infiniteLoadBeginBottomOffset?: number;
|
||||
infiniteLoadBeginEdgeOffset?: number;
|
||||
onInfiniteLoad?: () => void;
|
||||
loadingSpinnerDelegate?: React.ReactElement<any>;
|
||||
isInfiniteLoading?: boolean;
|
||||
timeScrollStateLastsForAfterUserScrolls?: number;
|
||||
className?: string;
|
||||
useWindowAsScrollContainer?: boolean;
|
||||
displayBottomUpwards?: boolean;
|
||||
}
|
||||
|
||||
export class Infinite extends React.Component<InfiniteProps, {}> {
|
||||
static containerHeightScaleFactor(n: number): any;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference path="stamplay-js-sdk.d.ts" />
|
||||
|
||||
Stamplay.init('sample');
|
||||
var userFn = Stamplay.User();
|
||||
var user = new userFn.Model;
|
||||
var colTags = Stamplay.Cobject('tag');
|
||||
|
||||
Vendored
+1
@@ -26,6 +26,7 @@ declare module Stamplay {
|
||||
}
|
||||
|
||||
export interface StamplayStatic {
|
||||
init(appId : string) : void;
|
||||
User() : IStamplayObject
|
||||
Cobject(object : string) : IStamplayObject
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -28,7 +28,7 @@ declare module "swig" {
|
||||
compileFile(pathname: string, options?: SwigOptions): (locals?: any) => string;
|
||||
render(source: string, options?: SwigOptions): string;
|
||||
renderFile(pathName: string, locals: any, cb: (err: Error, output: string) => void): void;
|
||||
renderFile(pathName: string, locals?: any): string
|
||||
renderFile(pathName: string, locals?: any): string;
|
||||
run(templateFn: Function, locals?: any, filePath?: string): string;
|
||||
invalidateCache(): void;
|
||||
|
||||
@@ -155,4 +155,4 @@ declare module "swig" {
|
||||
export function renderFile(pathName: string, locals?: any): string
|
||||
export function run(templateFn: Function, locals?: any, filePath?: string): string;
|
||||
export function invalidateCache(): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/// <reference path="zeroclipboard-1.x.x.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
// main.js
|
||||
var client = new ZeroClipboard( document.getElementById("copy-button"), {
|
||||
moviePath: "/path/to/ZeroClipboard.swf"
|
||||
} );
|
||||
|
||||
client.on( "load", function(client) {
|
||||
// alert( "movie is loaded" );
|
||||
|
||||
client.on( "complete", function(client, args) {
|
||||
// `this` is the element that was clicked
|
||||
this.style.display = "none";
|
||||
alert("Copied text to clipboard: " + args.text );
|
||||
} );
|
||||
} );
|
||||
|
||||
ZeroClipboard.config( { moviePath: 'http://YOURSERVER/path/ZeroClipboard.swf' } );
|
||||
|
||||
var client = new ZeroClipboard();
|
||||
|
||||
var client = new ZeroClipboard($(".copy-button"));
|
||||
|
||||
var _globalConfig = {
|
||||
// NOTE: For versions >= v1.3.x and < v2.x, you must use `swfPath` by setting `moviePath`:
|
||||
// `ZeroClipboard.config({ moviePath: ZeroClipboard.config("swfPath") });`
|
||||
// URL to movie, relative to the page. Default value will be "ZeroClipboard.swf" under the
|
||||
// same path as the ZeroClipboard JS file.
|
||||
swfPath: "path/to/ZeroClipboard.swf",
|
||||
|
||||
// SWF inbound scripting policy: page domains that the SWF should trust. (single string or array of strings)
|
||||
trustedDomains: [window.location.host],
|
||||
|
||||
// Include a "nocache" query parameter on requests for the SWF
|
||||
cacheBust: true,
|
||||
|
||||
// Forcibly set the hand cursor ("pointer") for all clipped elements
|
||||
forceHandCursor: false,
|
||||
|
||||
// The z-index used by the Flash object. Max value (32-bit): 2147483647
|
||||
zIndex: 999999999,
|
||||
|
||||
// Debug enabled: send `console` messages with deprecation warnings, etc.
|
||||
debug: true,
|
||||
|
||||
// Sets the title of the `div` encapsulating the Flash object
|
||||
title: 'div',
|
||||
|
||||
// Setting this to `false` would allow users to handle calling `ZeroClipboard.activate(...);`
|
||||
// themselves instead of relying on our per-element `mouseover` handler
|
||||
autoActivate: true,
|
||||
|
||||
|
||||
/** @deprecated */
|
||||
// The class used to indicate that a clipped element is being hovered over
|
||||
hoverClass: "zeroclipboard-is-hover",
|
||||
|
||||
/** @deprecated */
|
||||
// The class used to indicate that a clipped element is active (is being clicked)
|
||||
activeClass: "zeroclipboard-is-active",
|
||||
|
||||
/** @deprecated */
|
||||
// DEPRECATED!!! Use `trustedDomains` instead!
|
||||
// SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings)
|
||||
trustedOrigins: ['origin'],
|
||||
|
||||
/** @deprecated */
|
||||
// SWF outbound scripting policy. Possible values: "never", "sameDomain", "always"
|
||||
allowScriptAccess: 'always',
|
||||
|
||||
/** @deprecated */
|
||||
// Include a "nocache" query parameter on requests for the SWF
|
||||
useNoCache: true,
|
||||
|
||||
/** @deprecated */
|
||||
// URL to movie
|
||||
moviePath: "ZeroClipboard.swf"
|
||||
};
|
||||
|
||||
ZeroClipboard.config(_globalConfig);
|
||||
|
||||
ZeroClipboard.config({ moviePath: "new/path" });
|
||||
|
||||
var client = new ZeroClipboard($("#d_clip_button"), { moviePath: "new/path" });
|
||||
client.on( 'dataRequested', function (client, args) {
|
||||
client.setText( "Copy me!" );
|
||||
});
|
||||
|
||||
client.setText( "Copy me!" );
|
||||
|
||||
client.clip( document.getElementById('d_clip_button') );
|
||||
|
||||
var client = new ZeroClipboard( $("button#my-button") );
|
||||
|
||||
function my_load_handler() {
|
||||
|
||||
}
|
||||
|
||||
client.on( 'load', my_load_handler );
|
||||
|
||||
client.off( 'load', my_load_handler );
|
||||
|
||||
client.on( 'load', function ( client, args ) {
|
||||
alert( "movie has loaded" );
|
||||
});
|
||||
|
||||
client.on( 'mouseover', function ( client, args ) {
|
||||
alert( "mouse is over movie" );
|
||||
});
|
||||
|
||||
client.on( 'mouseout', function ( client, args ) {
|
||||
alert( "mouse has left movie" );
|
||||
} );
|
||||
|
||||
client.on( 'mousedown', function ( client, args ) {
|
||||
alert( "mouse button is down" );
|
||||
} );
|
||||
|
||||
client.on( 'mouseup', function ( client, args ) {
|
||||
alert( "mouse button is up" );
|
||||
} );
|
||||
|
||||
client.on( 'complete', function ( client, args ) {
|
||||
alert("Copied text to clipboard: " + args.text );
|
||||
} );
|
||||
|
||||
client.on( 'noflash', function ( client, args ) {
|
||||
alert("You don't support flash");
|
||||
} );
|
||||
|
||||
client.on( 'wrongflash', function ( client, args ) {
|
||||
alert("Your flash is too old " + args.flashVersion);
|
||||
} );
|
||||
|
||||
client.on( 'dataRequested', function ( client, args ) {
|
||||
client.setText( 'Copied to clipboard.' );
|
||||
} );
|
||||
|
||||
var client = new ZeroClipboard( $('.clip_button') );
|
||||
|
||||
client.on( 'load', function(client) {
|
||||
// alert( "movie is loaded" );
|
||||
|
||||
client.on( 'datarequested', function(client) {
|
||||
client.setText(this.innerHTML);
|
||||
} );
|
||||
|
||||
client.on( 'complete', function(client, args) {
|
||||
alert("Copied text to clipboard: " + args.text );
|
||||
} );
|
||||
} );
|
||||
|
||||
client.on( 'wrongflash noflash', function() {
|
||||
ZeroClipboard.destroy();
|
||||
});
|
||||
|
||||
ZeroClipboard.config({ debug: false });
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
// Type definitions for ZeroClipboard v1.x.x
|
||||
// Project: https://github.com/jonrohan/ZeroClipboard
|
||||
// Definitions by: Eric J. Smith <https://github.com/ejsmith>, Blake Niemyjski <https://github.com/niemyjski>, György Balássy <https://github.com/balassy>, Leon Yu <https://github.com/leonyu>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare class ZeroClipboard {
|
||||
constructor(elements?: Element | { [index: number]: Element }, options?: ZeroClipboardOptions);
|
||||
|
||||
activate(element: Element): void;
|
||||
setText(newText: string): void;
|
||||
title(newTitle: string): void;
|
||||
setSize(width: number, height: number): void;
|
||||
version: string;
|
||||
moviePath: string;
|
||||
trustedDomains: any;
|
||||
text: string;
|
||||
hoverClass: string;
|
||||
activeClass: string;
|
||||
deactivate(): void;
|
||||
ready: boolean;
|
||||
reposition(): void; // returns false in some scenarios, but never returns true
|
||||
on(eventName: string, func: (client: ZeroClipboard, args: any) => void): void;
|
||||
off(eventName: string, func: (client: ZeroClipboard, args: any) => void): void;
|
||||
clip(elements: Element | { [index: number]: Element }): void;
|
||||
unclip(elements: Element | { [index: number]: Element }): void;
|
||||
|
||||
|
||||
static config(options: ZeroClipboardOptions): void;
|
||||
static destroy(): void;
|
||||
static emit(eventName: string, args: any): void;
|
||||
}
|
||||
|
||||
interface ZeroClipboardOptions {
|
||||
|
||||
/** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */
|
||||
autoActivate?: boolean;
|
||||
|
||||
/** Include a "nocache" query parameter on requests for the SWF. */
|
||||
cacheBust?: boolean;
|
||||
|
||||
/** Debug enabled: send console messages with deprecation warnings, etc. */
|
||||
debug?: boolean;
|
||||
|
||||
/** Forcibly set the hand cursor ("pointer") for all clipped elements. */
|
||||
forceHandCursor?: boolean;
|
||||
|
||||
/** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */
|
||||
moviePath?: string;
|
||||
|
||||
/** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */
|
||||
swfPath?: string;
|
||||
|
||||
/** Forcibly set the hand cursor ("pointer") for all clipped elements. */
|
||||
trustedDomains?: any;
|
||||
|
||||
/** Sets the title of the div encapsulating the Flash object. */
|
||||
title?: string;
|
||||
|
||||
/** The z-index used by the Flash object. */
|
||||
zIndex?: number;
|
||||
|
||||
/** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */
|
||||
activeClass?: string;
|
||||
|
||||
/** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */
|
||||
hoverClass?: string;
|
||||
|
||||
/** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */
|
||||
allowScriptAccess?: string;
|
||||
|
||||
/** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */
|
||||
trustedOrigins?: any;
|
||||
|
||||
/** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */
|
||||
useNoCache?: boolean;
|
||||
}
|
||||
|
||||
// Support AMD.
|
||||
declare module "zeroclipboard" { export = ZeroClipboard; }
|
||||
@@ -0,0 +1,542 @@
|
||||
/// <reference path="zeroclipboard.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
import ZeroClipboard = require("zeroclipboard");
|
||||
// import * as ZeroClipboard from "zeroclipboard";
|
||||
|
||||
namespace SimpleExample {
|
||||
ZeroClipboard.config( { swfPath: "http://YOURSERVER/path/ZeroClipboard.swf" } );
|
||||
|
||||
let client = new ZeroClipboard(document.getElementById("copy-button"));
|
||||
let client2 = new ZeroClipboard(jQuery('.copy-button'));
|
||||
|
||||
client.on( "ready", function( readyEvent ) {
|
||||
// alert( "ZeroClipboard SWF is ready!" );
|
||||
|
||||
client.on( "aftercopy", function( event ) {
|
||||
this === client;
|
||||
event.target === document.getElementById('el')
|
||||
event.target.style.display = "none";
|
||||
alert("Copied text to clipboard: " + event.data["text/plain"] );
|
||||
});
|
||||
});
|
||||
|
||||
client.on( "copy", function (event) {
|
||||
var clipboard = event.clipboardData;
|
||||
clipboard.setData( "text/plain", "Copy me!" );
|
||||
clipboard.setData( "text/html", "<b>Copy me!</b>" );
|
||||
clipboard.setData( "application/rtf", "{\\rtf1\\ansi\n{\\b Copy me!}}" );
|
||||
});
|
||||
|
||||
ZeroClipboard.setData( "text/plain", "Copy me!" );
|
||||
|
||||
client.setText( "Copy me!" );
|
||||
|
||||
client.clip( document.getElementById("d_clip_button") );
|
||||
|
||||
var $client = new ZeroClipboard( $("button#my-button") );
|
||||
|
||||
function example() {
|
||||
var client = new ZeroClipboard( $('.clip_button') );
|
||||
|
||||
client.on( 'ready', function(event) {
|
||||
// console.log( 'movie is loaded' );
|
||||
|
||||
client.on( 'copy', function(event) {
|
||||
event.clipboardData.setData('text/plain', event.target.innerHTML);
|
||||
} );
|
||||
|
||||
client.on( 'aftercopy', function(event) {
|
||||
console.log('Copied text to clipboard: ' + event.data['text/plain']);
|
||||
} );
|
||||
} );
|
||||
|
||||
client.on( 'error', function(event) {
|
||||
// console.log( 'ZeroClipboard error of type "' + event.name + '": ' + event.message );
|
||||
ZeroClipboard.destroy();
|
||||
} );
|
||||
}
|
||||
|
||||
ZeroClipboard.config({
|
||||
fixLineEndings: false
|
||||
});
|
||||
|
||||
ZeroClipboard.config({
|
||||
forceEnhancedClipboard: true
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
namespace Static {
|
||||
var version:String = ZeroClipboard.version;
|
||||
|
||||
var config = ZeroClipboard.config();
|
||||
|
||||
var swfPath:String = ZeroClipboard.config("swfPath");
|
||||
|
||||
ZeroClipboard.config({});
|
||||
|
||||
ZeroClipboard.destroy();
|
||||
|
||||
ZeroClipboard.setData("text/plain", "Blah");
|
||||
|
||||
ZeroClipboard.setData({
|
||||
"text/plain": "Blah",
|
||||
"text/html": "<b>Blah</b>"
|
||||
});
|
||||
|
||||
ZeroClipboard.clearData("text/plain");
|
||||
|
||||
var text:String = ZeroClipboard.getData("text/plain");
|
||||
|
||||
var dataObj = ZeroClipboard.getData();
|
||||
|
||||
ZeroClipboard.focus(document.getElementById("d_clip_button"));
|
||||
|
||||
ZeroClipboard.blur();
|
||||
|
||||
var el = document.getElementById("d_clip_button");
|
||||
ZeroClipboard.focus(el);
|
||||
var activeEl = ZeroClipboard.activeElement();
|
||||
activeEl === el;
|
||||
|
||||
ZeroClipboard.state();
|
||||
|
||||
let b:boolean = ZeroClipboard.isFlashUnusable();
|
||||
|
||||
var listenerFn = function(e: Object) { var ZeroClipboard = this; /* ... */ };
|
||||
ZeroClipboard.on("ready", listenerFn);
|
||||
|
||||
var listenerObj = {
|
||||
handleEvent: function(e: Object) { var listenerObj = this; /* ... */ }
|
||||
};
|
||||
ZeroClipboard.on("error", listenerObj);
|
||||
|
||||
ZeroClipboard.on("ready error", function(e) { /* ... */ });
|
||||
|
||||
ZeroClipboard.on({
|
||||
"ready": function(e) { /* ... */ },
|
||||
"error": function(e) { /* ... */ }
|
||||
});
|
||||
|
||||
ZeroClipboard.off("ready", listenerFn);
|
||||
ZeroClipboard.off("error", listenerObj);
|
||||
|
||||
ZeroClipboard.off("ready error", listenerFn);
|
||||
|
||||
ZeroClipboard.off({
|
||||
"ready": function(e) { /* ... */ },
|
||||
"error": function(e) { /* ... */ }
|
||||
});
|
||||
|
||||
ZeroClipboard.off("ready");
|
||||
|
||||
ZeroClipboard.off();
|
||||
|
||||
ZeroClipboard.emit("ready");
|
||||
ZeroClipboard.emit({
|
||||
type: "error",
|
||||
name: "flash-disabled"
|
||||
});
|
||||
|
||||
var pendingCopyData = ZeroClipboard.emit("copy");
|
||||
|
||||
var listener = ZeroClipboard.handlers("ready");
|
||||
|
||||
var listeners = ZeroClipboard.handlers();
|
||||
|
||||
var currentlyActivatedElementOrNull = document.getElementById('currentlyActivatedElementOrNull');
|
||||
var dataClipboardElementTargetOfCurrentlyActivatedElementOrNull = document.getElementById('dataClipboardElementTargetOfCurrentlyActivatedElementOrNull')
|
||||
var flashSwfObjectRef = document.getElementById('flashSwfObjectRef') as HTMLObjectElement;
|
||||
|
||||
ZeroClipboard.on("ready", function(e) {
|
||||
e = {
|
||||
type: "ready",
|
||||
message: "Flash communication is established",
|
||||
target: currentlyActivatedElementOrNull,
|
||||
relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
version: "11.2.202",
|
||||
timeStamp: Date.now()
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("beforecopy", function(e) {
|
||||
e = {
|
||||
type: "beforecopy",
|
||||
target: currentlyActivatedElementOrNull,
|
||||
relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now()
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("copy", function(e) {
|
||||
e.clipboardData.setData('text/html','<br>');
|
||||
e.clipboardData.setData({'text/html':'<br>'});
|
||||
e = {
|
||||
type: "copy",
|
||||
target: currentlyActivatedElementOrNull,
|
||||
relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
clipboardData: {
|
||||
setData: ZeroClipboard.setData,
|
||||
clearData: ZeroClipboard.clearData
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
ZeroClipboard.on("aftercopy", function(e) {
|
||||
e = {
|
||||
type: "aftercopy",
|
||||
target: currentlyActivatedElementOrNull,
|
||||
relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
success: {
|
||||
"text/plain": true,
|
||||
"text/html": true,
|
||||
"application/rtf": false
|
||||
},
|
||||
data: {
|
||||
"text/plain": "Blah",
|
||||
"text/html": "<b>Blah</b>",
|
||||
"application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}"
|
||||
},
|
||||
errors: [
|
||||
{
|
||||
name: "SecurityError",
|
||||
message: "Clipboard security error OMG",
|
||||
errorID: 7320,
|
||||
stack: null,
|
||||
format: "application/rtf",
|
||||
clipboard: "desktop"
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("destroy", function(e) {
|
||||
e = {
|
||||
type: "destroy",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
success: {
|
||||
"text/plain": true,
|
||||
"text/html": true,
|
||||
"application/rtf": false
|
||||
},
|
||||
data: {
|
||||
"text/plain": "Blah",
|
||||
"text/html": "<b>Blah</b>",
|
||||
"application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}"
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "flash-disabled",
|
||||
message: "Flash is disabled or not installed. May also be attempting to run Flash in a sandboxed iframe, which is impossible.",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
minimumVersion: "11.0.0"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "flash-sandboxed",
|
||||
message: "Attempting to run Flash in a sandboxed iframe, which is impossible",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
minimumVersion: "11.0.0",
|
||||
version: "11.2.202"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "flash-unavailable",
|
||||
message: "Flash is unable to communicate bidirectionally with JavaScript",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
minimumVersion: "11.0.0",
|
||||
version: "11.2.202"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "flash-degraded",
|
||||
message: "Flash is unable to preserve data fidelity when communicating with JavaScript",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
minimumVersion: "11.0.0",
|
||||
version: "11.2.202"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "flash-deactivated",
|
||||
message: "Flash is too outdated for your browser and/or is configured as click-to-activate. This may also mean that the ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity. May also be attempting to run Flash in a sandboxed iframe, which is impossible.",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
minimumVersion: "11.0.0",
|
||||
version: "11.2.202"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "flash-overdue",
|
||||
message: "Flash communication was established but NOT within the acceptable time limit",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
minimumVersion: "11.0.0",
|
||||
version: "11.2.202"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "version-mismatch",
|
||||
message: "ZeroClipboard JS version number does not match ZeroClipboard SWF version number",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
jsVersion: "2.2.1",
|
||||
swfVersion: "2.2.0"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "clipboard-error",
|
||||
message: "At least one error was thrown while ZeroClipboard was attempting to inject your data into the clipboard",
|
||||
target: currentlyActivatedElementOrNull,
|
||||
relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
data: {
|
||||
"text/plain": "Blah",
|
||||
"text/html": "<b>Blah</b>",
|
||||
"application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}"
|
||||
},
|
||||
errors: [
|
||||
{
|
||||
name: "SecurityError",
|
||||
message: "Clipboard security error OMG",
|
||||
errorID: 7320,
|
||||
stack: null,
|
||||
format: "application/rtf",
|
||||
clipboard: "desktop"
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "config-mismatch",
|
||||
message: "ZeroClipboard configuration does not match Flash's reality",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now(),
|
||||
property: "swfObjectId",
|
||||
configuredValue: "my-zeroclipboard-object",
|
||||
actualValue: "global-zeroclipboard-flash-bridge"
|
||||
};
|
||||
});
|
||||
|
||||
ZeroClipboard.on("error", function(e) {
|
||||
e = {
|
||||
type: "error",
|
||||
name: "swf-not-found",
|
||||
message: "The ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity",
|
||||
target: null,
|
||||
relatedTarget: null,
|
||||
currentTarget: flashSwfObjectRef,
|
||||
timeStamp: Date.now()
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
namespace Instance {
|
||||
var clippedEl = document.getElementById("d_clip_button");
|
||||
var client = new ZeroClipboard(clippedEl);
|
||||
|
||||
client.setText("Blah");
|
||||
|
||||
client.setHtml("<b>Blah</b>");
|
||||
|
||||
client.setRichText("{\\rtf1\\ansi\n{\\b Blah}}");
|
||||
|
||||
client.setData("text/plain", "Blah");
|
||||
client.setData({
|
||||
"text/plain": "Blah",
|
||||
"text/html": "<b>Blah</b>"
|
||||
});
|
||||
|
||||
client.clearData("text/plain");
|
||||
client.clearData();
|
||||
|
||||
var text:String = client.getData("text/plain");
|
||||
var dataObj = client.getData();
|
||||
|
||||
client.clip(document.getElementById("d_clip_button"))
|
||||
client.clip(document.querySelectorAll(".clip_button"));
|
||||
client.clip(jQuery(".clip_button"));
|
||||
|
||||
client.unclip(document.getElementById("d_clip_button"))
|
||||
client.unclip(document.querySelectorAll(".clip_button"));
|
||||
client.unclip(jQuery(".clip_button"));
|
||||
client.unclip();
|
||||
|
||||
var els:HTMLElement[] = client.elements();
|
||||
|
||||
var listenerFn = function(e: Object) { var client = this; /* ... */ };
|
||||
client.on("ready", listenerFn);
|
||||
|
||||
var listenerObj = {
|
||||
handleEvent: function(e: Object) { var listenerObj = this; /* ... */ }
|
||||
};
|
||||
client.on("error", listenerObj);
|
||||
|
||||
client.on("ready error", function(e) { /* ... */ });
|
||||
|
||||
client.on({
|
||||
"ready": function(e) { /* ... */ },
|
||||
"error": function(e) { /* ... */ }
|
||||
});
|
||||
|
||||
client.off("ready", listenerFn);
|
||||
client.off("error", listenerObj);
|
||||
|
||||
client.off("ready error", listenerFn);
|
||||
|
||||
client.off({
|
||||
"ready": function(e) { /* ... */ },
|
||||
"error": function(e) { /* ... */ }
|
||||
});
|
||||
|
||||
client.off("ready");
|
||||
|
||||
client.off();
|
||||
|
||||
client.emit("ready");
|
||||
client.emit({
|
||||
type: "error",
|
||||
name: "flash-disabled"
|
||||
});
|
||||
|
||||
var readyListeners = client.handlers("ready");
|
||||
|
||||
var listeners = client.handlers();
|
||||
|
||||
var client = new ZeroClipboard();
|
||||
client.on("ready", function(e) {
|
||||
if (e.client === client && client === this) {
|
||||
console.log("This client instance is ready!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
namespace GlobalConfig {
|
||||
var _globalConfig = {
|
||||
|
||||
// SWF URL, relative to the page. Default value will be "ZeroClipboard.swf"
|
||||
// under the same path as the ZeroClipboard JS file.
|
||||
swfPath: '_swfPath',
|
||||
|
||||
// SWF inbound scripting policy: page domains that the SWF should trust.
|
||||
// (single string, or array of strings)
|
||||
trustedDomains: window.location.host ? [window.location.host] : [],
|
||||
|
||||
// Include a "noCache" query parameter on requests for the SWF.
|
||||
cacheBust: true,
|
||||
|
||||
// Enable use of the fancy "Desktop" clipboard, even on Linux where it is
|
||||
// known to suck.
|
||||
forceEnhancedClipboard: false,
|
||||
|
||||
// How many milliseconds to wait for the Flash SWF to load and respond before assuming that
|
||||
// Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about
|
||||
// how long it takes to load the SWF, you can set this to `null`.
|
||||
flashLoadTimeout: 30000,
|
||||
|
||||
// Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);`
|
||||
// themselves instead of relying on our per-element `mouseover` handler.
|
||||
autoActivate: true,
|
||||
|
||||
// Bubble synthetic events in JavaScript after they are received by the Flash object.
|
||||
bubbleEvents: true,
|
||||
|
||||
// Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere
|
||||
fixLineEndings: true,
|
||||
|
||||
// Sets the ID of the `div` encapsulating the Flash object.
|
||||
// Value is validated against the [HTML4 spec for `ID` tokens][valid_ids].
|
||||
containerId: "global-zeroclipboard-html-bridge",
|
||||
|
||||
// Sets the class of the `div` encapsulating the Flash object.
|
||||
containerClass: "global-zeroclipboard-container",
|
||||
|
||||
// Sets the ID and name of the Flash `object` element.
|
||||
// Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids].
|
||||
swfObjectId: "global-zeroclipboard-flash-bridge",
|
||||
|
||||
// The class used to indicate that a clipped element is being hovered over.
|
||||
hoverClass: "zeroclipboard-is-hover",
|
||||
|
||||
// The class used to indicate that a clipped element is active (is being clicked).
|
||||
activeClass: "zeroclipboard-is-active",
|
||||
|
||||
|
||||
|
||||
// Forcibly set the hand cursor ("pointer") for all clipped elements.
|
||||
// IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded.
|
||||
forceHandCursor: false,
|
||||
|
||||
// Sets the title of the `div` encapsulating the Flash object.
|
||||
// IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded.
|
||||
title: 'title',
|
||||
|
||||
// The z-index used by the Flash object.
|
||||
// Max value (32-bit): 2147483647.
|
||||
// IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded.
|
||||
zIndex: 999999999
|
||||
|
||||
};
|
||||
|
||||
ZeroClipboard.config(_globalConfig);
|
||||
|
||||
}
|
||||
Vendored
+492
-62
@@ -1,75 +1,505 @@
|
||||
// Type definitions for ZeroClipboard
|
||||
// Project: https://github.com/jonrohan/ZeroClipboard
|
||||
// Definitions by: Eric J. Smith <https://github.com/ejsmith>, Blake Niemyjski <https://github.com/niemyjski>, György Balássy <https://github.com/balassy>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Type definitions for ZeroClipboard v2.x.x
|
||||
// Project: https://github.com/zeroclipboard/zeroclipboard
|
||||
// Definitions by: Eric J. Smith <https://github.com/ejsmith>, Blake Niemyjski <https://github.com/niemyjski>, György Balássy <https://github.com/balassy>, Leon Yu <https://github.com/leonyu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class ZeroClipboard {
|
||||
constructor(elements?: any, options?: ZeroClipboardOptions);
|
||||
activate(element: any): void;
|
||||
setText(newText: string): void;
|
||||
title(newTitle: string): void;
|
||||
setSize(width: number, height: number): void;
|
||||
declare namespace ZC {
|
||||
// Basic collection types for shorthands and interoperation
|
||||
interface List<T> { [index: number]: T; length: number; }
|
||||
interface Dictionary<T> { [key: string]: T; }
|
||||
|
||||
// Generic version EventHandler containers.
|
||||
// Mimicking native interfaces in lib.dom.d.ts of the same name.
|
||||
interface EventListener<T extends ZeroClipboardEvent> { (ev: T): void; }
|
||||
interface EventListenerObject<T extends ZeroClipboardEvent> { handleEvent(ev: T): void; }
|
||||
type EventListenerOrEventListenerObject<T extends ZeroClipboardEvent> = EventListener<T> | EventListenerObject<T>;
|
||||
|
||||
export interface ZeroClipboardStatic extends ZeroClipboardCommon {
|
||||
new(elements?: Element | List<Element>): ZeroClipboardClient;
|
||||
|
||||
/**
|
||||
* The version of the ZeroClipboard library being used, e.g. "2.0.0".
|
||||
* @type {string}
|
||||
*/
|
||||
version: string;
|
||||
moviePath: string;
|
||||
trustedDomains: any;
|
||||
text: string;
|
||||
hoverClass: string;
|
||||
activeClass: string;
|
||||
/**
|
||||
* Get a copy of the active configuration for ZeroClipboard.
|
||||
* @return {ZeroClipboardConfig}
|
||||
*/
|
||||
config(): ZeroClipboardConfig;
|
||||
/**
|
||||
* Get a copy of the actively configured value for this configuration property for ZeroClipboard.
|
||||
* @param {string} propName
|
||||
* @return {any}
|
||||
*/
|
||||
config(propName: string): any;
|
||||
config(propName: "swfPath"): string;
|
||||
config(propName: "trustedDomains"): string[];
|
||||
config(propName: "cacheBust"): boolean;
|
||||
config(propName: "forceEnhancedClipboard"): boolean;
|
||||
config(propName: "flashLoadTimeout"): number;
|
||||
config(propName: "autoActivate"): boolean;
|
||||
config(propName: "bubbleEvents"): boolean;
|
||||
config(propName: "fixLineEndings"): boolean;
|
||||
config(propName: "containerId"): string;
|
||||
config(propName: "containerClass"): string;
|
||||
config(propName: "swfObjectId"): string;
|
||||
config(propName: "hoverClass"): string;
|
||||
config(propName: "activeClass"): string;
|
||||
config(propName: "forceHandCursor"): boolean;
|
||||
config(propName: "title"): string;
|
||||
config(propName: "zIndex"): number;
|
||||
/**
|
||||
* Set the active configuration for ZeroClipboard. Returns a copy of the updated active configuration.
|
||||
* @param {ZeroClipboardConfig} config
|
||||
* @return {ZeroClipboardConfig}
|
||||
*/
|
||||
config(config: ZeroClipboardConfig): ZeroClipboardConfig;
|
||||
/**
|
||||
* Create the Flash bridge SWF object.
|
||||
* IMPORTANT: This method should be considered private.
|
||||
* @private
|
||||
*/
|
||||
create(): void;
|
||||
/**
|
||||
* Emit the "destroy" event, remove all event handlers, and destroy the Flash bridge.
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Focus/"activate" the provided element by moving the Flash SWF object in front of it.
|
||||
* @param {Element} element
|
||||
* @since 2.1.0
|
||||
*/
|
||||
focus(element: Element): void;
|
||||
/**
|
||||
* Focus/"activate" the provided element by moving the Flash SWF object in front of it.
|
||||
* @param {Element} element
|
||||
* @deprecated: The preferred method to use is focus but the alias activate is available for backward compatibility's sake.
|
||||
*/
|
||||
activate(element: Element): void;
|
||||
/**
|
||||
* Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen.
|
||||
* @since 2.1.0
|
||||
*/
|
||||
blur(): void;
|
||||
/**
|
||||
* Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen.
|
||||
* @deprecated: The preferred method to use is blur but the alias deactivate is available for backward compatibility's sake.
|
||||
*/
|
||||
deactivate(): void;
|
||||
ready: boolean;
|
||||
reposition(): void; // returns false in some scenarios, but never returns true
|
||||
on(eventName: string, func: Function): void;
|
||||
off(eventName: string, func: Function): void;
|
||||
clip(elements: any): void;
|
||||
unclip(elements: any): void;
|
||||
static config(options: ZeroClipboardOptions): void;
|
||||
static destroy(): void;
|
||||
static emit(eventName: string, args: any): void;
|
||||
}
|
||||
/**
|
||||
* Return the currently "activated" element that the Flash SWF object is in front of it.
|
||||
* @return {HTMLElement} or {null}
|
||||
*/
|
||||
activeElement(): HTMLElement;
|
||||
/**
|
||||
* Diagnostic method that describes the state of the browser, Flash Player, and ZeroClipboard.
|
||||
* @return {Object}
|
||||
*/
|
||||
state(): Object;
|
||||
/**
|
||||
* Indicates if Flash Player is definitely unusable (disabled, outdated, unavailable, or deactivated).
|
||||
* IMPORTANT: This method should be considered private.
|
||||
* @return {boolean}
|
||||
* @private
|
||||
*/
|
||||
isFlashUnusable(): boolean;
|
||||
}
|
||||
|
||||
interface ZeroClipboardOptions {
|
||||
/** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */
|
||||
autoActivate?: boolean;
|
||||
interface ZeroClipboardClient extends ZeroClipboardCommon {
|
||||
/**
|
||||
* A unique identifier for this ZeroClipboard client instance.
|
||||
* @type {string}
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Remove all event handlers and unclip all clipped elements.
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Set the pending data of type "text/plain" for clipboard injection.
|
||||
* @param {string} data
|
||||
*/
|
||||
setText(data: string): void;
|
||||
/**
|
||||
* Set the pending data of type "text/html" for clipboard injection.
|
||||
* @param {string} data
|
||||
*/
|
||||
setHtml(data: string): void;
|
||||
/**
|
||||
* Set the pending data of type "application/rtf" for clipboard injection.
|
||||
* @param {string} data
|
||||
*/
|
||||
setRichText(data: string): void;
|
||||
/**
|
||||
* Register clipboard actions for new element(s) to the client. This includes automatically invoking
|
||||
* ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration
|
||||
* property is set to false.
|
||||
* @param {Element[]} elements
|
||||
* @return {ZeroClipboardClient}
|
||||
*/
|
||||
clip(elements: List<Element>): ZeroClipboardClient;
|
||||
/**
|
||||
* Register clipboard actions for new element(s) to the client. This includes automatically invoking
|
||||
* ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration
|
||||
* property is set to false.
|
||||
* @param {Element} element
|
||||
* @return {ZeroClipboardClient}
|
||||
*/
|
||||
clip(element: Element): ZeroClipboardClient;
|
||||
/**
|
||||
* Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided,
|
||||
* ALL clipped/registered elements will be unregistered.
|
||||
* @param {Element[]} elements
|
||||
* @return {ZeroClipboardClient}
|
||||
*/
|
||||
unclip(elements: List<Element>): ZeroClipboardClient;
|
||||
/**
|
||||
* Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided,
|
||||
* ALL clipped/registered elements will be unregistered.
|
||||
* @param {Element} element
|
||||
* @return {ZeroClipboardClient}
|
||||
*/
|
||||
unclip(elements?: Element): ZeroClipboardClient;
|
||||
/**
|
||||
* Get all of the elements to which this client is clipped/registered.
|
||||
* @return {HTMLElement[]}
|
||||
*/
|
||||
elements(): HTMLElement[];
|
||||
}
|
||||
|
||||
/** Include a "nocache" query parameter on requests for the SWF. */
|
||||
cacheBust?: boolean;
|
||||
interface ZeroClipboardEvent {
|
||||
client?: ZeroClipboardClient;
|
||||
type: string;
|
||||
target: HTMLElement;
|
||||
relatedTarget: HTMLElement;
|
||||
currentTarget: HTMLObjectElement;
|
||||
timeStamp: number;
|
||||
}
|
||||
|
||||
/** Debug enabled: send console messages with deprecation warnings, etc. */
|
||||
debug?: boolean;
|
||||
interface ZeroClipboardReadyEvent extends ZeroClipboardEvent {
|
||||
message: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
/** Forcibly set the hand cursor ("pointer") for all clipped elements. */
|
||||
forceHandCursor?: boolean;
|
||||
interface ZeroClipboardBeforeCopyEvent extends ZeroClipboardEvent {
|
||||
|
||||
/** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */
|
||||
moviePath?: string;
|
||||
}
|
||||
|
||||
/** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */
|
||||
interface ZeroClipboardCopyEvent extends ZeroClipboardEvent {
|
||||
clipboardData: {
|
||||
setData(format: string, data: string): void;
|
||||
setData(data: Dictionary<string>): void;
|
||||
clearData(mimeType?: string): void;
|
||||
};
|
||||
}
|
||||
|
||||
interface ZeroClipboardAfterCopyEvent extends ZeroClipboardEvent {
|
||||
success: Dictionary<boolean>;
|
||||
data: Dictionary<string>;
|
||||
errors: any[];
|
||||
}
|
||||
|
||||
interface ZeroClipboardDestroyEvent extends ZeroClipboardEvent {
|
||||
success: Dictionary<boolean>;
|
||||
data: Dictionary<string>;
|
||||
}
|
||||
|
||||
interface ZeroClipboardErrorEvent extends ZeroClipboardEvent {
|
||||
name: string;
|
||||
message: string;
|
||||
minimumVersion?: string;
|
||||
version?: string;
|
||||
jsVersion?: string;
|
||||
swfVersion?: string;
|
||||
property?: string;
|
||||
configuredValue?: string;
|
||||
actualValue?: string;
|
||||
data?: Dictionary<string>;
|
||||
errors?: any[];
|
||||
}
|
||||
|
||||
interface ZeroClipboardCommon {
|
||||
/**
|
||||
* Set the pending data of type format for clipboard injection.
|
||||
* @param {string} format
|
||||
* @param {string} data
|
||||
*/
|
||||
setData(format: string, data: string): void;
|
||||
/**
|
||||
* Set the pending data of various formats for clipboard injection. This particular function signature (passing in
|
||||
* an Object) will implicitly clear out any existing pending data.
|
||||
* @param {Dictionary<string>} data
|
||||
*/
|
||||
setData(data: Dictionary<string>): void;
|
||||
/**
|
||||
* Clear the pending data of type format for clipboard injection.
|
||||
* @param {string} mimeType
|
||||
*/
|
||||
clearData(mimeType: string): void;
|
||||
/**
|
||||
* Clear the pending data of ALL formats for clipboard injection.
|
||||
*/
|
||||
clearData(): void;
|
||||
/**
|
||||
* Get the pending data of type format for clipboard injection.
|
||||
* @param {string} format
|
||||
* @return {string}
|
||||
* @since 2.1.0
|
||||
*/
|
||||
getData(format: string): string;
|
||||
/**
|
||||
* Get a copy of the pending data of ALL formats for clipboard injection.
|
||||
* @return {Dictionary<string>}
|
||||
* @since 2.1.0
|
||||
*/
|
||||
getData(): Dictionary<string>;
|
||||
/**
|
||||
* Add a listener function/object for an eventType. If called as a client method will be within the client instance.
|
||||
* @param {string} eventType
|
||||
* @param {EventListener<ZeroClipboardEvent>} listener
|
||||
*/
|
||||
on(eventType: string, listener: EventListenerOrEventListenerObject<ZeroClipboardEvent>): void;
|
||||
/**
|
||||
* The ready event is fired when the Flash SWF completes loading and is ready for action. Please note that you need
|
||||
* to set most configuration options [with ZeroClipboard.config(...)] before ZeroClipboard.create() is invoked.
|
||||
* @param {"ready"} eventType
|
||||
* @param {EventListener<ZeroClipboardReadyEvent>} listener
|
||||
*/
|
||||
on(eventType: "ready", listener: EventListenerOrEventListenerObject<ZeroClipboardReadyEvent>): void;
|
||||
/**
|
||||
* On click, the Flash object will fire off a beforecopy event. This event is generally only used for "UI
|
||||
* preparation" if you want to alter anything before the copy event fires.
|
||||
* IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before
|
||||
* the "copy" event is triggered.
|
||||
* @param {"beforecopy"} eventType
|
||||
* @param {EventListener<ZeroClipboardBeforeCopyEvent>} listener
|
||||
*/
|
||||
on(eventType: "beforecopy", listener: EventListenerOrEventListenerObject<ZeroClipboardBeforeCopyEvent>): void;
|
||||
/**
|
||||
* On click (and after the beforecopy event), the Flash object will fire off a copy event. If the HTML object has
|
||||
* data-clipboard-text or data-clipboard-target, then ZeroClipboard will take care of getting an initial set of
|
||||
* data. It will then invoke any copy event handlers, in which you can call event.clipboardData.setData to set the
|
||||
* text, which will complete the loop.
|
||||
* IMPORTANT: If a handler of this event intends to modify the pending data for clipboard injection, it MUST
|
||||
* operate synchronously in order to maintain the temporarily elevated permissions granted by the user's click
|
||||
* event. The most common "gotcha" for this restriction is if someone wants to make an asynchronous XMLHttpRequest
|
||||
* in response to the copy event to get the data to inject - this won't work; make it a synchronous XMLHttpRequest
|
||||
* instead, or do the work in advance before the copy event is fired.
|
||||
* @param {"copy"} eventType
|
||||
* @param {EventListener<ZeroClipboardCopyEvent>} listener
|
||||
*/
|
||||
on(eventType: "copy", listener: EventListenerOrEventListenerObject<ZeroClipboardCopyEvent>): void;
|
||||
/**
|
||||
* The aftercopy event is fired when the text is copied [or failed to copy] to the clipboard.
|
||||
* @param {"aftercopy"} eventType
|
||||
* @param {EventListener<ZeroClipboardAfterCopyEvent>} listener
|
||||
*/
|
||||
on(eventType: "aftercopy", listener: EventListenerOrEventListenerObject<ZeroClipboardAfterCopyEvent>): void;
|
||||
/**
|
||||
* The destroy event is fired when ZeroClipboard.destroy() is invoked.
|
||||
* IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before the
|
||||
* destruction is complete.
|
||||
* @param {"destroy"} eventType
|
||||
* @param {EventListener<ZeroClipboardDestroyEvent>} listener
|
||||
*/
|
||||
on(eventType: "destroy", listener: EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>): void;
|
||||
/**
|
||||
* The error event is fired under a number of conditions, which will be detailed as sub-sections. Some consumers
|
||||
* may not consider all error types to be critical, and thus ZeroClipboard does not take it upon itself to implode
|
||||
* by calling ZeroClipboard.destroy() under error conditions. However, many consumers may want to do just that.
|
||||
* @param {"error"} eventType
|
||||
* @param {EventListener<ZeroClipboardErrorEvent>} listener
|
||||
*/
|
||||
on(eventType: "error", listener: EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>): void;
|
||||
/**
|
||||
* Add a set of eventType to listener function/object mappings.
|
||||
* @param {EventListener<ZeroClipboardErrorEvent>} listenerObj
|
||||
*/
|
||||
on(listenerObj: {
|
||||
ready?: EventListenerOrEventListenerObject<ZeroClipboardReadyEvent>;
|
||||
beforecopy?: EventListenerOrEventListenerObject<ZeroClipboardBeforeCopyEvent>;
|
||||
copy?: EventListenerOrEventListenerObject<ZeroClipboardCopyEvent>;
|
||||
aftercopy?: EventListenerOrEventListenerObject<ZeroClipboardAfterCopyEvent>;
|
||||
destroy?: EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>;
|
||||
error?: EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>;
|
||||
}): void;
|
||||
/**
|
||||
* Remove a listener function/object for an eventType.
|
||||
* @param {string} eventType
|
||||
* @param {EventListener<ZeroClipboardEvent>} listener
|
||||
*/
|
||||
off(eventType: string, listener: EventListenerOrEventListenerObject<ZeroClipboardEvent>): void;
|
||||
off(eventType: "ready", listener: EventListenerOrEventListenerObject<ZeroClipboardReadyEvent>): void;
|
||||
off(eventType: "beforecopy", listener: EventListenerOrEventListenerObject<ZeroClipboardBeforeCopyEvent>): void;
|
||||
off(eventType: "copy", listener: EventListenerOrEventListenerObject<ZeroClipboardCopyEvent>): void;
|
||||
off(eventType: "aftercopy", listener: EventListenerOrEventListenerObject<ZeroClipboardAfterCopyEvent>): void;
|
||||
off(eventType: "destroy", listener: EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>): void;
|
||||
off(eventType: "error", listener: EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>): void;
|
||||
/**
|
||||
* Remove a set of eventType to listener function/object mappings.
|
||||
* @param {EventListener<ZeroClipboardErrorEvent>} listenerObj
|
||||
*/
|
||||
off(listenerObj: {
|
||||
ready?: EventListenerOrEventListenerObject<ZeroClipboardReadyEvent>;
|
||||
beforecopy?: EventListenerOrEventListenerObject<ZeroClipboardBeforeCopyEvent>;
|
||||
copy?: EventListenerOrEventListenerObject<ZeroClipboardCopyEvent>;
|
||||
aftercopy?: EventListenerOrEventListenerObject<ZeroClipboardAfterCopyEvent>;
|
||||
destroy?: EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>;
|
||||
error?: EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>;
|
||||
}): void;
|
||||
/**
|
||||
* Remove ALL listener functions/objects for ALL registered event types.
|
||||
*/
|
||||
off(): void;
|
||||
/**
|
||||
* Dispatch an event to all registered listeners. The emission of some types of events will result in side effects.
|
||||
* @param {string} eventType
|
||||
* @return {any}
|
||||
*/
|
||||
emit(eventType: string): any;
|
||||
emit(eventType: "ready"): void;
|
||||
emit(eventType: "beforecopy"): void;
|
||||
emit(eventType: "copy"): any;
|
||||
emit(eventType: "aftercopy"): void;
|
||||
emit(eventType: "destroy"): void;
|
||||
emit(eventType: "error"): void;
|
||||
/**
|
||||
* Dispatch an event to all registered listeners. The emission of some types of events will result in side effects.
|
||||
* @param {string} data
|
||||
* @param {string} name
|
||||
* @return {any}
|
||||
*/
|
||||
emit(data: {type: string, name: string}): any;
|
||||
/**
|
||||
* Retrieves a copy of the registered listener functions/objects for the given eventType.
|
||||
* @param {string} eventType
|
||||
* @return {EventListener<ZeroClipboardEvent>}
|
||||
*/
|
||||
handlers(eventType: string): EventListenerOrEventListenerObject<ZeroClipboardEvent>[];
|
||||
handlers(eventType: "ready"): EventListenerOrEventListenerObject<ZeroClipboardReadyEvent>[];
|
||||
handlers(eventType: "beforecopy"): EventListenerOrEventListenerObject<ZeroClipboardBeforeCopyEvent>[];
|
||||
handlers(eventType: "copy"): EventListenerOrEventListenerObject<ZeroClipboardCopyEvent>[];
|
||||
handlers(eventType: "aftercopy"): EventListenerOrEventListenerObject<ZeroClipboardAfterCopyEvent>[];
|
||||
handlers(eventType: "destroy"): EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>[];
|
||||
handlers(eventType: "error"): EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>[];
|
||||
/**
|
||||
* Retrieves a copy of the map of registered listener functions/objects for ALL event types.
|
||||
* @return {Object}
|
||||
*/
|
||||
handlers(): {
|
||||
ready?: EventListenerOrEventListenerObject<ZeroClipboardReadyEvent>[];
|
||||
beforecopy?: EventListenerOrEventListenerObject<ZeroClipboardBeforeCopyEvent>[];
|
||||
copy?: EventListenerOrEventListenerObject<ZeroClipboardCopyEvent>[];
|
||||
aftercopy?: EventListenerOrEventListenerObject<ZeroClipboardAfterCopyEvent>[];
|
||||
destroy?: EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>[];
|
||||
error?: EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>[];
|
||||
};
|
||||
}
|
||||
|
||||
interface ZeroClipboardConfig {
|
||||
/**
|
||||
* SWF URL, relative to the page. Default value will be "ZeroClipboard.swf" under the same path as the ZeroClipboard JS file.
|
||||
* @type {string}
|
||||
*/
|
||||
swfPath?: string;
|
||||
|
||||
/** Forcibly set the hand cursor ("pointer") for all clipped elements. */
|
||||
trustedDomains?: any;
|
||||
|
||||
/** Sets the title of the div encapsulating the Flash object. */
|
||||
title?: string;
|
||||
|
||||
/** The z-index used by the Flash object. */
|
||||
zIndex?: number;
|
||||
|
||||
/** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */
|
||||
activeClass?: string;
|
||||
|
||||
/** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */
|
||||
/**
|
||||
* SWF inbound scripting policy: page domains that the SWF should trust. (single string, or array of strings)
|
||||
* @type {SingleOrList<string>}
|
||||
*/
|
||||
trustedDomains?: string[];
|
||||
/**
|
||||
* Include a "noCache" query parameter on requests for the SWF.
|
||||
* @type {boolean}
|
||||
*/
|
||||
cacheBust?: boolean;
|
||||
/**
|
||||
* Enable use of the fancy "Desktop" clipboard, even on Linux where it is known to suck.
|
||||
* @type {boolean}
|
||||
*/
|
||||
forceEnhancedClipboard?: boolean;
|
||||
/**
|
||||
* How many milliseconds to wait for the Flash SWF to load and respond before assuming that
|
||||
* Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about
|
||||
* how long it takes to load the SWF, you can set this to `null`.
|
||||
* @type {number}
|
||||
*/
|
||||
flashLoadTimeout?: number;
|
||||
/**
|
||||
* Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);`
|
||||
* themselves instead of relying on our per-element `mouseover` handler.
|
||||
* @type {boolean}
|
||||
*/
|
||||
autoActivate?: boolean;
|
||||
/**
|
||||
* Bubble synthetic events in JavaScript after they are received by the Flash object.
|
||||
* @type {boolean}
|
||||
*/
|
||||
bubbleEvents?: boolean;
|
||||
/**
|
||||
* Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere
|
||||
* @type {boolean}
|
||||
*/
|
||||
fixLineEndings?: boolean;
|
||||
/**
|
||||
* Sets the ID of the `div` encapsulating the Flash object.
|
||||
* Value is validated against the [HTML4 spec for `ID` tokens][valid_ids].
|
||||
* @type {string}
|
||||
*/
|
||||
containerId?: string;
|
||||
/**
|
||||
* Sets the class of the `div` encapsulating the Flash object.
|
||||
* @type {string}
|
||||
*/
|
||||
containerClass?: string;
|
||||
/**
|
||||
* Sets the ID and name of the Flash `object` element.
|
||||
* Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids].
|
||||
* @type {string}
|
||||
*/
|
||||
swfObjectId?: string;
|
||||
/**
|
||||
* The class used to indicate that a clipped element is being hovered over.
|
||||
* @type {string}
|
||||
*/
|
||||
hoverClass?: string;
|
||||
|
||||
/** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */
|
||||
allowScriptAccess?: string;
|
||||
|
||||
/** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */
|
||||
trustedOrigins?: any;
|
||||
|
||||
/** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */
|
||||
useNoCache?: boolean;
|
||||
/**
|
||||
* The class used to indicate that a clipped element is active (is being clicked).
|
||||
* @type {string}
|
||||
*/
|
||||
activeClass?: string;
|
||||
/**
|
||||
* Forcibly set the hand cursor ("pointer") for all clipped elements.
|
||||
* IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded.
|
||||
* @type {boolean}
|
||||
*/
|
||||
forceHandCursor?: boolean;
|
||||
/**
|
||||
* Sets the title of the `div` encapsulating the Flash object.
|
||||
* IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded.
|
||||
* @type {string}
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The z-index used by the Flash object.
|
||||
* Max value (32-bit): 2147483647.
|
||||
* IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded.
|
||||
* @type {number}
|
||||
*/
|
||||
zIndex?: number;
|
||||
}
|
||||
}
|
||||
|
||||
// Support AMD.
|
||||
declare module "zeroclipboard" { export = ZeroClipboard; }
|
||||
/**
|
||||
* [ZeroClipboard description]
|
||||
* @type {ZC.ZeroClipboardStatic}
|
||||
*/
|
||||
declare var ZeroClipboard: ZC.ZeroClipboardStatic;
|
||||
|
||||
/**
|
||||
* AMD and CommonJS module `zeroclipboard`
|
||||
* @module
|
||||
*/
|
||||
declare module "zeroclipboard" {
|
||||
export = ZeroClipboard;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user