mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
Merge branch 'master' into chrome-updates
This commit is contained in:
+400
-176
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773938(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.5
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
@@ -296,11 +296,17 @@ const setColumnVisibility = (visible: boolean) => {
|
||||
|
||||
const combobox = sheet.OLEObjects('ComboBox1').Object as MSForms.ComboBox;
|
||||
combobox.Clear();
|
||||
const enumerator = new Enumerator(dict.Items());
|
||||
|
||||
// iterate over keys using Enumerator
|
||||
const enumerator = new Enumerator(dict);
|
||||
enumerator.moveFirst();
|
||||
while (!enumerator.atEnd()) {
|
||||
combobox.AddItem(enumerator.item());
|
||||
enumerator.moveNext();
|
||||
}
|
||||
|
||||
// alternatively, make a JS array out of the keys, and iterate using forEach
|
||||
// new VBArray(dict.Keys()).toArray().forEach(x => combobox.AddItem(x));
|
||||
})();
|
||||
})();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference types="windows-script-host" />
|
||||
/// <reference types="activex-scripting" />
|
||||
|
||||
const collectionToArray = <T>(col: { Item(index: any): T } | SafeArray<T>) => {
|
||||
const collectionToArray = <T>(col: { Item(index: any): T }): T[] => {
|
||||
const results: T[] = [];
|
||||
const enumerator = new Enumerator<T>(col);
|
||||
enumerator.moveFirst();
|
||||
@@ -423,7 +423,7 @@ the job?
|
||||
document.GroupBroadcastReceipts = true;
|
||||
|
||||
const jobIDs = document.Submit('');
|
||||
collectionToArray(jobIDs).forEach(jobID => WScript.Echo(`The job ID is ${jobID}`));
|
||||
new VBArray(jobIDs).toArray().forEach(jobID => WScript.Echo(`The job ID is ${jobID}`));
|
||||
|
||||
while (recipients.Count > 0) {
|
||||
recipients.Remove(1);
|
||||
|
||||
@@ -1,49 +1,20 @@
|
||||
// copied from the definitions in activex-scripting
|
||||
interface Dictionary<TKey = any, TItem = any> {
|
||||
/** Add a new key and item to the dictionary. */
|
||||
Add(Key: TKey, Item: TItem): void;
|
||||
/// <reference types="activex-scripting" />
|
||||
|
||||
/** Get the number of items in the dictionary. */
|
||||
readonly Count: number;
|
||||
|
||||
/** Determine if a given key is in the dictionary. */
|
||||
Exists(Key: TKey): boolean;
|
||||
HashVal(Key: TKey): any;
|
||||
|
||||
/** Set or get the item for a given key */
|
||||
Item(Key: TKey): TItem;
|
||||
|
||||
/** Get an array containing all items in the dictionary. */
|
||||
Items(): SafeArray<TItem>;
|
||||
|
||||
/** Change a key to a different key. */
|
||||
Key(Key: TKey): TKey;
|
||||
|
||||
/** Get an array containing all keys in the dictionary. */
|
||||
Keys(): SafeArray<TKey>;
|
||||
|
||||
/** Remove a given key from the dictionary. */
|
||||
Remove(Key: TKey): void;
|
||||
|
||||
/** Remove all information from the dictionary. */
|
||||
RemoveAll(): void;
|
||||
|
||||
/** Set or get the item for a given key */
|
||||
(Key: TKey): TItem;
|
||||
}
|
||||
|
||||
interface ActiveXObjectNameMap {
|
||||
'Scripting.Dictionary': Dictionary;
|
||||
}
|
||||
|
||||
const dict: Dictionary<string, number> = new ActiveXObject('Scripting.Dictionary');
|
||||
const dict: Scripting.Dictionary<string, number> = new ActiveXObject('Scripting.Dictionary');
|
||||
dict.Add('one', 1);
|
||||
dict.Add('two', 2);
|
||||
dict.Add('three', 3);
|
||||
|
||||
const keyEnumerator = new Enumerator(dict.Keys());
|
||||
const keyEnumerator = new Enumerator(dict);
|
||||
keyEnumerator.moveFirst();
|
||||
while (!keyEnumerator.atEnd()) {
|
||||
const item = dict(keyEnumerator.item());
|
||||
const power = Math.pow(item, 2);
|
||||
}
|
||||
|
||||
const keysArray = new VBArray(dict.Keys()).toArray();
|
||||
const itemsArray = new VBArray(dict.Items()).toArray();
|
||||
for (let i = 0; i < keysArray.length; i++) {
|
||||
const key = keysArray[i];
|
||||
const item = itemsArray[i];
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/ff521046(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
interface ActiveXObjectNameMap { }
|
||||
@@ -50,8 +50,8 @@ interface Enumerator<T = any> {
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <T = any>(collection: SafeArray<T> | { Item(index: any): T }): Enumerator<T>;
|
||||
new (collection: any): Enumerator;
|
||||
new <T = any>(collection: { Item(index: any): T }): Enumerator<T>;
|
||||
// new (collection: any): Enumerator;
|
||||
}
|
||||
|
||||
declare var Enumerator: EnumeratorConstructor;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://api.libreoffice.org/
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/aa741317(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
declare namespace MSHTML {
|
||||
const enum _BEHAVIOR_EVENT {
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/ms763742.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-interop" />
|
||||
|
||||
|
||||
Vendored
+5
-1
@@ -491,7 +491,7 @@ declare namespace Scripting {
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void;
|
||||
set<TKey = any, TValue = any>(obj: Scripting.Dictionary<TKey, TValue>, propertyName: 'Item', parameterTypes: [TKey], newValue: TValue): void;
|
||||
}
|
||||
|
||||
interface ActiveXObjectNameMap {
|
||||
@@ -499,3 +499,7 @@ interface ActiveXObjectNameMap {
|
||||
'Scripting.Encoder': Scripting.Encoder;
|
||||
'Scripting.FileSystemObject': Scripting.FileSystemObject;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <TKey>(dict: Scripting.Dictionary<TKey>): Enumerator<TKey>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import * as Ajv from "ajv";
|
||||
import AjvErrors = require("ajv-errors");
|
||||
|
||||
const ajv = new Ajv({allErrors: true, jsonPointers: true});
|
||||
AjvErrors(ajv);
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for ajv-errors 1.0
|
||||
// Project: https://github.com/epoberezkin/ajv-errors
|
||||
// Definitions by: Afshawn Lotfi <https://github.com/afshawnlotfi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Ajv } from "ajv";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ajv Ajv Main Class
|
||||
* https://github.com/epoberezkin/ajv
|
||||
* @param options Optional options for Ajv Errors
|
||||
* https://github.com/epoberezkin/ajv-errors#options
|
||||
*
|
||||
*/
|
||||
|
||||
export = AjvErrors;
|
||||
declare function AjvErrors(ajv: Ajv, options?: {}): Ajv;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ajv-errors-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,24 @@
|
||||
import Allure from "allure-js-commons";
|
||||
|
||||
const shouldMakeError = new Allure("test"); // $ExpectError
|
||||
const allure = new Allure();
|
||||
|
||||
allure.startSuite("suite");
|
||||
allure.startCase("case");
|
||||
allure.startCase("case", 123456789);
|
||||
|
||||
allure.endCase("passed");
|
||||
allure.endCase("pending");
|
||||
allure.endCase("skipped");
|
||||
allure.endCase("failed");
|
||||
allure.endCase("broken", 1232131232);
|
||||
allure.endCase("error"); // $ExpectError
|
||||
|
||||
allure.startStep("error");
|
||||
allure.endStep("error"); // $ExpectError
|
||||
|
||||
allure.setDescription("description");
|
||||
allure.addAttachment("image", {}, "image/jpeg");
|
||||
allure.pendingCase("pending");
|
||||
|
||||
allure.endSuite();
|
||||
Vendored
+111
@@ -0,0 +1,111 @@
|
||||
// Type definitions for allure-js-commons 0.0
|
||||
// Project: https://github.com/allure-framework/allure-js-commons
|
||||
// Definitions by: Denis Artyuhovich <https://github.com/zaqqaz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
declare class Allure {
|
||||
constructor();
|
||||
|
||||
setOptions(options: Allure.Options): void;
|
||||
|
||||
getCurrentSuite(): Allure.Suite;
|
||||
|
||||
getCurrentTest(): Allure.Test;
|
||||
|
||||
startSuite(suiteName: string, timestamp?: number): void;
|
||||
|
||||
endSuite(timestamp?: number): void;
|
||||
|
||||
startCase(testName: string, timestamp?: number): void;
|
||||
|
||||
endCase(status: Allure.Status, err?: {}, timestamp?: number): void;
|
||||
|
||||
startStep(stepName: string, timestamp?: number): void;
|
||||
|
||||
endStep(status: Allure.Status, timestamp?: number): void;
|
||||
|
||||
setDescription(description: string, timestamp?: number): void;
|
||||
|
||||
addAttachment(attachmentName: string, buffer: any, type: string): void;
|
||||
|
||||
pendingCase(testName: string, timestamp?: number): void;
|
||||
}
|
||||
|
||||
export = Allure;
|
||||
export as namespace Allure;
|
||||
declare namespace Allure {
|
||||
interface Options {
|
||||
targetDir: string;
|
||||
}
|
||||
|
||||
type Status = "passed" | "pending" | "skipped" | "failed" | "broken";
|
||||
|
||||
enum TYPE {
|
||||
TEXT = "text",
|
||||
HTML = "html",
|
||||
MARKDOWN = "markdown"
|
||||
}
|
||||
|
||||
class Suite {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
name: string;
|
||||
|
||||
end(timestamp?: number): void;
|
||||
|
||||
hasTests(): boolean;
|
||||
|
||||
addTest(test: Test): boolean;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Test {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
setDescription(description: string, type: TYPE): void;
|
||||
|
||||
addLabel(name: string, value: string): void;
|
||||
|
||||
addParameter(kind: any, name: string, value: string): void;
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Description {
|
||||
constructor(value: string, type: TYPE);
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Step {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Attachment {
|
||||
constructor(title: string, source: any, size: number, mime: string);
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"allure-js-commons-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,3 @@
|
||||
import * as ansi from "ansi-escapes";
|
||||
|
||||
console.log(ansi.cursorUp(2) + ansi.cursorLeft === "\u001B[2A\u001B[1000D");
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Type definitions for ansi-escapes 3.0
|
||||
// Project: https://github.com/sindresorhus/ansi-escapes
|
||||
// Definitions by: Rong Shen <https://github.com/jacobbubu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare namespace Ansi {
|
||||
interface ImageOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
preserveAspectRatio?: boolean;
|
||||
}
|
||||
|
||||
interface Term {
|
||||
setCwd(cwd: string): string;
|
||||
}
|
||||
|
||||
interface AnsiEscapes {
|
||||
cursorTo(x: number, y?: number): string;
|
||||
cursorMove(x: number, y?: number): string;
|
||||
cursorUp(count: number): string;
|
||||
cursorDown(count: number): string;
|
||||
cursorForward(count: number): string;
|
||||
cursorBackward(count: number): string;
|
||||
|
||||
cursorLeft: string;
|
||||
cursorSavePosition: string;
|
||||
cursorRestorePosition: string;
|
||||
cursorGetPosition: string;
|
||||
cursorNextLine: string;
|
||||
cursorPrevLine: string;
|
||||
cursorHide: string;
|
||||
cursorShow: string;
|
||||
|
||||
eraseLines(count: number): string;
|
||||
|
||||
eraseEndLine: string;
|
||||
eraseStartLine: string;
|
||||
eraseLine: string;
|
||||
eraseDown: string;
|
||||
eraseUp: string;
|
||||
eraseScreen: string;
|
||||
scrollUp: string;
|
||||
scrollDown: string;
|
||||
|
||||
clearScreen: string;
|
||||
beep: string;
|
||||
|
||||
link(text: string, url: string): string;
|
||||
image(buf: Buffer, opts?: ImageOptions): string;
|
||||
iTerm: Term;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiEscapes: Ansi.AnsiEscapes;
|
||||
export = ansiEscapes;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "ansi-escapes-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -20,6 +20,12 @@ simpleExample.addArgument(
|
||||
help: 'bar foo',
|
||||
}
|
||||
);
|
||||
simpleExample.addArgument(
|
||||
'positional',
|
||||
{
|
||||
help: 'bar foo',
|
||||
}
|
||||
);
|
||||
|
||||
simpleExample.printHelp();
|
||||
console.log('-----------');
|
||||
|
||||
Vendored
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/nodeca/argparse
|
||||
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
|
||||
// Tomasz Łaziuk <https://github.com/tlaziuk>
|
||||
// Sebastian Silbermann <https://github.com/eps1lon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -34,7 +35,7 @@ export class SubParser {
|
||||
}
|
||||
|
||||
export class ArgumentGroup {
|
||||
addArgument(args: string[], options?: ArgumentOptions): void;
|
||||
addArgument(args: string[] | string, options?: ArgumentOptions): void;
|
||||
addArgumentGroup(options?: ArgumentGroupOptions): ArgumentGroup;
|
||||
addMutuallyExclusiveGroup(options?: { required: boolean }): ArgumentGroup;
|
||||
setDefaults(options?: {}): void;
|
||||
|
||||
@@ -504,6 +504,7 @@ function callback(cb: AWSLambda.Callback) {
|
||||
cb();
|
||||
cb(null);
|
||||
cb(error);
|
||||
cb(str); // https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html
|
||||
cb(null, anyObj);
|
||||
cb(null, bool);
|
||||
cb(null, str);
|
||||
|
||||
Vendored
+4
-1
@@ -18,6 +18,7 @@
|
||||
// David Hayden <https://github.com/Haydabase>
|
||||
// Chris Redekop <https://github.com/repl-chris>
|
||||
// Aneil Mallavarapu <https://github.com/aneilbaboo>
|
||||
// Jeremy Nagel <https://github.com/jeznag>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -661,9 +662,11 @@ export type Handler<TEvent = any, TResult = any> = (
|
||||
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
|
||||
*
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* It can be a string for Lambda Proxy Integrations
|
||||
* https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
*/
|
||||
export type Callback<TResult = any> = (error?: Error | null, result?: TResult) => void;
|
||||
export type Callback<TResult = any> = (error?: Error | null | string, result?: TResult) => void;
|
||||
|
||||
// Begin defining Handler and Callback types for each API trigger type.
|
||||
// Ordered by https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import tokenProvider = require('axios-token-interceptor');
|
||||
|
||||
tokenProvider(); // $ExpectError
|
||||
|
||||
const validOptions = {
|
||||
getToken: () => Promise.resolve('qwerty'),
|
||||
};
|
||||
tokenProvider(validOptions); // $ExpectType TokenProvider
|
||||
|
||||
tokenCache(); // $ExpectError
|
||||
|
||||
const getToken = Promise.resolve('qwerty');
|
||||
const validCacheOptions = {
|
||||
maxAge: 3600,
|
||||
};
|
||||
const cache = tokenProvider.tokenCache(getToken, validCacheOptions); // $Expect TokenCache
|
||||
|
||||
cache.reset(); // $ExpectType void
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for axios-token-interceptor 0.1
|
||||
// Project: https://github.com/sandrinodimattia/axios-token-interceptor#readme
|
||||
// Definitions by: Mike Dodge <https://github.com/innovation-team>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { AxiosRequestConfig } from 'axios';
|
||||
|
||||
// Module
|
||||
declare function AxiosTokenProvider(Options: AxiosTokenProvider.InterceptorOptions): AxiosTokenProvider.TokenProvider;
|
||||
declare namespace AxiosTokenProvider {
|
||||
function tokenCache(getToken: Promise<string>, options: TokenCacheOptions): TokenCache;
|
||||
|
||||
// Interfaces
|
||||
interface InterceptorOptions {
|
||||
token?: string;
|
||||
getToken?: () => string | Promise<string>;
|
||||
header?: string;
|
||||
headerFormatter?: (token: string) => string;
|
||||
}
|
||||
|
||||
type TokenProvider = (config: AxiosRequestConfig) => Promise<AxiosRequestConfig>;
|
||||
|
||||
interface TokenCacheOptions {
|
||||
getMaxAge?: () => number;
|
||||
maxAge?: number;
|
||||
}
|
||||
|
||||
interface TokenCache {
|
||||
reset(): void;
|
||||
}
|
||||
}
|
||||
export = AxiosTokenProvider;
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"axios": "^0.16.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"axios-token-interceptor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,13 +1,15 @@
|
||||
import * as babel from "babel-core";
|
||||
|
||||
// Example from https://github.com/babel/babel/tree/master/packages/babel-core
|
||||
// Slightly modified example from https://github.com/babel/babel/tree/master/packages/babel-core
|
||||
const code = `class Example {}`;
|
||||
const result = babel.transform(code, { /* options */ });
|
||||
result.code; // Generated code
|
||||
result.map; // Sourcemap
|
||||
result.ast; // AST
|
||||
result.ignored;
|
||||
result.metadata;
|
||||
|
||||
// Examples from http://babeljs.io/docs/usage/api/
|
||||
// Slightly modified examples from http://babeljs.io/docs/usage/api/
|
||||
const options: babel.TransformOptions = {
|
||||
plugins: [
|
||||
"es2015-arrow-functions",
|
||||
@@ -24,6 +26,8 @@ babel.transformFile("filename.js", options, (err, result) => {
|
||||
result.code;
|
||||
result.map;
|
||||
result.ast;
|
||||
result.ignored;
|
||||
result.metadata;
|
||||
});
|
||||
|
||||
babel.transformFileSync("filename.js", options).code;
|
||||
|
||||
Vendored
+21
@@ -169,9 +169,30 @@ export interface TransformOptions {
|
||||
wrapPluginVisitorMethod?(pluginAlias: string, visitorType: 'enter' | 'exit', callback: (path: NodePath, state: any) => void): (path: NodePath, state: any) => void ;
|
||||
}
|
||||
|
||||
export interface BabelFileModulesMetadata {
|
||||
imports: object[];
|
||||
exports: {
|
||||
exported: object[],
|
||||
specifiers: object[]
|
||||
};
|
||||
}
|
||||
|
||||
export interface BabelFileMetadata {
|
||||
usedHelpers: string[];
|
||||
marked: Array<{
|
||||
type: string;
|
||||
message: string;
|
||||
loc: object;
|
||||
}>;
|
||||
modules: BabelFileModulesMetadata;
|
||||
}
|
||||
|
||||
export interface BabelFileResult {
|
||||
ast?: Node;
|
||||
code?: string;
|
||||
ignored?: boolean;
|
||||
map?: object;
|
||||
metadata?: BabelFileMetadata;
|
||||
}
|
||||
|
||||
export as namespace babel;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import Backoff = require("backo2");
|
||||
|
||||
const backoff = new Backoff();
|
||||
const backoff2 = new Backoff({});
|
||||
const backoff3 = new Backoff({
|
||||
min: 0,
|
||||
max: 0,
|
||||
jitter: 0,
|
||||
factor: 0
|
||||
});
|
||||
|
||||
const y: number = backoff3.duration();
|
||||
backoff3.reset();
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for backo2 1.0
|
||||
// Project: https://github.com/mokesmokes/backo
|
||||
// Definitions by: Retsam <https://github.com/Retsam>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
type BackoffOptions = Partial<{
|
||||
min: number,
|
||||
max: number,
|
||||
jitter: number,
|
||||
factor: number,
|
||||
}>;
|
||||
|
||||
declare class Backoff {
|
||||
constructor(opts?: BackoffOptions);
|
||||
|
||||
duration(): number;
|
||||
/**
|
||||
* Reset the number of attempts.
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* Set the minimum duration
|
||||
*/
|
||||
setMin(min: number): void;
|
||||
/**
|
||||
* Set the maximum duration
|
||||
*/
|
||||
setMax(max: number): void;
|
||||
/**
|
||||
* Set the jitter
|
||||
*/
|
||||
setJitter(jitter: number): void;
|
||||
}
|
||||
|
||||
export = Backoff;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"backo2-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,8 @@
|
||||
import * as pack from "bin-pack";
|
||||
|
||||
// $ExpectType PackResult<{ width: number; height: number; }>
|
||||
const packResult = pack([
|
||||
{ width: 50, height: 50 },
|
||||
{ width: 25, height: 25 },
|
||||
{ width: 25, height: 20 }
|
||||
]);
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for bin-pack 1.0
|
||||
// Project: https://github.com/bryanburgers/bin-pack
|
||||
// Definitions by: Oren Trutner <https://github.com/orentrutner>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Packs objects that have a width and a height into as small of a square as
|
||||
* possible, using a binary tree bin packing algorithm. After packing, each
|
||||
* object is given an (x, y) coordinate of where it would be optimally packed.
|
||||
* @param bins List of rectangular bins to pack
|
||||
* @param options Packing options. Use inPlace: true to modify the bins
|
||||
* argument in-place.
|
||||
*/
|
||||
declare function pack<T extends pack.Bin>(bins: T[], options?: pack.Options): pack.PackResult<T>;
|
||||
|
||||
declare namespace pack {
|
||||
/** Packing options. */
|
||||
interface Options {
|
||||
/** Use inPlace=true to add x,y fields to the bins argument. */
|
||||
inPlace?: boolean;
|
||||
}
|
||||
|
||||
/** Specifies the dimensions of a bin to pack. */
|
||||
interface Bin {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
/** Describes the location of a packed bin. */
|
||||
interface PackedItem<T> {
|
||||
/** X coordinate of the packed bin. */
|
||||
x: number;
|
||||
|
||||
/** Y coordinate of the packed bin. */
|
||||
y: number;
|
||||
|
||||
/** Width of the bin. */
|
||||
width: number;
|
||||
|
||||
/** Height of the bin. */
|
||||
height: number;
|
||||
|
||||
/** The original bin object. */
|
||||
item: T;
|
||||
}
|
||||
|
||||
/** The return value from the pack function. */
|
||||
interface PackResult<T> {
|
||||
/** Width of the bounding box around all bins. */
|
||||
width: number;
|
||||
|
||||
/** Height of the bounding box around all bins. */
|
||||
height: number;
|
||||
|
||||
/** List of packed bins. */
|
||||
items: Array<PackedItem<T>>;
|
||||
}
|
||||
}
|
||||
|
||||
export = pack;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bin-pack-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,4 @@
|
||||
import blockies = require('blockies');
|
||||
|
||||
const seed = 'seed';
|
||||
blockies({ seed });
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for blockies 0.0
|
||||
// Project: https://github.com/goldylucks/blockies-npm
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface BlockiesIcon {
|
||||
toDataURL(): string;
|
||||
}
|
||||
interface BlockiesConfig {
|
||||
seed: string;
|
||||
}
|
||||
declare function blockies(config: BlockiesConfig): BlockiesIcon;
|
||||
|
||||
export = blockies;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "blockies-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,6 @@
|
||||
import BN = require('bn.js');
|
||||
|
||||
let bn = new BN(42);
|
||||
bn = bn.add(bn);
|
||||
bn.isZero();
|
||||
bn.byteLength;
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for bn.js 4.11
|
||||
// Project: https://github.com/indutny/bn.js
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
type Endianness = 'le' | 'be';
|
||||
|
||||
declare class BN {
|
||||
constructor(num: number | string | number[] | Buffer, base?: number, endian?: Endianness);
|
||||
clone(): BN;
|
||||
toString(base?: number, length?: number): string;
|
||||
toNumber(): number;
|
||||
toJSON(): string;
|
||||
toArray(endian?: Endianness, length?: number): number[];
|
||||
toBuffer(endian?: Endianness, length?: number): Buffer;
|
||||
bitLength(): number;
|
||||
zeroBits(): number;
|
||||
byteLength(): number;
|
||||
isNeg(): boolean;
|
||||
isEven(): boolean;
|
||||
isOdd(): boolean;
|
||||
isZero(): boolean;
|
||||
cmp(b: any): number;
|
||||
lt(b: any): boolean;
|
||||
lte(b: any): boolean;
|
||||
gt(b: any): boolean;
|
||||
gte(b: any): boolean;
|
||||
eq(b: any): boolean;
|
||||
isBN(b: any): boolean;
|
||||
|
||||
neg(): BN;
|
||||
abs(): BN;
|
||||
add(b: BN): BN;
|
||||
sub(b: BN): BN;
|
||||
mul(b: BN): BN;
|
||||
sqr(): BN;
|
||||
pow(b: BN): BN;
|
||||
div(b: BN): BN;
|
||||
mod(b: BN): BN;
|
||||
divRound(b: BN): BN;
|
||||
|
||||
or(b: BN): BN;
|
||||
and(b: BN): BN;
|
||||
xor(b: BN): BN;
|
||||
setn(b: number): BN;
|
||||
shln(b: number): BN;
|
||||
shrn(b: number): BN;
|
||||
testn(b: number): boolean;
|
||||
maskn(b: number): BN;
|
||||
bincn(b: number): BN;
|
||||
notn(w: number): BN;
|
||||
|
||||
gcd(b: BN): BN;
|
||||
egcd(b: BN): { a: BN; b: BN; gcd: BN };
|
||||
invm(b: BN): BN;
|
||||
}
|
||||
|
||||
export = BN;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "bn.js-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+5
@@ -95,6 +95,11 @@ declare namespace Bull {
|
||||
*/
|
||||
data: any;
|
||||
|
||||
/**
|
||||
* How many attempts where made to run this job
|
||||
*/
|
||||
attemptsMade: number;
|
||||
|
||||
/**
|
||||
* Report progress on a job
|
||||
*/
|
||||
|
||||
Vendored
+5118
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
Cesium.buildModuleUrl.setBaseUrl('/assets/cesium/');
|
||||
|
||||
const viewer = new Cesium.Viewer('#cesium', {
|
||||
sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
|
||||
imageryProvider: new Cesium.IonImageryProvider({ assetId: 3845 }),
|
||||
baseLayerPicker: false,
|
||||
geocoder: false,
|
||||
});
|
||||
|
||||
const midnight = Cesium.JulianDate.fromDate(new Date(2018, 5, 14));
|
||||
const prop = new Cesium.SampledPositionProperty();
|
||||
|
||||
const pos = Cesium.Cartesian3.fromDegrees(1, 2, 3);
|
||||
const time = Cesium.JulianDate.addSeconds(midnight, 12345, new Cesium.JulianDate());
|
||||
prop.addSample(time, pos);
|
||||
viewer.entities.add(new Cesium.Entity({
|
||||
position: pos,
|
||||
point: new Cesium.PointGraphics({
|
||||
color: Cesium.Color.fromCssColorString('#123123'),
|
||||
pixelSize: 2
|
||||
})
|
||||
}));
|
||||
|
||||
const objStart = Cesium.JulianDate.addSeconds(midnight, 12340, new Cesium.JulianDate());
|
||||
const objStop = Cesium.JulianDate.addSeconds(midnight, 12350, new Cesium.JulianDate());
|
||||
|
||||
const entity = new Cesium.Entity({
|
||||
name: 'TEST',
|
||||
availability: new Cesium.TimeIntervalCollection([
|
||||
new Cesium.TimeInterval({
|
||||
start: objStart,
|
||||
stop: objStop
|
||||
})
|
||||
]),
|
||||
position: prop,
|
||||
orientation: new Cesium.VelocityOrientationProperty(prop),
|
||||
path: new Cesium.PathGraphics({
|
||||
resolution: 5,
|
||||
width: 3,
|
||||
material: new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString('#223344')),
|
||||
leadTime: 0
|
||||
}),
|
||||
model: new Cesium.ModelGraphics({
|
||||
uri: 'http://assets.agi.com/models/rv1.gltf',
|
||||
minimumPixelSize: 48
|
||||
})
|
||||
});
|
||||
viewer.entities.add(entity);
|
||||
@@ -0,0 +1,50 @@
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
Cesium.buildModuleUrl.setBaseUrl('/assets/cesium/');
|
||||
|
||||
const viewer = new Cesium.Viewer('#cesium', {
|
||||
sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
|
||||
imageryProvider: new Cesium.IonImageryProvider({ assetId: 3845 }),
|
||||
baseLayerPicker: false,
|
||||
geocoder: false,
|
||||
});
|
||||
|
||||
const midnight = Cesium.JulianDate.fromDate(new Date(2018, 5, 14));
|
||||
const prop = new Cesium.SampledPositionProperty();
|
||||
|
||||
const pos = Cesium.Cartesian3.fromDegrees(1, 2, 3);
|
||||
const time = Cesium.JulianDate.addSeconds(midnight, 12345, new Cesium.JulianDate());
|
||||
prop.addSample(time, pos);
|
||||
viewer.entities.add(new Cesium.Entity({
|
||||
position: pos,
|
||||
point: new Cesium.PointGraphics({
|
||||
color: Cesium.Color.fromCssColorString('#123123'),
|
||||
pixelSize: 2
|
||||
})
|
||||
}));
|
||||
|
||||
const objStart = Cesium.JulianDate.addSeconds(midnight, 12340, new Cesium.JulianDate());
|
||||
const objStop = Cesium.JulianDate.addSeconds(midnight, 12350, new Cesium.JulianDate());
|
||||
|
||||
const entity = new Cesium.Entity({
|
||||
name: 'TEST',
|
||||
availability: new Cesium.TimeIntervalCollection([
|
||||
new Cesium.TimeInterval({
|
||||
start: objStart,
|
||||
stop: objStop
|
||||
})
|
||||
]),
|
||||
position: prop,
|
||||
orientation: new Cesium.VelocityOrientationProperty(prop),
|
||||
path: new Cesium.PathGraphics({
|
||||
resolution: 5,
|
||||
width: 3,
|
||||
material: new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString('#223344')),
|
||||
leadTime: 0
|
||||
}),
|
||||
model: new Cesium.ModelGraphics({
|
||||
uri: 'http://assets.agi.com/models/rv1.gltf',
|
||||
minimumPixelSize: 48
|
||||
})
|
||||
});
|
||||
viewer.entities.add(entity);
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"test/cesium-global.test.ts",
|
||||
"test/cesium-module.test.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
Vendored
+20
-18
@@ -11,6 +11,7 @@
|
||||
// Sergey Rubanov <https://github.com/chicoxyzzy>
|
||||
// Simon Archer <https://github.com/archy-bold>
|
||||
// Ken Elkabany <https://github.com/braincore>
|
||||
// Slavik Nychkalo <https://github.com/gebeto>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -37,6 +38,7 @@ declare class Chart {
|
||||
canvas: HTMLCanvasElement|null;
|
||||
chartArea: Chart.ChartArea;
|
||||
static pluginService: PluginServiceStatic;
|
||||
static plugins: PluginServiceStatic;
|
||||
|
||||
static defaults: {
|
||||
global: Chart.ChartOptions & Chart.ChartFontOptions;
|
||||
@@ -56,40 +58,40 @@ declare class PluginServiceStatic {
|
||||
}
|
||||
|
||||
interface PluginServiceRegistrationOptions {
|
||||
beforeInit?(chartInstance: Chart): void;
|
||||
afterInit?(chartInstance: Chart): void;
|
||||
beforeInit?(chartInstance: Chart, options?: any): void;
|
||||
afterInit?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
resize?(chartInstance: Chart, newChartSize: Size): void;
|
||||
resize?(chartInstance: Chart, newChartSize: Size, options?: any): void;
|
||||
|
||||
beforeUpdate?(chartInstance: Chart): void;
|
||||
afterScaleUpdate?(chartInstance: Chart): void;
|
||||
beforeDatasetsUpdate?(chartInstance: Chart): void;
|
||||
afterDatasetsUpdate?(chartInstance: Chart): void;
|
||||
afterUpdate?(chartInstance: Chart): void;
|
||||
beforeUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterScaleUpdate?(chartInstance: Chart, options?: any): void;
|
||||
beforeDatasetsUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterDatasetsUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterUpdate?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
// This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw
|
||||
// to do something on each animation frame
|
||||
beforeRender?(chartInstance: Chart): void;
|
||||
beforeRender?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
// Easing is for animation
|
||||
beforeDraw?(chartInstance: Chart, easing: string): void;
|
||||
afterDraw?(chartInstance: Chart, easing: string): void;
|
||||
beforeDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
// Before the datasets are drawn but after scales are drawn
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: string): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: string): void;
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
|
||||
// Called before drawing the `tooltip`. If any plugin returns `false`,
|
||||
// the tooltip drawing is cancelled until another `render` is triggered.
|
||||
beforeTooltipDraw?(chartInstance: Chart): void;
|
||||
beforeTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void;
|
||||
// Called after drawing the `tooltip`. Note that this hook will not,
|
||||
// be called if the tooltip drawing has been previously cancelled.
|
||||
afterTooltipDraw?(chartInstance: Chart): void;
|
||||
afterTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void;
|
||||
|
||||
destroy?(chartInstance: Chart): void;
|
||||
|
||||
// Called when an event occurs on the chart
|
||||
beforeEvent?(chartInstance: Chart, event: Event): void;
|
||||
afterEvent?(chartInstance: Chart, event: Event): void;
|
||||
beforeEvent?(chartInstance: Chart, event: Event, options?: any): void;
|
||||
afterEvent?(chartInstance: Chart, event: Event, options?: any): void;
|
||||
}
|
||||
|
||||
interface Size {
|
||||
@@ -98,7 +100,7 @@ interface Size {
|
||||
}
|
||||
|
||||
declare namespace Chart {
|
||||
type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
|
||||
type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -519,7 +519,7 @@ declare namespace Chartist {
|
||||
|
||||
|
||||
interface ChartistSvgStatic {
|
||||
new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg;
|
||||
new (name?: HTMLElement | string, attributes?: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg;
|
||||
|
||||
Easing: ChartistEasingStatic;
|
||||
|
||||
|
||||
Vendored
+2
@@ -293,6 +293,8 @@ declare namespace chroma {
|
||||
|
||||
mode(mode: keyof ColorSpaces): this;
|
||||
|
||||
gamma(g: number): this;
|
||||
|
||||
cache(use: boolean): boolean;
|
||||
|
||||
correctLightness(enable?: boolean): this;
|
||||
|
||||
+193
-198
@@ -10,99 +10,102 @@
|
||||
declare namespace chrome.cast {
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.AutoJoinPolicy
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.AutoJoinPolicy
|
||||
*/
|
||||
export interface AutoJoinPolicy {
|
||||
TAB_AND_ORIGIN_SCOPED: string;
|
||||
ORIGIN_SCOPED: string;
|
||||
PAGE_SCOPED: string;
|
||||
export enum AutoJoinPolicy {
|
||||
CUSTOM_CONTROLLER_SCOPED = "custom_controller_scoped",
|
||||
TAB_AND_ORIGIN_SCOPED = "tab_and_origin_scoped",
|
||||
ORIGIN_SCOPED = "origin_scoped",
|
||||
PAGE_SCOPED = "page_scoped"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.DefaultActionPolicy
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.DefaultActionPolicy
|
||||
*/
|
||||
export interface DefaultActionPolicy {
|
||||
CREATE_SESSION: string;
|
||||
CAST_THIS_TAB: string;
|
||||
export enum DefaultActionPolicy {
|
||||
CREATE_SESSION = "create_session",
|
||||
CAST_THIS_TAB = "cast_this_tab"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Capability
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.Capability
|
||||
*/
|
||||
export interface Capability {
|
||||
VIDEO_OUT: string;
|
||||
AUDIO_OUT: string;
|
||||
VIDEO_IN: string;
|
||||
AUDIO_IN: string;
|
||||
export enum Capability {
|
||||
VIDEO_OUT = "video_out",
|
||||
AUDIO_OUT = "audio_out",
|
||||
VIDEO_IN = "video_in",
|
||||
AUDIO_IN = "audio_in",
|
||||
MULTIZONE_GROUP = "multizone_group"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ErrorCode
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ErrorCode
|
||||
*/
|
||||
export interface ErrorCode {
|
||||
CANCEL: string;
|
||||
TIMEOUT: string;
|
||||
API_NOT_INITIALIZED: string;
|
||||
INVALID_PARAMETER: string;
|
||||
EXTENSION_NOT_COMPATIBLE: string;
|
||||
EXTENSION_MISSING: string;
|
||||
RECEIVER_UNAVAILABLE: string;
|
||||
SESSION_ERROR: string;
|
||||
CHANNEL_ERROR: string;
|
||||
LOAD_MEDIA_FAILED: string;
|
||||
export enum ErrorCode {
|
||||
CANCEL = "cancel",
|
||||
TIMEOUT = "timeout",
|
||||
API_NOT_INITIALIZED = "api_not_initialized",
|
||||
INVALID_PARAMETER = "invalid_parameter",
|
||||
EXTENSION_NOT_COMPATIBLE = "extension_not_compatible",
|
||||
EXTENSION_MISSING = "extension_missing",
|
||||
RECEIVER_UNAVAILABLE = "receiver_unavailable",
|
||||
SESSION_ERROR = "session_error",
|
||||
CHANNEL_ERROR = "channel_error",
|
||||
LOAD_MEDIA_FAILED = "load_media_failed"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAvailability
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverAvailability
|
||||
*/
|
||||
export interface ReceiverAvailability {
|
||||
AVAILABLE: string;
|
||||
UNAVAILABLE: string;
|
||||
export enum ReceiverAvailability {
|
||||
AVAILABLE = "available",
|
||||
UNAVAILABLE = "unavailable"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderPlatform
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.SenderPlatform
|
||||
*/
|
||||
export interface SenderPlatform {
|
||||
CHROME: string;
|
||||
IOS: string;
|
||||
ANDROID: string;
|
||||
export enum SenderPlatform {
|
||||
CHROME = "chrome",
|
||||
IOS = "ios",
|
||||
ANDROID = "android"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverType
|
||||
*/
|
||||
export interface ReceiverType {
|
||||
CAST: string;
|
||||
HANGOUT: string;
|
||||
CUSTOM: string;
|
||||
export enum ReceiverType {
|
||||
CAST = "cast",
|
||||
DIAL = "dial",
|
||||
HANGOUT = "hangout",
|
||||
CUSTOM = "custom"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverAction
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.ReceiverAction
|
||||
*/
|
||||
export interface ReceiverAction {
|
||||
CAST: string;
|
||||
STOP: string;
|
||||
export enum ReceiverAction {
|
||||
CAST = "cast",
|
||||
STOP = "stop"
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionStatus
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.SessionStatus
|
||||
*/
|
||||
export interface SessionStatus {
|
||||
CONNECTED: string;
|
||||
DISCONNECTED: string;
|
||||
STOPPED: string;
|
||||
export enum SessionStatus {
|
||||
CONNECTED = "connected",
|
||||
DISCONNECTED = "disconnected",
|
||||
STOPPED = "stopped"
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +211,7 @@ declare namespace chrome.cast {
|
||||
receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void,
|
||||
autoJoinPolicy?: chrome.cast.AutoJoinPolicy,
|
||||
defaultActionPolicy?: chrome.cast.DefaultActionPolicy
|
||||
):ApiConfig;
|
||||
): ApiConfig;
|
||||
|
||||
sessionRequest: chrome.cast.SessionRequest;
|
||||
sessionListener: (session: chrome.cast.Session) => void;
|
||||
@@ -229,7 +232,7 @@ declare namespace chrome.cast {
|
||||
code: chrome.cast.ErrorCode,
|
||||
description?: string,
|
||||
details?: Object
|
||||
):Error;
|
||||
): Error;
|
||||
|
||||
code: chrome.cast.ErrorCode;
|
||||
description?: string;
|
||||
@@ -237,15 +240,13 @@ declare namespace chrome.cast {
|
||||
|
||||
}
|
||||
|
||||
export interface Image {
|
||||
export class Image {
|
||||
/**
|
||||
* @param {string} url
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Image
|
||||
*/
|
||||
new(
|
||||
url: string
|
||||
):Image;
|
||||
constructor(url: string);
|
||||
|
||||
url: string;
|
||||
height?: number;
|
||||
@@ -260,7 +261,7 @@ declare namespace chrome.cast {
|
||||
*/
|
||||
new(
|
||||
platform: chrome.cast.SenderPlatform
|
||||
):SenderApplication;
|
||||
): SenderApplication;
|
||||
|
||||
platform: chrome.cast.SenderPlatform;
|
||||
url?: string;
|
||||
@@ -279,7 +280,7 @@ declare namespace chrome.cast {
|
||||
appId: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
timeout?: number
|
||||
):SessionRequest;
|
||||
): SessionRequest;
|
||||
|
||||
appId: string;
|
||||
capabilities: Array<chrome.cast.Capability>;
|
||||
@@ -303,7 +304,7 @@ declare namespace chrome.cast {
|
||||
displayName: string,
|
||||
appImages: Array<chrome.cast.Image>,
|
||||
receiver: chrome.cast.Receiver
|
||||
):Session;
|
||||
): Session;
|
||||
|
||||
sessionId: string;
|
||||
appId: string;
|
||||
@@ -311,7 +312,7 @@ declare namespace chrome.cast {
|
||||
appImages: Array<chrome.cast.Image>;
|
||||
receiver: chrome.cast.Receiver;
|
||||
senderApps: Array<chrome.cast.SenderApplication>;
|
||||
namespaces: Array<{name: string}>;
|
||||
namespaces: Array<{ name: string }>;
|
||||
media: Array<chrome.cast.media.Media>;
|
||||
status: chrome.cast.SessionStatus
|
||||
|
||||
@@ -324,7 +325,7 @@ declare namespace chrome.cast {
|
||||
newLevel: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {boolean} muted
|
||||
@@ -335,7 +336,7 @@ declare namespace chrome.cast {
|
||||
muted: boolean,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
@@ -344,7 +345,7 @@ declare namespace chrome.cast {
|
||||
leave(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
@@ -353,7 +354,7 @@ declare namespace chrome.cast {
|
||||
stop(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -366,21 +367,21 @@ declare namespace chrome.cast {
|
||||
message: string,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
addUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
):void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
removeUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
):void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -389,7 +390,7 @@ declare namespace chrome.cast {
|
||||
addMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace: string, message: string) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -397,22 +398,22 @@ declare namespace chrome.cast {
|
||||
*/
|
||||
removeMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace:string, message:string) => void
|
||||
):void
|
||||
listener: (namespace: string, message: string) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(!chrome.cast.media.Media)} listener
|
||||
*/
|
||||
addMediaListener(
|
||||
listener: (media: chrome.cast.media.Media) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(!chrome.cast.media.Media)} listener
|
||||
*/
|
||||
removeMediaListener(
|
||||
listener: (media: chrome.cast.media.Media) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.LoadRequest} loadRequest
|
||||
@@ -423,7 +424,7 @@ declare namespace chrome.cast {
|
||||
loadRequest: chrome.cast.media.LoadRequest,
|
||||
successCallback: (media: chrome.cast.media.Media) => void,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.QueueLoadRequest} queueLoadRequest
|
||||
@@ -434,7 +435,7 @@ declare namespace chrome.cast {
|
||||
queueLoadRequest: chrome.cast.media.QueueLoadRequest,
|
||||
successCallback: (media: chrome.cast.media.Media) => void,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
): void
|
||||
}
|
||||
|
||||
export interface Receiver {
|
||||
@@ -451,7 +452,7 @@ declare namespace chrome.cast {
|
||||
friendlyName: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
volume?: chrome.cast.Volume
|
||||
):Receiver;
|
||||
): Receiver;
|
||||
|
||||
label: string;
|
||||
friendlyName: string;
|
||||
@@ -471,7 +472,7 @@ declare namespace chrome.cast {
|
||||
new(
|
||||
statusText: string,
|
||||
appImages: Array<chrome.cast.Image>
|
||||
):ReceiverDisplayStatus;
|
||||
): ReceiverDisplayStatus;
|
||||
|
||||
statusText: string;
|
||||
appImages: Array<chrome.cast.Image>;
|
||||
@@ -487,7 +488,7 @@ declare namespace chrome.cast {
|
||||
new(
|
||||
level?: number,
|
||||
muted?: boolean
|
||||
):Volume;
|
||||
): Volume;
|
||||
|
||||
level?: number;
|
||||
muted?: boolean;
|
||||
@@ -500,77 +501,77 @@ declare namespace chrome.cast.media {
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaCommand
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.MediaCommand
|
||||
*/
|
||||
export interface MediaCommand {
|
||||
PAUSE: string;
|
||||
SEEK: string;
|
||||
STREAM_VOLUME: string;
|
||||
STREAM_MUTE: string;
|
||||
export enum MediaCommand {
|
||||
PAUSE = "pause",
|
||||
SEEK = "seek",
|
||||
STREAM_VOLUME = "stream_volume",
|
||||
STREAM_MUTE = "stream_mute"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MetadataType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.MetadataType
|
||||
*/
|
||||
export interface MetadataType {
|
||||
GENERIC: number;
|
||||
TV_SHOW: number;
|
||||
MOVIE: number;
|
||||
MUSIC_TRACK: number;
|
||||
PHOTO: number;
|
||||
export enum MetadataType {
|
||||
GENERIC,
|
||||
TV_SHOW,
|
||||
MOVIE,
|
||||
MUSIC_TRACK,
|
||||
PHOTO
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayerState
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.PlayerState
|
||||
*/
|
||||
export interface PlayerState {
|
||||
IDLE: string;
|
||||
PLAYING: string;
|
||||
PAUSED: string;
|
||||
BUFFERING: string;
|
||||
export enum PlayerState {
|
||||
IDLE = "IDLE",
|
||||
PLAYING = "PLAYING",
|
||||
PAUSED = "PAUSED",
|
||||
BUFFERING = "BUFFERING"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.ResumeState
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.ResumeState
|
||||
*/
|
||||
export interface ResumeState {
|
||||
PLAYBACK_START: string;
|
||||
PLAYBACK_PAUSE: string;
|
||||
export enum ResumeState {
|
||||
PLAYBACK_START = "PLAYBACK_START",
|
||||
PLAYBACK_PAUSE = "PLAYBACK_PAUSE"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StreamType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.StreamType
|
||||
*/
|
||||
export interface StreamType {
|
||||
BUFFERED: string;
|
||||
LIVE: string;
|
||||
OTHER: string;
|
||||
export enum StreamType {
|
||||
BUFFERED = "BUFFERED",
|
||||
LIVE = "LIVE",
|
||||
OTHER = "OTHER"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.IdleReason
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.IdleReason
|
||||
*/
|
||||
export interface IdleReason {
|
||||
CANCELLED: string;
|
||||
INTERRUPTED: string;
|
||||
FINISHED: string;
|
||||
ERROR: string;
|
||||
export enum IdleReason {
|
||||
CANCELLED = "CANCELLED",
|
||||
INTERRUPTED = "INTERRUPTED",
|
||||
FINISHED = "FINISHED",
|
||||
ERROR = "ERROR"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.RepeatMode
|
||||
*/
|
||||
export interface RepeatMode {
|
||||
OFF:string;
|
||||
ALL:string;
|
||||
SINGLE:string;
|
||||
ALL_AND_SHUFFLE:string;
|
||||
export enum RepeatMode {
|
||||
OFF = "REPEAT_OFF",
|
||||
ALL = "REPEAT_ALL",
|
||||
SINGLE = "REPEAT_SINGLE",
|
||||
ALL_AND_SHUFFLE = "REPEAT_ALL_AND_SHUFFLE"
|
||||
}
|
||||
|
||||
export interface QueueItem {
|
||||
@@ -581,7 +582,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
mediaInfo: chrome.cast.media.MediaInfo
|
||||
):QueueItem;
|
||||
): QueueItem;
|
||||
|
||||
activeTrackIds: Array<Number>;
|
||||
autoplay: boolean;
|
||||
@@ -600,7 +601,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
items: Array<chrome.cast.media.QueueItem>
|
||||
):QueueLoadRequest;
|
||||
): QueueLoadRequest;
|
||||
|
||||
customData: Object;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
@@ -616,10 +617,10 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemsToInsert: Array<chrome.cast.media.QueueItem>
|
||||
):QueueInsertItemsRequest;
|
||||
): QueueInsertItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
insertBefore:number;
|
||||
insertBefore: number;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
}
|
||||
|
||||
@@ -631,7 +632,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemIdsToRemove: Array<number>
|
||||
):QueueRemoveItemsRequest;
|
||||
): QueueRemoveItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
itemIds: Array<number>;
|
||||
@@ -645,7 +646,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemIdsToReorder: Array<number>
|
||||
):QueueReorderItemsRequest;
|
||||
): QueueReorderItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
insertBefore: number;
|
||||
@@ -660,7 +661,7 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
itemsToUpdate: Array<chrome.cast.media.QueueItem>
|
||||
):QueueUpdateItemsRequest;
|
||||
): QueueUpdateItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
item: Array<chrome.cast.media.QueueItem>;
|
||||
@@ -668,71 +669,71 @@ declare namespace chrome.cast.media {
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TrackType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TrackType
|
||||
*/
|
||||
export interface TrackType {
|
||||
TEXT: string;
|
||||
AUDIO: string;
|
||||
VIDEO: string;
|
||||
export enum TrackType {
|
||||
TEXT = "TEXT",
|
||||
AUDIO = "AUDIO",
|
||||
VIDEO = "VIDEO"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackType
|
||||
*/
|
||||
export interface TextTrackType {
|
||||
SUBTITLES: string;
|
||||
CAPTIONS: string;
|
||||
DESCRIPTIONS: string;
|
||||
CHAPTERS: string;
|
||||
METADATA: string;
|
||||
export enum TextTrackType {
|
||||
SUBTITLES = "SUBTITLES",
|
||||
CAPTIONS = "CAPTIONS",
|
||||
DESCRIPTIONS = "DESCRIPTIONS",
|
||||
CHAPTERS = "CHAPTERS",
|
||||
METADATA = "METADATA"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackEdgeType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackEdgeType
|
||||
*/
|
||||
export interface TextTrackEdgeType {
|
||||
NONE: string;
|
||||
OUTLINE: string;
|
||||
DROP_SHADOW: string;
|
||||
RAISED: string;
|
||||
DEPRESSED: string;
|
||||
export enum TextTrackEdgeType {
|
||||
NONE = "NONE",
|
||||
OUTLINE = "OUTLINE",
|
||||
DROP_SHADOW = "DROP_SHADOW",
|
||||
RAISED = "RAISED",
|
||||
DEPRESSED = "DEPRESSED"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackWindowType
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackWindowType
|
||||
*/
|
||||
export interface TextTrackWindowType {
|
||||
NONE: string;
|
||||
NORMAL: string;
|
||||
ROUNDED_CORNERS: string;
|
||||
export enum TextTrackWindowType {
|
||||
NONE = "NONE",
|
||||
NORMAL = "NORMAL",
|
||||
ROUNDED_CORNERS = "ROUNDED_CORNERS"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontGenericFamily
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackFontGenericFamily
|
||||
*/
|
||||
export interface TextTrackFontGenericFamily {
|
||||
SANS_SERIF: string;
|
||||
MONOSPACED_SANS_SERIF: string;
|
||||
SERIF: string;
|
||||
MONOSPACED_SERIF: string;
|
||||
CASUAL: string;
|
||||
CURSIVE: string;
|
||||
SMALL_CAPITALS: string;
|
||||
export enum TextTrackFontGenericFamily {
|
||||
SANS_SERIF = "SANS_SERIF",
|
||||
MONOSPACED_SANS_SERIF = "MONOSPACED_SANS_SERIF",
|
||||
SERIF = "SERIF",
|
||||
MONOSPACED_SERIF = "MONOSPACED_SERIF",
|
||||
CASUAL = "CASUAL",
|
||||
CURSIVE = "CURSIVE",
|
||||
SMALL_CAPITALS = "SMALL_CAPITALS"
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackFontStyle
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.TextTrackFontStyle
|
||||
*/
|
||||
export interface TextTrackFontStyle {
|
||||
NORMAL: string;
|
||||
BOLD: string;
|
||||
BOLD_ITALIC: string;
|
||||
ITALIC: string;
|
||||
export enum TextTrackFontStyle {
|
||||
NORMAL = "NORMAL",
|
||||
BOLD = "BOLD",
|
||||
BOLD_ITALIC = "BOLD_ITALIC",
|
||||
ITALIC = "ITALIC"
|
||||
}
|
||||
|
||||
export interface GetStatusRequest {
|
||||
@@ -740,7 +741,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest
|
||||
*/
|
||||
new():GetStatusRequest;
|
||||
new(): GetStatusRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -750,7 +751,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest
|
||||
*/
|
||||
new():PauseRequest;
|
||||
new(): PauseRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -760,7 +761,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest
|
||||
*/
|
||||
new():PlayRequest;
|
||||
new(): PlayRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -770,7 +771,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest
|
||||
*/
|
||||
new():SeekRequest;
|
||||
new(): SeekRequest;
|
||||
|
||||
currentTime: number;
|
||||
resumeState: chrome.cast.media.ResumeState;
|
||||
@@ -782,7 +783,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest
|
||||
*/
|
||||
new():StopRequest;
|
||||
new(): StopRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -795,21 +796,21 @@ declare namespace chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
volume: chrome.cast.Volume
|
||||
):VolumeRequest;
|
||||
): VolumeRequest;
|
||||
|
||||
volume: chrome.cast.Volume;
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface LoadRequest {
|
||||
export class LoadRequest {
|
||||
/**
|
||||
* @param {!chrome.cast.media.MediaInfo} mediaInfo
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.LoadRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
mediaInfo: chrome.cast.media.MediaInfo
|
||||
):LoadRequest;
|
||||
);
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
autoplay: boolean;
|
||||
@@ -828,19 +829,13 @@ declare namespace chrome.cast.media {
|
||||
new(
|
||||
activeTrackIds?: Array<number>,
|
||||
textTrackStyle?: chrome.cast.media.TextTrackStyle
|
||||
):EditTracksInfoRequest;
|
||||
): EditTracksInfoRequest;
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
textTrackStyle: chrome.cast.media.TextTrackStyle;
|
||||
}
|
||||
|
||||
export interface GenericMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata
|
||||
*/
|
||||
new():GenericMediaMetadata;
|
||||
|
||||
export class GenericMediaMetadata {
|
||||
images: Array<chrome.cast.Image>;
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
releaseDate: string;
|
||||
@@ -857,7 +852,7 @@ declare namespace chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata
|
||||
*/
|
||||
new():MovieMediaMetadata;
|
||||
new(): MovieMediaMetadata;
|
||||
|
||||
images: Array<chrome.cast.Image>;
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
@@ -898,7 +893,7 @@ declare namespace chrome.cast.media {
|
||||
releaseYear: number;
|
||||
}
|
||||
|
||||
export interface MusicTrackMediaMetadata {
|
||||
export interface MusicTrackMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata
|
||||
@@ -947,17 +942,17 @@ declare namespace chrome.cast.media {
|
||||
type: chrome.cast.media.MetadataType;
|
||||
}
|
||||
|
||||
export interface MediaInfo {
|
||||
export class MediaInfo {
|
||||
/**
|
||||
* @param {string} contentId
|
||||
* @param {string} contentType
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaInfo
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
contentId: string,
|
||||
contentType: string
|
||||
): MediaInfo;
|
||||
);
|
||||
|
||||
contentId: string;
|
||||
streamType: chrome.cast.media.StreamType;
|
||||
@@ -1089,14 +1084,14 @@ declare namespace chrome.cast.media {
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
addUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
removeUpdateListener(
|
||||
listener: (isAlive:boolean) => void
|
||||
listener: (isAlive: boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
@@ -1110,7 +1105,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueAppendItem (
|
||||
queueAppendItem(
|
||||
item: chrome.cast.media.QueueItem,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1121,7 +1116,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueInsertItems (
|
||||
queueInsertItems(
|
||||
queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1132,7 +1127,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueJumpToItem (
|
||||
queueJumpToItem(
|
||||
itemId: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1144,7 +1139,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueMoveItemToNewIndex (
|
||||
queueMoveItemToNewIndex(
|
||||
itemId: number,
|
||||
newIndex: number,
|
||||
successCallback: Function,
|
||||
@@ -1155,7 +1150,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueNext (
|
||||
queueNext(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
@@ -1164,7 +1159,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queuePrev (
|
||||
queuePrev(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
@@ -1174,7 +1169,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueRemoveItem (
|
||||
queueRemoveItem(
|
||||
itemId: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1185,7 +1180,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueReorderItems (
|
||||
queueReorderItems(
|
||||
queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1196,7 +1191,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueSetRepeatMode (
|
||||
queueSetRepeatMode(
|
||||
repeatMode: chrome.cast.media.RepeatMode,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -1207,7 +1202,7 @@ declare namespace chrome.cast.media {
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueUpdateItems (
|
||||
queueUpdateItems(
|
||||
queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
@@ -19,7 +19,8 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chrome-cast.d.ts",
|
||||
"test/index.ts"
|
||||
"chrome-cast/index.d.ts",
|
||||
"test/index.ts",
|
||||
"test/chrome-app.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
cast.framework.VERSION === "1.0.06";
|
||||
cast.framework.setLoggerLevel(cast.framework.LoggerLevel.DEBUG);
|
||||
|
||||
const context = cast.framework.CastContext.getInstance();
|
||||
context.getCastState() === cast.framework.CastState.CONNECTED;
|
||||
context.getSessionState() === cast.framework.SessionState.NO_SESSION;
|
||||
|
||||
context.setOptions({
|
||||
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
|
||||
language: "en-US",
|
||||
receiverApplicationId: "test",
|
||||
resumeSavedSession: true
|
||||
});
|
||||
|
||||
context.addEventListener(
|
||||
cast.framework.CastContextEventType.CAST_STATE_CHANGED,
|
||||
event => {
|
||||
const { castState } = event;
|
||||
}
|
||||
);
|
||||
context.addEventListener(
|
||||
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
|
||||
event => {
|
||||
const { sessionState } = event;
|
||||
}
|
||||
);
|
||||
|
||||
const handleSessionStateChange = (
|
||||
event: cast.framework.SessionStateEventData
|
||||
) => {};
|
||||
context.removeEventListener(
|
||||
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
|
||||
handleSessionStateChange
|
||||
);
|
||||
|
||||
context.requestSession().then(err => {
|
||||
if (err === chrome.cast.ErrorCode.CHANNEL_ERROR) return;
|
||||
|
||||
const session = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
if (!session) return;
|
||||
|
||||
const handleError = (err?: chrome.cast.ErrorCode) => {};
|
||||
|
||||
session.getSessionObj().sessionId === session.getSessionId();
|
||||
session.getSessionState() === cast.framework.SessionState.SESSION_STARTED;
|
||||
session.getCastDevice().name;
|
||||
session.getApplicationMetadata().applicationId;
|
||||
session.getApplicationStatus() === "";
|
||||
session.getActiveInputState() ===
|
||||
cast.framework.ActiveInputState.ACTIVE_INPUT_STATE_UNKNOWN;
|
||||
session.endSession(false);
|
||||
session.setVolume(0.5).then(handleError);
|
||||
session.getVolume() === 0.5;
|
||||
session.setMute(true).then(handleError);
|
||||
session.isMute();
|
||||
session.sendMessage("namespace", { obj: 1 }).then(handleError);
|
||||
session.sendMessage("namespace", "string");
|
||||
session.sendMessage("namespace", 2);
|
||||
|
||||
session.addMessageListener("namespace", (namespace, message) => {});
|
||||
session.removeMessageListener("namespace", (namespace, message) => {});
|
||||
|
||||
const req = new chrome.cast.media.LoadRequest(
|
||||
new chrome.cast.media.MediaInfo("id", "type")
|
||||
);
|
||||
session.loadMedia(req);
|
||||
|
||||
const media = session.getMediaSession();
|
||||
if (media && media.sessionId) {
|
||||
}
|
||||
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.ACTIVE_INPUT_STATE_CHANGED,
|
||||
({ activeInputState }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.APPLICATION_METADATA_CHANGED,
|
||||
({ metadata }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.APPLICATION_STATUS_CHANGED,
|
||||
({ status }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.MEDIA_SESSION,
|
||||
({ mediaSession }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.VOLUME_CHANGED,
|
||||
({ volume }) => {}
|
||||
);
|
||||
session.removeEventListener(
|
||||
cast.framework.SessionEventType.VOLUME_CHANGED,
|
||||
({ volume }) => {}
|
||||
);
|
||||
});
|
||||
|
||||
const player = new cast.framework.RemotePlayer();
|
||||
{
|
||||
const bool: boolean =
|
||||
player.isConnected &&
|
||||
player.isMediaLoaded &&
|
||||
player.canControlVolume &&
|
||||
player.isPaused &&
|
||||
player.isMuted &&
|
||||
player.canPause &&
|
||||
player.canSeek;
|
||||
const sum: number = player.duration + player.currentTime + player.volumeLevel;
|
||||
const str: string =
|
||||
player.displayName + player.statusText + player.title + player.displayName;
|
||||
}
|
||||
player.mediaInfo && player.mediaInfo.contentId;
|
||||
player.imageUrl && player.imageUrl === "";
|
||||
player.playerState && player.playerState === chrome.cast.media.PlayerState.IDLE;
|
||||
player.savedPlayerState && player.savedPlayerState.currentTime;
|
||||
player.controller === null;
|
||||
|
||||
const playerCtrl = new cast.framework.RemotePlayerController(player);
|
||||
player.controller === playerCtrl;
|
||||
playerCtrl.playOrPause();
|
||||
playerCtrl.stop();
|
||||
playerCtrl.seek();
|
||||
playerCtrl.muteOrUnmute();
|
||||
playerCtrl.setVolumeLevel();
|
||||
playerCtrl.getFormattedTime(60);
|
||||
playerCtrl.getSeekPosition(1, 60) === playerCtrl.getSeekTime(1, 60);
|
||||
playerCtrl.addEventListener(
|
||||
cast.framework.RemotePlayerEventType.ANY_CHANGE,
|
||||
() => {}
|
||||
);
|
||||
playerCtrl.removeEventListener(
|
||||
cast.framework.RemotePlayerEventType.ANY_CHANGE,
|
||||
() => {}
|
||||
);
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
// Type definitions for Cast Application Framework Sender API 1.0
|
||||
// Project: https://developers.google.com/cast/docs/caf_receiver_overview
|
||||
// Definitions by: Samuel Maddock <https://github.com/samuelmaddock>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="chrome/chrome-cast" />
|
||||
|
||||
////////////////////
|
||||
// Global object
|
||||
////////////////////
|
||||
interface Window {
|
||||
cast: typeof cast;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Framework
|
||||
////////////////////
|
||||
/**
|
||||
* Cast Application Framework
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/cast.framework
|
||||
*/
|
||||
declare namespace cast.framework {
|
||||
enum LoggerLevel {
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR,
|
||||
NONE
|
||||
}
|
||||
|
||||
enum CastState {
|
||||
NO_DEVICES_AVAILABLE = "NO_DEVICES_AVAILABLE",
|
||||
NOT_CONNECTED = "NOT_CONNECTED",
|
||||
CONNECTING = "CONNECTING",
|
||||
CONNECTED = "CONNECTED"
|
||||
}
|
||||
|
||||
enum SessionState {
|
||||
NO_SESSION = "NO_SESSION",
|
||||
SESSION_STARTING = "SESSION_STARTING",
|
||||
SESSION_STARTED = "SESSION_STARTED",
|
||||
SESSION_START_FAILED = "SESSION_START_FAILED",
|
||||
SESSION_ENDING = "SESSION_ENDING",
|
||||
SESSION_ENDED = "SESSION_ENDED",
|
||||
SESSION_RESUMED = "SESSION_RESUMED"
|
||||
}
|
||||
enum CastContextEventType {
|
||||
CAST_STATE_CHANGED = "caststatechanged",
|
||||
SESSION_STATE_CHANGED = "sessionstatechanged"
|
||||
}
|
||||
enum SessionEventType {
|
||||
APPLICATION_STATUS_CHANGED = "applicationstatuschanged",
|
||||
APPLICATION_METADATA_CHANGED = "applicationmetadatachanged",
|
||||
ACTIVE_INPUT_STATE_CHANGED = "activeinputstatechanged",
|
||||
VOLUME_CHANGED = "volumechanged",
|
||||
MEDIA_SESSION = "mediasession"
|
||||
}
|
||||
enum RemotePlayerEventType {
|
||||
ANY_CHANGE = "anyChanged",
|
||||
IS_CONNECTED_CHANGED = "isConnectedChanged",
|
||||
IS_MEDIA_LOADED_CHANGED = "isMediaLoadedChanged",
|
||||
DURATION_CHANGED = "durationChanged",
|
||||
CURRENT_TIME_CHANGED = "currentTimeChanged",
|
||||
IS_PAUSED_CHANGED = "isPausedChanged",
|
||||
VOLUME_LEVEL_CHANGED = "volumeLevelChanged",
|
||||
CAN_CONTROL_VOLUME_CHANGED = "canControlVolumeChanged",
|
||||
IS_MUTED_CHANGED = "isMutedChanged",
|
||||
CAN_PAUSE_CHANGED = "canPauseChanged",
|
||||
CAN_SEEK_CHANGED = "canSeekChanged",
|
||||
DISPLAY_NAME_CHANGED = "displayNameChanged",
|
||||
STATUS_TEXT_CHANGED = "statusTextChanged",
|
||||
TITLE_CHANGED = "titleChanged",
|
||||
DISPLAY_STATUS_CHANGED = "displayStatusChanged",
|
||||
MEDIA_INFO_CHANGED = "mediaInfoChanged",
|
||||
IMAGE_URL_CHANGED = "imageUrlChanged",
|
||||
PLAYER_STATE_CHANGED = "playerStateChanged"
|
||||
}
|
||||
|
||||
enum ActiveInputState {
|
||||
ACTIVE_INPUT_STATE_UNKNOWN = -1,
|
||||
ACTIVE_INPUT_STATE_NO = 0,
|
||||
ACTIVE_INPUT_STATE_YES = 1
|
||||
}
|
||||
|
||||
interface CastOptions {
|
||||
autoJoinPolicy: chrome.cast.AutoJoinPolicy;
|
||||
language?: string;
|
||||
receiverApplicationId?: string;
|
||||
resumeSavedSession?: boolean;
|
||||
}
|
||||
|
||||
const VERSION: string;
|
||||
function setLoggerLevel(level: LoggerLevel): void;
|
||||
|
||||
class CastContext {
|
||||
static getInstance(): CastContext;
|
||||
setOptions(options: CastOptions): void;
|
||||
getCastState(): CastState;
|
||||
getSessionState(): SessionState;
|
||||
requestSession(): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
getCurrentSession(): CastSession | null;
|
||||
endCurrentSession(stopCasting: boolean): void;
|
||||
|
||||
addEventListener(
|
||||
type: CastContextEventType.CAST_STATE_CHANGED,
|
||||
handler: (event: CastStateEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: CastContextEventType.SESSION_STATE_CHANGED,
|
||||
handler: (event: SessionStateEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: CastContextEventType.CAST_STATE_CHANGED,
|
||||
handler: (event: CastStateEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: CastContextEventType.SESSION_STATE_CHANGED,
|
||||
handler: (event: SessionStateEventData) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
class CastSession {
|
||||
constructor(sessionObj: chrome.cast.Session, state: SessionState);
|
||||
getSessionObj(): chrome.cast.Session;
|
||||
getSessionId(): string;
|
||||
getSessionState(): SessionState;
|
||||
getCastDevice(): chrome.cast.Receiver;
|
||||
getApplicationMetadata(): ApplicationMetadata;
|
||||
getApplicationStatus(): string;
|
||||
getActiveInputState(): ActiveInputState;
|
||||
endSession(stopCasting: boolean): void;
|
||||
setVolume(volume: number): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
getVolume(): number;
|
||||
setMute(mute: boolean): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
isMute(): boolean;
|
||||
sendMessage(
|
||||
namespace: string,
|
||||
data: any
|
||||
): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
addMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace: string, message: string) => void
|
||||
): void;
|
||||
removeMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace: string, message: string) => void
|
||||
): void;
|
||||
loadMedia(
|
||||
request: chrome.cast.media.LoadRequest
|
||||
): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
getMediaSession(): chrome.cast.media.Media | null;
|
||||
|
||||
addEventListener(
|
||||
type: SessionEventType.ACTIVE_INPUT_STATE_CHANGED,
|
||||
handler: (event: ActiveInputStateEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.APPLICATION_METADATA_CHANGED,
|
||||
handler: (event: ApplicationMetadataEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.APPLICATION_STATUS_CHANGED,
|
||||
handler: (event: ApplicationStatusEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.MEDIA_SESSION,
|
||||
handler: (event: MediaSessionEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.VOLUME_CHANGED,
|
||||
handler: (event: VolumeEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.ACTIVE_INPUT_STATE_CHANGED,
|
||||
handler: (event: ActiveInputStateEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.APPLICATION_METADATA_CHANGED,
|
||||
handler: (event: ApplicationMetadataEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.APPLICATION_STATUS_CHANGED,
|
||||
handler: (event: ApplicationStatusEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.MEDIA_SESSION,
|
||||
handler: (event: MediaSessionEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.VOLUME_CHANGED,
|
||||
handler: (event: VolumeEventData) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
class RemotePlayerController {
|
||||
constructor(player: RemotePlayer);
|
||||
playOrPause(): void;
|
||||
stop(): void;
|
||||
seek(): void;
|
||||
muteOrUnmute(): void;
|
||||
setVolumeLevel(): void;
|
||||
getFormattedTime(timeInSec: number): string;
|
||||
getSeekPosition(currentTime: number, duration: number): number;
|
||||
getSeekTime(currentPosition: number, duration: number): number;
|
||||
|
||||
addEventListener(
|
||||
type: RemotePlayerEventType,
|
||||
handler: (event: RemotePlayerChangedEvent) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: RemotePlayerEventType,
|
||||
handler: (event: RemotePlayerChangedEvent) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
interface SavedPlayerState {
|
||||
mediaInfo: chrome.cast.media.PlayerState | null;
|
||||
currentTime: number;
|
||||
isPaused: boolean;
|
||||
}
|
||||
|
||||
class RemotePlayer {
|
||||
isConnected: boolean;
|
||||
isMediaLoaded: boolean;
|
||||
duration: number;
|
||||
currentTime: number;
|
||||
volumeLevel: number;
|
||||
canControlVolume: boolean;
|
||||
isPaused: boolean;
|
||||
isMuted: boolean;
|
||||
canPause: boolean;
|
||||
canSeek: boolean;
|
||||
displayName: string;
|
||||
statusText: string;
|
||||
title: string;
|
||||
displayStatus: string;
|
||||
mediaInfo?: chrome.cast.media.MediaInfo;
|
||||
imageUrl: string | null;
|
||||
playerState: chrome.cast.media.PlayerState | null;
|
||||
savedPlayerState: SavedPlayerState | null;
|
||||
controller: RemotePlayerController | null;
|
||||
}
|
||||
|
||||
class ApplicationMetadata {
|
||||
constructor(sessionObj: chrome.cast.Session);
|
||||
applicationId: string;
|
||||
images: chrome.cast.Image[];
|
||||
name: string;
|
||||
namespaces: string[];
|
||||
}
|
||||
|
||||
abstract class EventData {
|
||||
constructor(type: string);
|
||||
type: string;
|
||||
}
|
||||
|
||||
class ActiveInputStateEventData extends EventData {
|
||||
constructor(activeInputState: ActiveInputState);
|
||||
activeInputState: ActiveInputState;
|
||||
}
|
||||
|
||||
class ApplicationMetadataEventData extends EventData {
|
||||
constructor(metadata: ApplicationMetadata);
|
||||
metadata: ApplicationMetadata;
|
||||
}
|
||||
|
||||
class ApplicationStatusEventData extends EventData {
|
||||
constructor(status: string);
|
||||
status: string;
|
||||
}
|
||||
|
||||
class CastStateEventData extends EventData {
|
||||
constructor(castState: CastState);
|
||||
castState: CastState;
|
||||
}
|
||||
|
||||
class MediaSessionEventData extends EventData {
|
||||
constructor(mediaSession: chrome.cast.media.Media);
|
||||
mediaSession: chrome.cast.media.Media;
|
||||
}
|
||||
|
||||
class RemotePlayerChangedEvent<T = any> extends EventData {
|
||||
constructor(type: RemotePlayerEventType, field: string, value: T);
|
||||
field: string;
|
||||
value: T;
|
||||
}
|
||||
|
||||
class SessionStateEventData extends EventData {
|
||||
constructor(
|
||||
session: CastSession,
|
||||
sessionState: SessionState,
|
||||
opt_errorCode: chrome.cast.ErrorCode
|
||||
);
|
||||
errorCode: chrome.cast.ErrorCode;
|
||||
session: CastSession;
|
||||
sessionState: SessionState;
|
||||
}
|
||||
|
||||
class VolumeEventData extends EventData {
|
||||
constructor(volume: number, isMute: boolean);
|
||||
isMute: boolean;
|
||||
volume: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chromecast-caf-sender-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+725
-111
@@ -6,9 +6,9 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.skinName = 'moono';
|
||||
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
|
||||
var editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
|
||||
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection(false).getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_TEXT)
|
||||
alert(CKEDITOR.basePath);
|
||||
if (CKEDITOR.currentInstance)
|
||||
alert(CKEDITOR.currentInstance.name);
|
||||
@@ -35,6 +35,13 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.replaceAll();
|
||||
CKEDITOR.replaceAll('myClassName');
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
|
||||
var editor: CKEDITOR.editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
|
||||
var editor: CKEDITOR.editor = CKEDITOR.appendTo(document.createElement('div'));
|
||||
CKEDITOR.error('code');
|
||||
CKEDITOR.error('500', { moreData: true });
|
||||
CKEDITOR.warn('danger');
|
||||
CKEDITOR.warn('303', 12345);
|
||||
}
|
||||
|
||||
function test_CKEDITOR_events() {
|
||||
@@ -83,6 +90,8 @@ function test_dom_comment() {
|
||||
var nativeNode = document.createComment('Example');
|
||||
var comment = new CKEDITOR.dom.comment(nativeNode);
|
||||
var comment2 = new CKEDITOR.dom.comment('Example');
|
||||
var comment3 = new CKEDITOR.dom.comment('Example', new CKEDITOR.dom.document(document));
|
||||
var html: string = comment.getOuterHtml();
|
||||
}
|
||||
|
||||
function test_dom_document() {
|
||||
@@ -103,10 +112,16 @@ function test_dom_document() {
|
||||
'<body>Document contents created by code</body>' +
|
||||
'</html>'
|
||||
);
|
||||
var styles: CSSStyleSheet = document.appendStyleText('some styles');
|
||||
var element: CKEDITOR.dom.element = document.createElement('div');
|
||||
var element2: CKEDITOR.dom.element = document.createElement('div', { styles: { height: '1234' } });
|
||||
var element3: CKEDITOR.dom.element = document.createElement('div', { attributes: { id: '1234' } });
|
||||
var element4: CKEDITOR.dom.element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
|
||||
}
|
||||
|
||||
function test_dom_documentFragment() {
|
||||
var type = CKEDITOR.NODE_DOCUMENT_FRAGMENT;
|
||||
alert(new CKEDITOR.dom.documentFragment(document.body).type === type);
|
||||
}
|
||||
|
||||
function test_dom_domObject() {
|
||||
@@ -124,6 +139,8 @@ function test_dom_domObject() {
|
||||
var elementB = new CKEDITOR.dom.element(nativeElement).getPrivate().value;
|
||||
var element3 = new CKEDITOR.dom.element('span');
|
||||
element.setCustomData('hasCustomData', true);
|
||||
|
||||
var domObject = new CKEDITOR.dom.domObject(document.createElement('div'));
|
||||
}
|
||||
|
||||
function test_dom_element() {
|
||||
@@ -156,6 +173,7 @@ function test_dom_element() {
|
||||
element.appendTo(CKEDITOR.document.getBody());
|
||||
alert(element.getEditor().name);
|
||||
var first = element.getFirst();
|
||||
var first2 = element.getFirst((node: CKEDITOR.dom.node) => node.equals(document.body));
|
||||
alert(element.getHtml());
|
||||
alert(element.getId());
|
||||
alert(element.getName());
|
||||
@@ -199,6 +217,26 @@ function test_dom_element() {
|
||||
alert(element == CKEDITOR.dom.element.get(element));
|
||||
var htmlElement = document.getElementById('myElement');
|
||||
alert(CKEDITOR.dom.element.get(htmlElement).getName());
|
||||
|
||||
var dtd: CKEDITOR.dtdDefinition = element.getDtd();
|
||||
var last: CKEDITOR.dom.node = element.getLast();
|
||||
var last2: CKEDITOR.dom.node = element.getLast((node: CKEDITOR.dom.node) => node.equals(document.body));
|
||||
if (element.isBlockBoundary({ 'div': 1, 'span': 1 })) {
|
||||
element.setState(1, 'hex', false);
|
||||
}
|
||||
|
||||
CKEDITOR.dom.element.clearMarkers({}, element, true);
|
||||
var element1: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
var element2: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
|
||||
var element3: CKEDITOR.dom.element = CKEDITOR.dom.element.get(element2);
|
||||
var markedElement: CKEDITOR.dom.element = CKEDITOR.dom.element.setMarker({}, element, 'key', 0);
|
||||
}
|
||||
|
||||
function test_dom_elementPath() {
|
||||
var path: CKEDITOR.dom.elementPath = new CKEDITOR.dom.elementPath(CKEDITOR.dom.element.get('div'));
|
||||
var path2: CKEDITOR.dom.elementPath = new CKEDITOR.dom.elementPath(CKEDITOR.dom.element.get('div'), CKEDITOR.dom.element.get(document.body));
|
||||
|
||||
var dir: 'ltr' | 'rtl' = path.direction();
|
||||
}
|
||||
|
||||
function test_dom_event() {
|
||||
@@ -226,8 +264,10 @@ function test_dom_event() {
|
||||
function test_dom_iterator() {
|
||||
var range = new CKEDITOR.dom.range(new CKEDITOR.dom.element('div'));
|
||||
var iterator = range.createIterator();
|
||||
iterator.getNextParagraph();
|
||||
iterator.getNextParagraph();
|
||||
var paragrah1: CKEDITOR.dom.element = iterator.getNextParagraph();
|
||||
var paragrah2: CKEDITOR.dom.element = iterator.getNextParagraph('div');
|
||||
alert(iterator.forceBrBreak === false);
|
||||
var itRange: CKEDITOR.dom.range = iterator.range;
|
||||
}
|
||||
|
||||
function test_dom_node() {
|
||||
@@ -255,6 +295,7 @@ function test_dom_node() {
|
||||
function test_dom_nodeList() {
|
||||
var nodeList = CKEDITOR.document.getBody().getChildren();
|
||||
alert(nodeList.count());
|
||||
var nodes: CKEDITOR.dom.node[] = nodeList.toArray();
|
||||
}
|
||||
|
||||
function test_dom_range() {
|
||||
@@ -268,19 +309,96 @@ function test_dom_range() {
|
||||
alert(range.collapsed);
|
||||
range.selectNodeContents(range.document.getBody());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endContainer.getName());
|
||||
alert(range.endContainer.getPrivate());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endOffset);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startContainer.getName());
|
||||
alert(range.startContainer.getDocument());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startOffset);
|
||||
}
|
||||
|
||||
function test_dom_selection() {
|
||||
var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
var selection: CKEDITOR.dom.selection = new CKEDITOR.dom.selection(new CKEDITOR.dom.document(document));
|
||||
selection = new CKEDITOR.dom.selection(element);
|
||||
selection = new CKEDITOR.dom.selection(selection);
|
||||
|
||||
var marks: CKEDITOR.dom.bookmark[] = selection.createBookmarks('serialized');
|
||||
var marks2: CKEDITOR.dom.bookmark2[] = selection.createBookmarks2({ normalized: true });
|
||||
selection.fake(element);
|
||||
selection.fake(element, true);
|
||||
element = selection.getCommonAncestor();
|
||||
var domSel: Selection = selection.getNative();
|
||||
var ranges: CKEDITOR.dom.range[] = selection.getRanges();
|
||||
ranges = selection.getRanges(true);
|
||||
element = selection.getSelectedElement();
|
||||
var text: string = selection.getSelectedText();
|
||||
element = selection.getStartElement();
|
||||
|
||||
var type: number = selection.getType();
|
||||
|
||||
var isSomething: boolean = selection.isCollapsed();
|
||||
isSomething = selection.isHidden();
|
||||
isSomething = selection.isInTable();
|
||||
isSomething = selection.isInTable(false);
|
||||
|
||||
selection.lock();
|
||||
selection.removeAllRanges();
|
||||
selection.reset();
|
||||
selection.removeAllRanges();
|
||||
selection.reset();
|
||||
selection.scrollIntoView();
|
||||
selection = selection.selectBookmarks(marks);
|
||||
selection = selection.selectBookmarks(marks2);
|
||||
selection.selectElement(element);
|
||||
selection.selectRanges(ranges);
|
||||
selection.unlock(false);
|
||||
}
|
||||
|
||||
function test_dom_walker() {
|
||||
var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
var range: CKEDITOR.dom.range = new CKEDITOR.dom.range(element);
|
||||
|
||||
var walker: CKEDITOR.dom.walker = new CKEDITOR.dom.walker(range);
|
||||
|
||||
var isSomething: boolean = walker.checkBackward();
|
||||
isSomething = walker.checkForward();
|
||||
walker.end();
|
||||
|
||||
var node: CKEDITOR.dom.node = walker.lastBackward();
|
||||
node = walker.lastForward();
|
||||
node = walker.next();
|
||||
node = walker.previous();
|
||||
walker.reset();
|
||||
|
||||
isSomething = CKEDITOR.dom.walker.blockBoundary({ 'div': 1 })(node);
|
||||
isSomething = CKEDITOR.dom.walker.bogus()(node);
|
||||
isSomething = CKEDITOR.dom.walker.bogus(isSomething)(node);
|
||||
isSomething = CKEDITOR.dom.walker.bookmark()(node);
|
||||
isSomething = CKEDITOR.dom.walker.bookmark(true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.bookmark(true, false)(node);
|
||||
isSomething = CKEDITOR.dom.walker.editable()(node);
|
||||
isSomething = CKEDITOR.dom.walker.editable(isSomething)(node);
|
||||
isSomething = CKEDITOR.dom.walker.empty()(node);
|
||||
isSomething = CKEDITOR.dom.walker.empty(true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.ignored()(node);
|
||||
isSomething = CKEDITOR.dom.walker.ignored(true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.listItemBoundary()(node);
|
||||
isSomething = CKEDITOR.dom.walker.nodeType(0)(node);
|
||||
isSomething = CKEDITOR.dom.walker.nodeType(1, true)(node);
|
||||
isSomething = CKEDITOR.dom.walker.temp()(node);
|
||||
isSomething = CKEDITOR.dom.walker.temp(isSomething)(node);
|
||||
isSomething = CKEDITOR.dom.walker.whitespaces()(node);
|
||||
isSomething = CKEDITOR.dom.walker.whitespaces(isSomething)(node);
|
||||
}
|
||||
|
||||
function test_dom_text() {
|
||||
var nativeNode = document.createTextNode('Example');
|
||||
var text = new CKEDITOR.dom.text(nativeNode);
|
||||
var text2 = new CKEDITOR.dom.text('Example');
|
||||
text.substring(1, 2);
|
||||
text.substring(1);
|
||||
}
|
||||
|
||||
function test_dom_window() {
|
||||
@@ -292,6 +410,545 @@ function test_dom_window() {
|
||||
var size = win.getViewPaneSize();
|
||||
alert(size.width);
|
||||
alert(size.height);
|
||||
|
||||
var frame: CKEDITOR.dom.element = win.getFrame();
|
||||
win.focus();
|
||||
}
|
||||
|
||||
function test_ajax() {
|
||||
var req: string = CKEDITOR.ajax.load('https://ckeditor.com/ckeditor-4/');
|
||||
req = CKEDITOR.ajax.load('https://ckeditor.com/ckeditor-4/', (data: any) => console.log(data));
|
||||
|
||||
var xml: CKEDITOR.xml = CKEDITOR.ajax.loadXml('https://ckeditor.com/ckeditor-4/');
|
||||
xml = CKEDITOR.ajax.loadXml('https://ckeditor.com/ckeditor-4/', (data: any) => console.log(data));
|
||||
|
||||
CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {});
|
||||
CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {}, 'html');
|
||||
CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {}, 'text', (data: any) => console.log(data));
|
||||
}
|
||||
|
||||
function test_dataProcessor() {
|
||||
var processor: CKEDITOR.dataProcessor;
|
||||
processor.toDataFormat('html', 'fix');
|
||||
processor.toHtml('data');
|
||||
processor.toHtml('data', 'fix');
|
||||
}
|
||||
|
||||
function test_dialog() {
|
||||
var dialog: CKEDITOR.dialog = new CKEDITOR.dialog(CKEDITOR.instances[0], 'dialog');
|
||||
|
||||
var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
dialog.addFocusable(element);
|
||||
dialog.addFocusable(element, 13);
|
||||
dialog.addPage({ some: true, object: false });
|
||||
var ret = dialog.click('1234');
|
||||
dialog.commitContent();
|
||||
dialog.disableButton('some button');
|
||||
dialog.enableButton('4321');
|
||||
dialog = dialog.foreach(() => console.log('hey'));
|
||||
|
||||
var button: CKEDITOR.ui.dialog.button = dialog.getButton('button1');
|
||||
var uiEl: CKEDITOR.ui.dialog.uiElement = dialog.getContentElement('page1', 'element1');
|
||||
element = dialog.getElement();
|
||||
var str: string = dialog.getName();
|
||||
var numb: number = dialog.getPageCount();
|
||||
var editor: CKEDITOR.editor = dialog.getParentEditor();
|
||||
var obj: { [key: string]: any } = dialog.getPosition();
|
||||
element = dialog.getSelectedElement();
|
||||
obj = dialog.getSize();
|
||||
obj = dialog.getValueOf('page1', 'ele1');
|
||||
dialog.hide();
|
||||
dialog.hidePage('1234');
|
||||
dialog.layout();
|
||||
dialog.move(1, 2, true);
|
||||
dialog = dialog.reset();
|
||||
dialog.resize(numb, numb);
|
||||
dialog.selectPage('1');
|
||||
dialog.setState(4);
|
||||
dialog.setValueOf('page1', 'ele1', false);
|
||||
dialog.setupContent();
|
||||
dialog.show();
|
||||
dialog.showPage('1234');
|
||||
dialog.updateStyle();
|
||||
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
onLoad: () => {},
|
||||
onOk: () => {},
|
||||
onCancel: () => {},
|
||||
onShow: () => {},
|
||||
onHide: () => {},
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321);
|
||||
CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321, () => console.log('loaded'));
|
||||
CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321, () => console.log('loaded'), obj);
|
||||
|
||||
CKEDITOR.dialog.addUIElement('node', () => console.log('build'));
|
||||
CKEDITOR.dialog.cancelButton();
|
||||
CKEDITOR.dialog.exists('dialog1');
|
||||
CKEDITOR.dialog.exists(1234);
|
||||
dialog = CKEDITOR.dialog.getCurrent();
|
||||
|
||||
var isEnabled: boolean = CKEDITOR.dialog.isTabEnabled(editor, 'dialog', 'table');
|
||||
|
||||
CKEDITOR.dialog.okButton();
|
||||
}
|
||||
|
||||
function test_editable() {
|
||||
var element: CKEDITOR.dom.element;
|
||||
var editor: CKEDITOR.editor;
|
||||
|
||||
var editable: CKEDITOR.editable = new CKEDITOR.editable(editor, element);
|
||||
editable = new CKEDITOR.editable(editor, document.createElement('div'));
|
||||
|
||||
editable.attachClass('class');
|
||||
editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen')).removeListener();
|
||||
editable.attachListener(new CKEDITOR.event(), 'event', (evt: CKEDITOR.eventInfo) => console.log('listen')).removeListener();
|
||||
editable.attachListener(new CKEDITOR.event(), 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }).removeListener();
|
||||
editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }, 'data').removeListener();
|
||||
editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }, 'data', 1).removeListener();
|
||||
|
||||
editable.changeAttr('attr', 'val');
|
||||
editable.detach();
|
||||
|
||||
var range: CKEDITOR.dom.range;
|
||||
editable.insertElement(element);
|
||||
editable.insertElement(element, range);
|
||||
editable.insertHtml('data');
|
||||
editable.insertHtml('data', 'mode');
|
||||
editable.insertHtml('data', 'mode', range);
|
||||
editable.insertText(new CKEDITOR.dom.text('text'));
|
||||
|
||||
var inline: boolean = editable.isInline();
|
||||
editable.setReadOnly(inline);
|
||||
}
|
||||
|
||||
function test_fileTools() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var def: CKEDITOR.fileTools.uploadWidgetDefinition;
|
||||
var loader: CKEDITOR.fileTools.fileLoader;
|
||||
var blob: Blob;
|
||||
var element: CKEDITOR.dom.element;
|
||||
|
||||
CKEDITOR.fileTools.addUploadWidget(editor, 'editor', def);
|
||||
CKEDITOR.fileTools.bindNotification(editor, loader);
|
||||
var url: string = CKEDITOR.fileTools.getUploadUrl({ some: 'object' });
|
||||
url = CKEDITOR.fileTools.getUploadUrl({ some: 'object' }, 'type');
|
||||
|
||||
var supported = CKEDITOR.fileTools.isTypeSupported(blob, /regex/);
|
||||
CKEDITOR.fileTools.markElement(element, 'name', 45);
|
||||
}
|
||||
|
||||
function test_fileTools_fileLoader() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var def: CKEDITOR.fileTools.uploadWidgetDefinition;
|
||||
var blob: Blob;
|
||||
var element: CKEDITOR.dom.element;
|
||||
|
||||
var loader: CKEDITOR.fileTools.fileLoader = new CKEDITOR.fileTools.fileLoader(editor, 'data');
|
||||
loader = new CKEDITOR.fileTools.fileLoader(editor, blob);
|
||||
loader = new CKEDITOR.fileTools.fileLoader(editor, blob, 'name');
|
||||
|
||||
loader.abort();
|
||||
var finished: boolean = loader.isFinished();
|
||||
loader.load();
|
||||
loader.loadAndUpload('url');
|
||||
loader.loadAndUpload('url', { someHeader: '1234' });
|
||||
|
||||
loader.update();
|
||||
loader.upload('url');
|
||||
loader.upload('url', { someHeader: '1234' });
|
||||
}
|
||||
|
||||
function test_fileTools_uploadRepository() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var blob: Blob;
|
||||
var repo: CKEDITOR.fileTools.uploadRepository = new CKEDITOR.fileTools.uploadRepository(editor);
|
||||
|
||||
var loader: CKEDITOR.fileTools.fileLoader = repo.create('data', 'name');
|
||||
loader = repo.create(blob, 'name', 'type');
|
||||
|
||||
var fin: boolean = loader.isFinished();
|
||||
}
|
||||
|
||||
function test_filter() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var style: CKEDITOR.style;
|
||||
|
||||
var filter: CKEDITOR.filter = new CKEDITOR.filter(editor);
|
||||
filter = new CKEDITOR.filter('rule');
|
||||
filter = new CKEDITOR.filter(style);
|
||||
filter = new CKEDITOR.filter([ style, 'rule', [ style, 'rule' ] ]);
|
||||
filter = CKEDITOR.filter.instances['1234'];
|
||||
|
||||
filter.addContentForms([ { form: true } ]);
|
||||
filter.addElementCallback((el: CKEDITOR.htmlParser.element) => 4);
|
||||
filter.addFeature({ allowedContent: style });
|
||||
filter.addTransformations([ [ 'transform1', { right: (element: CKEDITOR.htmlParser.element, tools: string | CKEDITOR.filter.transformationTools) => true } ] ]);
|
||||
|
||||
var allowed: boolean = filter.allow(style);
|
||||
allowed = filter.allow([style], 'name');
|
||||
allowed = filter.allow('rule', 'name', false);
|
||||
|
||||
var apply: boolean = filter.applyTo(CKEDITOR.htmlParser.fragment.fromHtml('string'), true, false, 1);
|
||||
apply = filter.applyTo(new CKEDITOR.htmlParser.element('name', null), true, false, 1);
|
||||
|
||||
var checked: boolean = filter.check(style);
|
||||
checked = filter.check('rule', true);
|
||||
checked = filter.check(style, false, true);
|
||||
|
||||
checked = filter.checkFeature({ allowedContent: style });
|
||||
|
||||
filter = filter.clone();
|
||||
filter.destroy();
|
||||
filter.disable();
|
||||
|
||||
filter.disallow(filter.disallowedContent);
|
||||
var mode: number = filter.getAllowedEnterMode(1);
|
||||
mode = filter.getAllowedEnterMode(1, false);
|
||||
}
|
||||
|
||||
function test_focusManager() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
var element = CKEDITOR.document.getById('myElement');
|
||||
|
||||
instance.focusManager.focus();
|
||||
instance.focusManager.focus(element);
|
||||
instance.focusManager.lock();
|
||||
instance.focusManager.unlock();
|
||||
instance.focusManager.blur();
|
||||
instance.focusManager.blur(true);
|
||||
instance.focusManager.add(element, true);
|
||||
instance.focusManager.remove(element);
|
||||
|
||||
var focusManager = new CKEDITOR.focusManager(CKEDITOR.instances[0]);
|
||||
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
|
||||
function test_htmlParser_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.closeTag('p');
|
||||
writer.comment('hello');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
writer.openTag('p', {});
|
||||
writer.openTagClose('p', false);
|
||||
writer.reset();
|
||||
writer.text('Hello');
|
||||
writer.write('data');
|
||||
}
|
||||
|
||||
function test_htmlParser_cdata() {
|
||||
var cdata: CKEDITOR.htmlParser.cdata = new CKEDITOR.htmlParser.cdata('hey');
|
||||
cdata.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
}
|
||||
|
||||
function test_htmlParser_comment() {
|
||||
var filter: CKEDITOR.htmlParser.filter;
|
||||
var comment: CKEDITOR.htmlParser.comment = new CKEDITOR.htmlParser.comment('hey');
|
||||
var filtered: boolean = comment.filter(filter);
|
||||
comment.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
comment.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
}
|
||||
|
||||
function test_htmlParser_cssStyle() {
|
||||
var element: CKEDITOR.htmlParser.element;
|
||||
|
||||
var style: CKEDITOR.htmlParser.cssStyle = new CKEDITOR.htmlParser.cssStyle(element);
|
||||
style = new CKEDITOR.htmlParser.cssStyle('styles');
|
||||
|
||||
style.populate(element);
|
||||
style.populate(new CKEDITOR.dom.element('div'));
|
||||
style.populate({ 'width': 1 });
|
||||
}
|
||||
|
||||
function test_htmlParser_element() {
|
||||
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { 'id': '1'});
|
||||
|
||||
var node: CKEDITOR.htmlParser.node;
|
||||
element.add(node);
|
||||
element.add(node, 5);
|
||||
element.addClass('class');
|
||||
element = element.clone();
|
||||
|
||||
var filter: CKEDITOR.htmlParser.filter;
|
||||
var filtered: boolean = element.filter(filter);
|
||||
element.filterChildren(filter);
|
||||
|
||||
var nodes: CKEDITOR.htmlParser.node[] = element.find('*');
|
||||
nodes = element.find((el: CKEDITOR.htmlParser.node) => false, true);
|
||||
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'));
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'), 1);
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => false, 2, true);
|
||||
|
||||
var node: CKEDITOR.htmlParser.node = element.getFirst('*');
|
||||
node = element.getFirst({ 'id': '1' });
|
||||
node = element.getFirst((el: CKEDITOR.htmlParser.node) => true);
|
||||
|
||||
var html: string = element.getHtml();
|
||||
html = element.getOuterHtml();
|
||||
|
||||
var hasClass: boolean = element.hasClass('class');
|
||||
element.removeClass('class');
|
||||
element.replaceWithChildren();
|
||||
element.setHtml('html');
|
||||
var el2: CKEDITOR.htmlParser.element = element.split(1);
|
||||
|
||||
element.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
element.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
|
||||
element.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
element.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
}
|
||||
|
||||
function test_htmlParser_filter() {
|
||||
var filter: CKEDITOR.htmlParser.filter = new CKEDITOR.htmlParser.filter({ elementNames: [ 'div' ] });
|
||||
filter = new CKEDITOR.htmlParser.filter();
|
||||
|
||||
filter.addRules({ text: 'text' });
|
||||
filter.addRules({ attributes: { 'id': '1234' }}, 1);
|
||||
filter.addRules({ comment: 'hey', text: 'text' }, { priority: 1 });
|
||||
filter.addRules({ root: document.body }, { applyToAll: false });
|
||||
|
||||
var node: CKEDITOR.htmlParser.node;
|
||||
filter.applyTo(node);
|
||||
}
|
||||
|
||||
|
||||
function test_htmlParser_filterRulesGroup() {
|
||||
var rules: CKEDITOR.htmlParser.filterRulesGroup = new CKEDITOR.htmlParser.filterRulesGroup();
|
||||
|
||||
rules.add([ 'some', 'rule' ], 1, { applyToAll: false, excludeNestedEditable: true });
|
||||
|
||||
rules.addMany([ (value: CKEDITOR.htmlParser.node | CKEDITOR.htmlParser.fragment | string) => false, [ 'some', 'rule' ] ], 1, { applyToAll: false });
|
||||
|
||||
var nodeFragOrString: CKEDITOR.htmlParser.node | CKEDITOR.htmlParser.fragment | string;
|
||||
nodeFragOrString = rules.exec(nodeFragOrString);
|
||||
|
||||
var str: string;
|
||||
str = rules.execOnName(str);
|
||||
|
||||
var idx: number = rules.findIndex(1);
|
||||
}
|
||||
|
||||
function test_htmlParser_fragment() {
|
||||
var frag: CKEDITOR.htmlParser.fragment = new CKEDITOR.htmlParser.fragment();
|
||||
|
||||
var node: CKEDITOR.htmlParser.node;
|
||||
frag.add(node);
|
||||
frag.add(node, 1);
|
||||
|
||||
var filter: CKEDITOR.htmlParser.filter;
|
||||
frag.filter(filter);
|
||||
frag.filterChildren(filter);
|
||||
frag.filterChildren(filter, true);
|
||||
frag.forEach((node: CKEDITOR.htmlParser.node) => console.log('node'));
|
||||
frag.forEach((node: CKEDITOR.htmlParser.node) => false, 1);
|
||||
frag.forEach((node: CKEDITOR.htmlParser.node) => false, 2, true);
|
||||
|
||||
frag.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
frag.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
|
||||
frag.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
frag.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter);
|
||||
|
||||
frag = CKEDITOR.htmlParser.fragment.fromBBCode('code');
|
||||
|
||||
var fragOrEl: CKEDITOR.htmlParser.fragment | CKEDITOR.htmlParser.element = CKEDITOR.htmlParser.fragment.fromHtml('html');
|
||||
fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', 'parent');
|
||||
fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', 'parent', 'fix');
|
||||
fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', new CKEDITOR.htmlParser.element('name', null), true);
|
||||
}
|
||||
|
||||
function test_htmlParser_node() {
|
||||
var node: CKEDITOR.htmlParser.node = new CKEDITOR.htmlParser.node();
|
||||
|
||||
var el: CKEDITOR.htmlParser.element = node.getAscendant('condition');
|
||||
el = node.getAscendant({ 'id': '1234' });
|
||||
el = node.getAscendant((node: CKEDITOR.htmlParser.element) => false);
|
||||
|
||||
var idx: number = node.getIndex();
|
||||
node.insertAfter(node);
|
||||
node.insertBefore(node);
|
||||
node.remove();
|
||||
node.replaceWith(node);
|
||||
el = node.wrapWith(el);
|
||||
|
||||
}
|
||||
|
||||
function test_htmlParser_text() {
|
||||
var text: CKEDITOR.htmlParser.text = new CKEDITOR.htmlParser.text('text');
|
||||
var filtered: boolean = text.filter(new CKEDITOR.htmlParser.filter());
|
||||
text.writeHtml(new CKEDITOR.htmlParser.basicWriter());
|
||||
text.writeHtml(new CKEDITOR.htmlParser.basicWriter(), new CKEDITOR.htmlParser.filter());
|
||||
}
|
||||
|
||||
function test_htmlWriter() {
|
||||
var writer = new CKEDITOR.htmlWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
|
||||
writer.indentationChars = '\t';
|
||||
writer.lineBreakChars = '\r\n';
|
||||
writer.selfClosingEnd = '>';
|
||||
writer.indentation();
|
||||
writer.lineBreak();
|
||||
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
|
||||
}
|
||||
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
}, CKEDITOR.NODE_ELEMENT, true);
|
||||
}
|
||||
|
||||
function test_keystrokeHandler() {
|
||||
var handler: CKEDITOR.keystrokeHandler = new CKEDITOR.keystrokeHandler(CKEDITOR.instances[0]);
|
||||
handler.attach(new CKEDITOR.dom.domObject(document.body));
|
||||
}
|
||||
|
||||
function test_lang() {
|
||||
var lang: string = CKEDITOR.lang.detect('en');
|
||||
lang = CKEDITOR.lang.detect('zh', 'sw');
|
||||
|
||||
CKEDITOR.lang.load('tk', 'pr', (code: string, entries: any) => console.log('loaded'));
|
||||
}
|
||||
|
||||
function test_loader() {
|
||||
CKEDITOR.loader.load('script');
|
||||
CKEDITOR.loader.load('script', true);
|
||||
|
||||
CKEDITOR.loader.loadPending();
|
||||
}
|
||||
|
||||
function test_menu() {
|
||||
var menu: CKEDITOR.menu = new CKEDITOR.menu();
|
||||
|
||||
menu.add({ anything: true });
|
||||
menu.addListener((startElement: CKEDITOR.dom.element, selection: CKEDITOR.dom.selection, path: CKEDITOR.dom.elementPath) => 'return');
|
||||
var { item, element } = menu.findItemByCommandName('command');
|
||||
menu.hide();
|
||||
menu.hide(false);
|
||||
menu.removeAll();
|
||||
menu.show(new CKEDITOR.dom.element('div'));
|
||||
menu.show(new CKEDITOR.dom.element('div'), 1);
|
||||
menu.show(new CKEDITOR.dom.element('div'), 1, 2);
|
||||
menu.show(new CKEDITOR.dom.element('div'), 1, 2, 3);
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
|
||||
console.log(CKEDITOR.plugins.registered['abbr']);
|
||||
}
|
||||
|
||||
function test_resourceManager() {
|
||||
var manager: CKEDITOR.resourceManager = new CKEDITOR.resourceManager('path', 'name');
|
||||
|
||||
manager.add('name');
|
||||
manager.add('name', { hidpi: true });
|
||||
manager.addExternal('names', 'path');
|
||||
manager.addExternal('names', 'path', 'name');
|
||||
|
||||
var def: CKEDITOR.pluginDefinition = manager.get('name');
|
||||
var path: string = manager.getFilePath('path');
|
||||
path = manager.getPath('path');
|
||||
|
||||
manager.load('name', (loaded: string[]) => console.log('hey'));
|
||||
manager.load([ 'name' ], (loaded: string[]) => console.log('hey'), manager);
|
||||
}
|
||||
|
||||
function test_scriptLoader() {
|
||||
CKEDITOR.scriptLoader.load('url', (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'));
|
||||
CKEDITOR.scriptLoader.load([ 'url' ], (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'), null);
|
||||
CKEDITOR.scriptLoader.load([ 'url' ], (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'), null, true);
|
||||
CKEDITOR.scriptLoader.queue('url', (succeeded: boolean) => console.log('loaded'));
|
||||
}
|
||||
|
||||
function test_skin() {
|
||||
CKEDITOR.skin.addIcon('name', 'path');
|
||||
CKEDITOR.skin.addIcon('name', 'path', 1);
|
||||
CKEDITOR.skin.addIcon('name', 'path', 1, 'small');
|
||||
|
||||
CKEDITOR.skin.chameleon('editor', 'part');
|
||||
|
||||
var style: any = CKEDITOR.skin.getIconStyle('name');
|
||||
style = CKEDITOR.skin.getIconStyle('name', true);
|
||||
style = CKEDITOR.skin.getIconStyle('name', true, 1);
|
||||
style = CKEDITOR.skin.getIconStyle('name', true, 1, 'large');
|
||||
|
||||
var path: any = CKEDITOR.skin.getPath('part');
|
||||
|
||||
CKEDITOR.skin.loadPart('part', () => console.log('load'));
|
||||
|
||||
var path2: string = CKEDITOR.skin.path();
|
||||
}
|
||||
|
||||
function test_style() {
|
||||
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { 'key': 'value '});
|
||||
style.apply(CKEDITOR.instances[0]);
|
||||
|
||||
var el: CKEDITOR.dom.element;
|
||||
style.applyToObject(el, CKEDITOR.instances[0]);
|
||||
|
||||
var range: CKEDITOR.dom.range;
|
||||
style.applyToRange(range, CKEDITOR.instances[0]);
|
||||
|
||||
var str: string = style.buildPreview();
|
||||
str = style.buildPreview('label');
|
||||
|
||||
var path: CKEDITOR.dom.elementPath;
|
||||
var bool: boolean = style.checkActive(path, CKEDITOR.instances[0]);
|
||||
|
||||
var filter: CKEDITOR.filter;
|
||||
bool = style.checkApplicable(path, CKEDITOR.instances[0], filter);
|
||||
|
||||
bool = style.checkElementMatch(el, true, CKEDITOR.instances[0]);
|
||||
bool = style.checkElementRemovable(el, false, CKEDITOR.instances[0]);
|
||||
|
||||
var def: CKEDITOR.style.definition = style.getDefintion();
|
||||
style.remove(CKEDITOR.instances[0]);
|
||||
style.removeFromRange(range, CKEDITOR.instances[0]);
|
||||
|
||||
var rules: CKEDITOR.filter.allowedContentRules;
|
||||
rules = style.toAllowedContentRules();
|
||||
rules = style.toAllowedContentRules(CKEDITOR.instances[0]);
|
||||
}
|
||||
|
||||
function test_adding_command_and_buttons() {
|
||||
@@ -320,47 +977,6 @@ function test_adding_command_and_buttons() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_path() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_definition() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
onLoad: () => {},
|
||||
onOk: () => {},
|
||||
onCancel: () => {},
|
||||
onShow: () => {},
|
||||
onHide: () => {},
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
|
||||
console.log(CKEDITOR.plugins.registered['abbr']);
|
||||
}
|
||||
|
||||
function test_adding_widget() {
|
||||
function wrapper(editor: CKEDITOR.editor) {
|
||||
editor.widgets.add("widgetty", {
|
||||
@@ -374,52 +990,6 @@ function test_adding_widget() {
|
||||
}
|
||||
}
|
||||
|
||||
function test_focusManager() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
var element = CKEDITOR.document.getById('myElement');
|
||||
|
||||
instance.focusManager.focus();
|
||||
instance.focusManager.focus(element);
|
||||
instance.focusManager.lock();
|
||||
instance.focusManager.unlock();
|
||||
instance.focusManager.blur();
|
||||
instance.focusManager.blur(true);
|
||||
instance.focusManager.add(element, true);
|
||||
instance.focusManager.remove(element);
|
||||
|
||||
var focusManager = new CKEDITOR.focusManager(instance);
|
||||
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
function test_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
}
|
||||
|
||||
function test_htmlWriter() {
|
||||
var writer = new CKEDITOR.htmlWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
|
||||
writer.indentationChars = '\t';
|
||||
writer.lineBreakChars = '\r\n';
|
||||
writer.selfClosingEnd = '>';
|
||||
writer.indentation();
|
||||
writer.lineBreak();
|
||||
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
|
||||
}
|
||||
|
||||
function test_sharedSpace() {
|
||||
CKEDITOR.inline('content', {
|
||||
removePlugins: 'maximize,resize',
|
||||
@@ -558,7 +1128,7 @@ function test_selection() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var testNode = CKEDITOR.document.getById('myElement');
|
||||
|
||||
var selection = editor.getSelection();
|
||||
var selection = editor.getSelection(true);
|
||||
var ranges = selection.getRanges();
|
||||
for (var i = 0, c = ranges.length; i < c; i++) {
|
||||
var range = ranges[i];
|
||||
@@ -570,31 +1140,75 @@ function test_selection() {
|
||||
}
|
||||
|
||||
function test_tools() {
|
||||
var obj = { key: 'value' };
|
||||
var obj: { [key: string]: any } = { key: 'value' };
|
||||
|
||||
CKEDITOR.tools.addFunction(console.log);
|
||||
CKEDITOR.tools.addFunction(console.log, obj);
|
||||
var bool = CKEDITOR.tools.arrayCompare([ 1 ], [ 2, 3 ]);
|
||||
CKEDITOR.tools.clone(obj);
|
||||
CKEDITOR.tools.copy(obj);
|
||||
CKEDITOR.tools.prototypedCopy(obj);
|
||||
|
||||
obj = CKEDITOR.tools.createClass(obj);
|
||||
var str = CKEDITOR.tools.cssStyleToDomStyle('style');
|
||||
var prefixes: { [cssClass: string]: string | number } = CKEDITOR.tools.cssVendorPrefix('prop', 'val');
|
||||
prefixes = CKEDITOR.tools.cssVendorPrefix('prop', 'val', true);
|
||||
var fn: (param: any) => boolean
|
||||
fn = CKEDITOR.tools.defer<(param: any) => boolean>(fn);
|
||||
CKEDITOR.tools.enableHtml5Elements(document);
|
||||
CKEDITOR.tools.enableHtml5Elements(document.createDocumentFragment(), true);
|
||||
str = CKEDITOR.tools.escapeCss('css');
|
||||
var { input, reset } = CKEDITOR.tools.eventsBuffer(1, console.log, obj);
|
||||
obj = CKEDITOR.tools.extend(obj, obj, true, obj);
|
||||
bool = CKEDITOR.tools.fixDomain();
|
||||
str = CKEDITOR.tools.genKey(str);
|
||||
str = CKEDITOR.tools.getCookie(str);
|
||||
str = CKEDITOR.tools.getCsrfToken();
|
||||
var numb: number = CKEDITOR.tools.getIndex<string>(['string', 'array'], (element: string) => false);
|
||||
bool = CKEDITOR.tools.getMouseButton(new CKEDITOR.dom.event(document.createEvent(null)));
|
||||
str = CKEDITOR.tools.getNextId();
|
||||
numb = CKEDITOR.tools.getNextNumber();
|
||||
str = CKEDITOR.tools.getUniqueId();
|
||||
str = CKEDITOR.tools.htmlDecode(str);
|
||||
str = CKEDITOR.tools.htmlDecodeAttr(str);
|
||||
str = CKEDITOR.tools.htmlEncode(str);
|
||||
str = CKEDITOR.tools.htmlEncodeAttr(str);
|
||||
numb = CKEDITOR.tools.indexOf<string>(['string', 'array'], 'string');
|
||||
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
|
||||
console.log(CKEDITOR.tools.isArray([1])); // true
|
||||
console.log(CKEDITOR.tools.isArray(obj)); // false
|
||||
console.log(CKEDITOR.tools.isArray(null)); // false
|
||||
console.log(CKEDITOR.tools.isArray(undefined)); // false
|
||||
|
||||
bool = CKEDITOR.tools.isEmpty(obj);
|
||||
var ret1: { display: string[], aria: string[] } = CKEDITOR.tools.keystrokeToArray(obj, 1);
|
||||
var ret2: { display: string, aria: string } = CKEDITOR.tools.keystrokeToString(obj, 1);
|
||||
str = CKEDITOR.tools.ltrim(str);
|
||||
str = CKEDITOR.tools.normalizeCssText(str, bool);
|
||||
str = CKEDITOR.tools.normalizeHex(str);
|
||||
bool = CKEDITOR.tools.objectCompare(obj, obj);
|
||||
bool = CKEDITOR.tools.objectCompare(obj, obj, true);
|
||||
var strArr: string[] = CKEDITOR.tools.objectKeys(obj);
|
||||
CKEDITOR.tools.override(parseInt, function(_parseInt) {
|
||||
return function(value: any, radix?: number) {
|
||||
return _parseInt(value, radix);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
}, CKEDITOR.NODE_ELEMENT, true);
|
||||
obj = CKEDITOR.tools.parseCssText(str);
|
||||
obj = CKEDITOR.tools.parseCssText(str, bool);
|
||||
obj = CKEDITOR.tools.parseCssText(str, bool, bool);
|
||||
obj = CKEDITOR.tools.prototypedCopy(obj);
|
||||
CKEDITOR.tools.removeFunction(1);
|
||||
str = CKEDITOR.tools.repeat(str, 40);
|
||||
str = CKEDITOR.tools.rtrim(str);
|
||||
str = CKEDITOR.tools.search<string>(strArr, 'string');
|
||||
str = CKEDITOR.tools.search<string>(strArr, (el: string) => true);
|
||||
CKEDITOR.tools.setCookie('name', 'value');
|
||||
numb = CKEDITOR.tools.setTimeout(console.log);
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000);
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj);
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj, 'timeout');
|
||||
numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj, 'timeout', window);
|
||||
str = CKEDITOR.tools.transformPlainTextToHtml(str, 1);
|
||||
str = CKEDITOR.tools.trim(str);
|
||||
CKEDITOR.tools.tryThese([ console.log, console.warn ]);
|
||||
str = CKEDITOR.tools.writeCssText(obj);
|
||||
str = CKEDITOR.tools.writeCssText(obj, true);
|
||||
}
|
||||
|
||||
Vendored
+2090
-1269
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,600 @@
|
||||
|
||||
|
||||
function test_CKEDITOR() {
|
||||
CKEDITOR.basePath = 'test';
|
||||
CKEDITOR.replaceClass = 'rich_editor';
|
||||
CKEDITOR.skinName = 'moono';
|
||||
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
|
||||
var editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
|
||||
alert(CKEDITOR.basePath);
|
||||
if (CKEDITOR.currentInstance)
|
||||
alert(CKEDITOR.currentInstance.name);
|
||||
alert(CKEDITOR.document.getBody().getName());
|
||||
alert(CKEDITOR.instances[0].name);
|
||||
CKEDITOR.loadFullCoreTimeout = 5;
|
||||
alert(CKEDITOR.revision);
|
||||
alert(CKEDITOR.rnd);
|
||||
if (CKEDITOR.status == 'loaded') {
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
alert(CKEDITOR.timestamp);
|
||||
CKEDITOR.addCss('.cke_editable h1,.cke_editable h2,.cke_editable h3 { border-bottom: 1px dotted red }');
|
||||
CKEDITOR.appendTo('editorSpace');
|
||||
alert(CKEDITOR.getUrl('skins/default/editor.css'));
|
||||
alert(CKEDITOR.getUrl('/skins/default/editor.css'));
|
||||
alert(CKEDITOR.getUrl('http://www.somesite.com/skins/default/editor.css'));
|
||||
CKEDITOR.inline('content');
|
||||
if (CKEDITOR.loadFullCore)
|
||||
CKEDITOR.loadFullCore();
|
||||
CKEDITOR.replace('myfield');
|
||||
var textarea = document.createElement('textarea');
|
||||
CKEDITOR.replace(textarea);
|
||||
CKEDITOR.replaceAll();
|
||||
CKEDITOR.replaceAll('myClassName');
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
}
|
||||
|
||||
function test_CKEDITOR_events() {
|
||||
CKEDITOR.on('instanceCreated', function(event) {
|
||||
// $ExpectType editor
|
||||
event.editor;
|
||||
});
|
||||
}
|
||||
|
||||
function test_config() {
|
||||
var config1: CKEDITOR.config = {
|
||||
toolbar: 'basic',
|
||||
};
|
||||
var config2: CKEDITOR.config = {
|
||||
toolbar: [
|
||||
[ 'mode', 'document', 'doctools' ],
|
||||
[ 'clipboard', 'undo' ],
|
||||
'/',
|
||||
[ 'find', 'selection', 'spellchecker' ],
|
||||
[ 'basicstyles', 'cleanup' ],
|
||||
'/',
|
||||
[ 'list', 'indent', 'blocks', 'align', 'bidi' ],
|
||||
],
|
||||
};
|
||||
var config3: CKEDITOR.config = {
|
||||
toolbarGroups: [
|
||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
|
||||
{ name: 'links', groups: [ 'links' ] },
|
||||
{ name: 'insert', groups: [ 'insert' ] },
|
||||
{ name: 'tools', groups: [ 'tools' ] },
|
||||
{ name: 'document', groups: [ 'mode' ] },
|
||||
{ name: 'about', groups: [ 'about' ] },
|
||||
'/',
|
||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
||||
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'paragraph' ] },
|
||||
'/',
|
||||
{ name: 'styles', groups: [ 'styles' ] },
|
||||
{ name: 'colors', groups: [ 'colors' ] },
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
function test_dom_comment() {
|
||||
var type = CKEDITOR.NODE_COMMENT;
|
||||
var nativeNode = document.createComment('Example');
|
||||
var comment = new CKEDITOR.dom.comment(nativeNode);
|
||||
var comment2 = new CKEDITOR.dom.comment('Example');
|
||||
}
|
||||
|
||||
function test_dom_document() {
|
||||
var document = new CKEDITOR.dom.document(window.document);
|
||||
var type = CKEDITOR.NODE_DOCUMENT;
|
||||
CKEDITOR.document.appendStyleSheet('/mystyles.css');
|
||||
var element = CKEDITOR.document.getBody();
|
||||
alert(element.getName());
|
||||
var element2 = CKEDITOR.document.getById('myElement');
|
||||
alert(element.getId());
|
||||
var element3 = CKEDITOR.document.getHead();
|
||||
alert(element.getName());
|
||||
var selection = CKEDITOR.instances[0].document.getSelection();
|
||||
alert(selection.getType());
|
||||
document.write(
|
||||
'<html>' +
|
||||
'<head><title>Sample Doc</title></head>' +
|
||||
'<body>Document contents created by code</body>' +
|
||||
'</html>'
|
||||
);
|
||||
}
|
||||
|
||||
function test_dom_documentFragment() {
|
||||
var type = CKEDITOR.NODE_DOCUMENT_FRAGMENT;
|
||||
}
|
||||
|
||||
function test_dom_domObject() {
|
||||
var element = new CKEDITOR.dom.element('span');
|
||||
alert(element.$.nodeType);
|
||||
var nativeElement = element.$;
|
||||
var doc = new CKEDITOR.dom.document(document);
|
||||
alert(doc.equals(CKEDITOR.document));
|
||||
alert(doc == CKEDITOR.document);
|
||||
var element2 = new CKEDITOR.dom.element('span');
|
||||
alert(element.getCustomData('hasCustomData'));
|
||||
alert(element.getCustomData('nonExistingKey'));
|
||||
var elementA = new CKEDITOR.dom.element(nativeElement);
|
||||
elementA.getPrivate().value = 1;
|
||||
var elementB = new CKEDITOR.dom.element(nativeElement).getPrivate().value;
|
||||
var element3 = new CKEDITOR.dom.element('span');
|
||||
element.setCustomData('hasCustomData', true);
|
||||
}
|
||||
|
||||
function test_dom_element() {
|
||||
var element = new CKEDITOR.dom.element('span');
|
||||
alert(element.$.nodeType);
|
||||
element.addClass('classA');
|
||||
element.addClass('classB');
|
||||
element.addClass('classA');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
p.append(strong);
|
||||
var em = p.append('em');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
p.appendText('This is');
|
||||
p.appendText(' some text');
|
||||
element.breakParent(strong);
|
||||
element.data('extra-info', 'test');
|
||||
alert(element.data('extra-info'));
|
||||
element.data('extra-info', false);
|
||||
var element5 = CKEDITOR.document.getById('myTextarea');
|
||||
element.focus();
|
||||
element.focusNext();
|
||||
element.focusPrevious();
|
||||
element.forEach(node=> {
|
||||
console.log(node);
|
||||
});
|
||||
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
|
||||
alert(element.getAttribute('type'));
|
||||
alert(element.getComputedStyle('display'));
|
||||
element.appendTo(CKEDITOR.document.getBody());
|
||||
alert(element.getEditor().name);
|
||||
var first = element.getFirst();
|
||||
alert(element.getHtml());
|
||||
alert(element.getId());
|
||||
alert(element.getName());
|
||||
alert('<b>' + element.getNameAtt() + '</b>');
|
||||
alert(element.getOuterHtml());
|
||||
alert(element.getTabIndex());
|
||||
alert(element.getText());
|
||||
alert(element.hasAttributes());
|
||||
alert(element.hasAttributes());
|
||||
element.hide();
|
||||
alert(element.is('span'));
|
||||
alert(element.is('p', 'span'));
|
||||
alert(element.is('p'));
|
||||
alert(element.is('p', 'div'));
|
||||
alert(element.is({ p: 1, span: 1 }));
|
||||
element.removeAttribute('class');
|
||||
element.addClass('classA');
|
||||
element.addClass('classB');
|
||||
element.removeClass('classA');
|
||||
element.removeClass('classB');
|
||||
element.removeStyle('display');
|
||||
element.setAttribute('class', 'myClass');
|
||||
element.setAttribute('title', 'This is an example');
|
||||
element.setAttributes({
|
||||
'class': 'myClass',
|
||||
title: 'This is an example'
|
||||
});
|
||||
p.setHtml('<b>Inner</b> HTML');
|
||||
element.setOpacity(0.75);
|
||||
element.setStyle('background-color', '#ff0000');
|
||||
element.setStyle('margin-top', '10px');
|
||||
element.setStyle('float', 'right');
|
||||
element.setStyles({
|
||||
position: 'absolute',
|
||||
float: 'right'
|
||||
});
|
||||
element.setText('A > B & C < D');
|
||||
element.show();
|
||||
element.unselectable();
|
||||
alert(element.getName());
|
||||
alert(element == CKEDITOR.dom.element.get(element));
|
||||
var htmlElement = document.getElementById('myElement');
|
||||
alert(CKEDITOR.dom.element.get(htmlElement).getName());
|
||||
}
|
||||
|
||||
function test_dom_event() {
|
||||
var event = new CKEDITOR.dom.event(new Event(""));
|
||||
alert(event.getKey());
|
||||
alert(event.getKeystroke() == 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
|
||||
var element = new CKEDITOR.dom.element('div');
|
||||
element.on('mousemouse', ev=> {
|
||||
var pageOffset = ev.data.getPageOffset();
|
||||
alert(pageOffset.x);
|
||||
alert(pageOffset.y);
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
var domEvent = ev.data;
|
||||
domEvent.getTarget().addClass('clicked');
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
var domEvent = ev.data as CKEDITOR.dom.event;
|
||||
domEvent.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
function test_dom_iterator() {
|
||||
var range = new CKEDITOR.dom.range(new CKEDITOR.dom.element('div'));
|
||||
var iterator = range.createIterator();
|
||||
iterator.getNextParagraph();
|
||||
iterator.getNextParagraph();
|
||||
}
|
||||
|
||||
function test_dom_node() {
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
strong.appendTo(p);
|
||||
var node = new CKEDITOR.dom.node(new Node());
|
||||
node = node.getAscendant('b');
|
||||
node = node.getAscendant('b', true);
|
||||
var element = CKEDITOR.document.getById('example');
|
||||
alert(element.getDocument().equals(CKEDITOR.document));
|
||||
element.getIndex();
|
||||
element.getIndex(true);
|
||||
var last = element.getFirst().getNext();
|
||||
var parent = node.getParent();
|
||||
alert(parent.getName());
|
||||
var parents = node.getParents();
|
||||
var em = new CKEDITOR.dom.element('em');
|
||||
strong.insertAfter(em);
|
||||
strong.insertBefore(em);
|
||||
strong.insertBeforeMe(em);
|
||||
element.isReadOnly();
|
||||
}
|
||||
|
||||
function test_dom_nodeList() {
|
||||
var nodeList = CKEDITOR.document.getBody().getChildren();
|
||||
alert(nodeList.count());
|
||||
}
|
||||
|
||||
function test_dom_range() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var range = new CKEDITOR.dom.range(editor.document);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
range.deleteContents();
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.collapsed);
|
||||
range.collapse();
|
||||
alert(range.collapsed);
|
||||
range.selectNodeContents(range.document.getBody());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endContainer.getName());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.endOffset);
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startContainer.getName());
|
||||
range.selectNodeContents(editor.document.getBody());
|
||||
alert(range.startOffset);
|
||||
}
|
||||
|
||||
function test_dom_text() {
|
||||
var nativeNode = document.createTextNode('Example');
|
||||
var text = new CKEDITOR.dom.text(nativeNode);
|
||||
var text2 = new CKEDITOR.dom.text('Example');
|
||||
}
|
||||
|
||||
function test_dom_window() {
|
||||
var document = new CKEDITOR.dom.window(window);
|
||||
var win = new CKEDITOR.dom.window(window);
|
||||
var pos = win.getScrollPosition();
|
||||
alert(pos.x);
|
||||
alert(pos.y);
|
||||
var size = win.getViewPaneSize();
|
||||
alert(size.width);
|
||||
alert(size.height);
|
||||
}
|
||||
|
||||
function test_adding_command_and_buttons() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
|
||||
instance.addCommand( 'aCommand', {
|
||||
exec: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'firstButton', {
|
||||
icon: 'http://www.example.com/assets/images/icons.png',
|
||||
iconOffset: -32,
|
||||
label: 'Label 1',
|
||||
command: 'aCommand',
|
||||
toolbar: 'tools'
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'secondButton', {
|
||||
label: 'Label 2',
|
||||
command: 'aCommand',
|
||||
toolbar: 'tools'
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_path() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_definition() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
onLoad: () => {},
|
||||
onOk: () => {},
|
||||
onCancel: () => {},
|
||||
onShow: () => {},
|
||||
onHide: () => {},
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
|
||||
console.log(CKEDITOR.plugins.registered['abbr']);
|
||||
}
|
||||
|
||||
function test_adding_widget() {
|
||||
function wrapper(editor: CKEDITOR.editor) {
|
||||
editor.widgets.add("widgetty", {
|
||||
button: "Activate widgetty",
|
||||
template: "<imaginary-element>",
|
||||
dialog: "widgetty",
|
||||
init: function() {
|
||||
// no logic
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function test_focusManager() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
var element = CKEDITOR.document.getById('myElement');
|
||||
|
||||
instance.focusManager.focus();
|
||||
instance.focusManager.focus(element);
|
||||
instance.focusManager.lock();
|
||||
instance.focusManager.unlock();
|
||||
instance.focusManager.blur();
|
||||
instance.focusManager.blur(true);
|
||||
instance.focusManager.add(element, true);
|
||||
instance.focusManager.remove(element);
|
||||
|
||||
var focusManager = new CKEDITOR.focusManager(instance);
|
||||
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
function test_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
}
|
||||
|
||||
function test_htmlWriter() {
|
||||
var writer = new CKEDITOR.htmlWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
|
||||
writer.indentationChars = '\t';
|
||||
writer.lineBreakChars = '\r\n';
|
||||
writer.selfClosingEnd = '>';
|
||||
writer.indentation();
|
||||
writer.lineBreak();
|
||||
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
|
||||
}
|
||||
|
||||
function test_sharedSpace() {
|
||||
CKEDITOR.inline('content', {
|
||||
removePlugins: 'maximize,resize',
|
||||
sharedSpaces: {
|
||||
top: 'someElementId',
|
||||
bottom: document.getElementById('anotherId')
|
||||
}
|
||||
});
|
||||
|
||||
CKEDITOR.inline('content', {
|
||||
sharedSpaces: { }
|
||||
});
|
||||
}
|
||||
|
||||
function test_specifying_editor_path() {
|
||||
window.CKEDITOR_BASEPATH = '/ckeditor/';
|
||||
}
|
||||
|
||||
function test_editor_instance_event() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea, {
|
||||
on: {
|
||||
activeEnterModeChange: function() {},
|
||||
activeFilterChange: function() {},
|
||||
afterCommandExec: function() {},
|
||||
afterInsertHtml: function() {},
|
||||
afterPaste: function() {},
|
||||
afterPasteFromWord: function() {},
|
||||
afterSetData: function() {},
|
||||
afterUndoImage: function() {},
|
||||
ariaEditorHelpLabel: function() {},
|
||||
ariaWidget: function() {},
|
||||
autogrow: function() {},
|
||||
beforeCommandExec: function() {},
|
||||
beforeDestroy: function() {},
|
||||
beforeModeUnload: function() {},
|
||||
beforeSetMode: function() {},
|
||||
beforeUndoImage: function() {},
|
||||
blur: function() {},
|
||||
change: function() {},
|
||||
configLoaded: function() {},
|
||||
contentDirChanged: function() {},
|
||||
contentDom: function() {},
|
||||
contentDomInvalidated: function() {},
|
||||
contentDomUnload: function() {},
|
||||
customConfigLoaded: function() {},
|
||||
dataFiltered: function() {},
|
||||
dataReady: function() {},
|
||||
destroy: function() {},
|
||||
dialogHide: function() {},
|
||||
dialogShow: function() {},
|
||||
dirChanged: function() {},
|
||||
doubleclick: function() {},
|
||||
dragend: function() {},
|
||||
dragstart: function() {},
|
||||
drop: function() {},
|
||||
elementsPathUpdate: function() {},
|
||||
fileUploadRequest: function() {},
|
||||
fileUploadResponse: function() {},
|
||||
floatingSpaceLayout: function() {},
|
||||
focus: function() {},
|
||||
getData: function() {},
|
||||
getSnapshot: function() {},
|
||||
insertElement: function() {},
|
||||
insertHtml: function() {},
|
||||
insertText: function() {},
|
||||
instanceReady: function() {},
|
||||
key: function() {},
|
||||
langLoaded: function() {},
|
||||
loadSnapshot: function() {},
|
||||
loaded: function() {},
|
||||
lockSnapshot: function() {},
|
||||
maximize: function() {},
|
||||
menuShow: function() {},
|
||||
mode: function() {},
|
||||
notificationHide: function() {},
|
||||
notificationShow: function() {},
|
||||
notificationUpdate: function() {},
|
||||
paste: function() {},
|
||||
pasteFromWord: function() {},
|
||||
pluginsLoaded: function() {},
|
||||
readOnly: function() {},
|
||||
removeFormatCleanup: function() {},
|
||||
required: function() {},
|
||||
resize: function() {},
|
||||
save: function() {},
|
||||
saveSnapshot: function() {},
|
||||
selectionChange: function() {},
|
||||
setData: function() {},
|
||||
stylesSet: function() {},
|
||||
template: function() {},
|
||||
toDataFormat: function() {},
|
||||
toHtml: function() {},
|
||||
unlockSnapshot: function() {},
|
||||
updateSnapshot: function() {},
|
||||
widgetDefinition: function() {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_dtd() {
|
||||
var brConsideredEmptyTag = CKEDITOR.dtd.$empty['br'];
|
||||
var spanCanContainText = CKEDITOR.dtd['span']['#'];
|
||||
var divCanContainSpan = CKEDITOR.dtd['div']['span'];
|
||||
}
|
||||
|
||||
function test_getSelectedHtml() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var editor = CKEDITOR.replace(textarea);
|
||||
|
||||
// $ExpectType documentFragment
|
||||
var sel1 = editor.getSelectedHtml();
|
||||
console.log(sel1);
|
||||
|
||||
// $ExpectType documentFragment
|
||||
var sel2 = editor.getSelectedHtml(false);
|
||||
console.log(sel2);
|
||||
|
||||
// $ExpectType string
|
||||
var sel3 = editor.getSelectedHtml(true);
|
||||
console.log(sel3);
|
||||
|
||||
// $ExpectType string | documentFragment
|
||||
var sel4 = editor.getSelectedHtml(Math.random() > 0.5);
|
||||
console.log(sel4);
|
||||
}
|
||||
|
||||
function test_element() {
|
||||
var el = CKEDITOR.document.getById('myElement');
|
||||
el.addClass('class');
|
||||
console.log(el.hasClass('class'));
|
||||
el.removeClass('class');
|
||||
}
|
||||
|
||||
function test_selection() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var testNode = CKEDITOR.document.getById('myElement');
|
||||
|
||||
var selection = editor.getSelection();
|
||||
var ranges = selection.getRanges();
|
||||
for (var i = 0, c = ranges.length; i < c; i++) {
|
||||
var range = ranges[i];
|
||||
range.setStartBefore(testNode);
|
||||
range.setStartAfter(testNode);
|
||||
range.setEndBefore(testNode);
|
||||
range.setEndAfter(testNode);
|
||||
}
|
||||
}
|
||||
|
||||
function test_tools() {
|
||||
var obj = { key: 'value' };
|
||||
CKEDITOR.tools.clone(obj);
|
||||
CKEDITOR.tools.copy(obj);
|
||||
CKEDITOR.tools.prototypedCopy(obj);
|
||||
|
||||
console.log(CKEDITOR.tools.isArray([1])); // true
|
||||
console.log(CKEDITOR.tools.isArray(obj)); // false
|
||||
console.log(CKEDITOR.tools.isArray(null)); // false
|
||||
console.log(CKEDITOR.tools.isArray(undefined)); // false
|
||||
|
||||
CKEDITOR.tools.override(parseInt, function(_parseInt) {
|
||||
return function(value: any, radix?: number) {
|
||||
return _parseInt(value, radix);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
}, CKEDITOR.NODE_ELEMENT, true);
|
||||
}
|
||||
Vendored
+1949
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"ckeditor": [
|
||||
"ckeditor/v2"
|
||||
],
|
||||
"ckeditor/*": [
|
||||
"ckeditor/v2/*"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ckeditor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -38,3 +38,6 @@ const className = cx('foo', ['bar'], { baz: true }); // => "abc def xyz"
|
||||
|
||||
// falsey values are just ignored
|
||||
cx(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
|
||||
|
||||
// true is just ignored
|
||||
cx(true || "foo");
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false;
|
||||
type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean;
|
||||
|
||||
interface ClassDictionary {
|
||||
[id: string]: boolean | undefined | null;
|
||||
|
||||
Vendored
+11
@@ -18,8 +18,14 @@ declare namespace CodeMirror {
|
||||
|
||||
function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea;
|
||||
|
||||
/** It contains a string that indicates the version of the library. This is a triple of integers "major.minor.patch",
|
||||
where patch is zero for releases, and something else (usually one) for dev snapshots. */
|
||||
var version: string;
|
||||
|
||||
/** An object containing default values for all options.
|
||||
You can assign to its properties to modify defaults (though this won't affect editors that have already been created). */
|
||||
var defaults: any;
|
||||
|
||||
/** If you want to define extra methods in terms of the CodeMirror API, it is possible to use defineExtension.
|
||||
This will cause the given value(usually a method) to be added to all CodeMirror instances created from then on. */
|
||||
function defineExtension(name: string, value: any): void;
|
||||
@@ -315,6 +321,11 @@ declare namespace CodeMirror {
|
||||
/** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */
|
||||
getTokenAt(pos: CodeMirror.Position, precise?: boolean): Token;
|
||||
|
||||
/** This is a (much) cheaper version of getTokenAt useful for when you just need the type of the token at a given position,
|
||||
and no other information. Will return null for unstyled tokens, and a string, potentially containing multiple
|
||||
space-separated style names, otherwise. */
|
||||
getTokenTypeAt(pos: CodeMirror.Position): string;
|
||||
|
||||
/** This is similar to getTokenAt, but collects all tokens for a given line into an array. */
|
||||
getLineTokens(line: number, precise?: boolean): Token[];
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import compareVersions = require('compare-versions');
|
||||
|
||||
compareVersions('1.0.0', '2.0.0');
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for compare-versions 3.0
|
||||
// Project: https://github.com/omichelsen/compare-versions
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function compareVersions(firstVersion: string, secondVersion: string): number;
|
||||
export = compareVersions;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "compare-versions-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+17
-17
@@ -1,4 +1,4 @@
|
||||
// Type definitions for core-js 0.9
|
||||
// Type definitions for core-js 2.5
|
||||
// Project: https://github.com/zloirock/core-js/
|
||||
// Definitions by: Ron Buckton <https://github.com/rbuckton>, Michel Felipe <https://github.com/mfdeveloper>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -755,8 +755,8 @@ declare namespace core {
|
||||
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
|
||||
startsWith(text: string, searchString: string, position?: number): boolean;
|
||||
at(text: string, index: number): string;
|
||||
lpad(text: string, length: number, fillStr?: string): string;
|
||||
rpad(text: string, length: number, fillStr?: string): string;
|
||||
padStart(text: string, length: number, fillStr?: string): string;
|
||||
padEnd(text: string, length: number, fillStr?: string): string;
|
||||
escapeHTML(text: string): string;
|
||||
unescapeHTML(text: string): string;
|
||||
};
|
||||
@@ -1454,9 +1454,13 @@ declare module "core-js/fn/string/includes" {
|
||||
const includes: typeof core.String.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/fn/string/lpad" {
|
||||
const lpad: typeof core.String.lpad;
|
||||
export = lpad;
|
||||
declare module "core-js/fn/string/pad-end" {
|
||||
const padEnd: typeof core.String.padEnd;
|
||||
export = padEnd;
|
||||
}
|
||||
declare module "core-js/fn/string/pad-start" {
|
||||
const padStart: typeof core.String.padStart;
|
||||
export = padStart;
|
||||
}
|
||||
declare module "core-js/fn/string/raw" {
|
||||
const raw: typeof core.String.raw;
|
||||
@@ -1466,10 +1470,6 @@ declare module "core-js/fn/string/repeat" {
|
||||
const repeat: typeof core.String.repeat;
|
||||
export = repeat;
|
||||
}
|
||||
declare module "core-js/fn/string/rpad" {
|
||||
const rpad: typeof core.String.rpad;
|
||||
export = rpad;
|
||||
}
|
||||
declare module "core-js/fn/string/starts-with" {
|
||||
const startsWith: typeof core.String.startsWith;
|
||||
export = startsWith;
|
||||
@@ -2273,9 +2273,13 @@ declare module "core-js/library/fn/string/includes" {
|
||||
const includes: typeof core.String.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/library/fn/string/lpad" {
|
||||
const lpad: typeof core.String.lpad;
|
||||
export = lpad;
|
||||
declare module "core-js/library/fn/string/pad-end" {
|
||||
const padEnd: typeof core.String.padEnd;
|
||||
export = padEnd;
|
||||
}
|
||||
declare module "core-js/library/fn/string/pad-start" {
|
||||
const padStart: typeof core.String.padStart;
|
||||
export = padStart;
|
||||
}
|
||||
declare module "core-js/library/fn/string/raw" {
|
||||
const raw: typeof core.String.raw;
|
||||
@@ -2285,10 +2289,6 @@ declare module "core-js/library/fn/string/repeat" {
|
||||
const repeat: typeof core.String.repeat;
|
||||
export = repeat;
|
||||
}
|
||||
declare module "core-js/library/fn/string/rpad" {
|
||||
const rpad: typeof core.String.rpad;
|
||||
export = rpad;
|
||||
}
|
||||
declare module "core-js/library/fn/string/starts-with" {
|
||||
const startsWith: typeof core.String.startsWith;
|
||||
export = startsWith;
|
||||
|
||||
Vendored
+43
-22
@@ -8,15 +8,27 @@ export as namespace CryptoJS;
|
||||
|
||||
declare var CryptoJS: CryptoJS.Hashes;
|
||||
declare namespace CryptoJS {
|
||||
interface Cipher {
|
||||
|
||||
interface Base {}
|
||||
|
||||
interface BufferedBlockAlgorithm extends Base {}
|
||||
|
||||
interface Hasher extends BufferedBlockAlgorithm {}
|
||||
|
||||
interface Cipher extends BufferedBlockAlgorithm {
|
||||
createEncryptor(secretPassphrase: string, option?: CipherOption): Encryptor;
|
||||
createDecryptor(secretPassphrase: string, option?: CipherOption): Decryptor;
|
||||
}
|
||||
|
||||
interface BlockCipher extends Cipher {}
|
||||
|
||||
interface StreamCipher extends Cipher {}
|
||||
|
||||
interface CipherHelper {
|
||||
encrypt(message: string, secretPassphrase: string | WordArray, option?: CipherOption): WordArray;
|
||||
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string | WordArray, option?: CipherOption): DecryptedMessage;
|
||||
}
|
||||
interface CipherAlgorythm {
|
||||
createEncryptor(secretPassphrase: string, option?: CipherOption): Encriptor;
|
||||
createDecryptor(secretPassphrase: string, option?: CipherOption): Decryptor;
|
||||
}
|
||||
interface Encriptor {
|
||||
interface Encryptor {
|
||||
process(messagePart: string): string;
|
||||
finalize(): string;
|
||||
}
|
||||
@@ -87,23 +99,32 @@ declare namespace CryptoJS {
|
||||
HmacRIPEMD160(message: string | LibWordArray, ...options: any[]): WordArray;
|
||||
PBKDF2(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray;
|
||||
PBKDF2(message: string | LibWordArray, ...options: any[]): WordArray;
|
||||
AES: Cipher;
|
||||
DES: Cipher;
|
||||
TripleDES: Cipher;
|
||||
RC4: Cipher;
|
||||
RC4Drop: Cipher;
|
||||
Rabbit: Cipher;
|
||||
RabbitLegacy: Cipher;
|
||||
EvpKDF: Cipher;
|
||||
AES: CipherHelper;
|
||||
DES: CipherHelper;
|
||||
TripleDES: CipherHelper;
|
||||
RC4: CipherHelper;
|
||||
RC4Drop: CipherHelper;
|
||||
Rabbit: CipherHelper;
|
||||
RabbitLegacy: CipherHelper;
|
||||
EvpKDF: CipherHelper;
|
||||
algo: {
|
||||
AES: CipherAlgorythm;
|
||||
DES: CipherAlgorythm;
|
||||
TrippleDES: CipherAlgorythm;
|
||||
RC4: CipherAlgorythm;
|
||||
RC4Drop: CipherAlgorythm;
|
||||
Rabbit: CipherAlgorythm;
|
||||
RabbitLegacy: CipherAlgorythm;
|
||||
EvpKDF: CipherAlgorythm;
|
||||
AES: BlockCipher;
|
||||
DES: BlockCipher;
|
||||
TripleDES: BlockCipher;
|
||||
RC4: StreamCipher;
|
||||
RC4Drop: StreamCipher;
|
||||
Rabbit: StreamCipher;
|
||||
RabbitLegacy: StreamCipher;
|
||||
EvpKDF: Base;
|
||||
HMAC: Base;
|
||||
PBKDF2: Base;
|
||||
SHA1: Hasher;
|
||||
SHA3: Hasher;
|
||||
SHA256: Hasher;
|
||||
SHA384: Hasher;
|
||||
SHA512: Hasher;
|
||||
MD5: Hasher;
|
||||
RIPEMD160: Hasher;
|
||||
};
|
||||
format: {
|
||||
OpenSSL: any;
|
||||
|
||||
@@ -80,3 +80,17 @@ cy.on('zoom', (event) => {
|
||||
cy.nodes('$node > node').style('opacity', 0);
|
||||
}
|
||||
});
|
||||
|
||||
cy.animate({
|
||||
fit: {
|
||||
padding: 10,
|
||||
eles: cy.nodes()
|
||||
},
|
||||
duration: 500
|
||||
});
|
||||
|
||||
const node = cy.nodes()[0];
|
||||
cy.animate({
|
||||
center: {eles: node},
|
||||
duration: 500
|
||||
});
|
||||
|
||||
Vendored
+1
-2
@@ -1127,8 +1127,7 @@ declare namespace cytoscape {
|
||||
/**
|
||||
* The output is a collection of node and edge elements OR single element.
|
||||
*/
|
||||
interface CollectionElements extends
|
||||
EdgeCollection, NodeCollection, SingularElement { }
|
||||
type CollectionElements = EdgeCollection | NodeCollection | SingularElement;
|
||||
|
||||
/**
|
||||
* edges -> Cy.EdgeCollection
|
||||
|
||||
@@ -48,6 +48,7 @@ cHSV = cHSV.darker();
|
||||
cHSV = cHSV.darker(0.2);
|
||||
displayable = cHSV.displayable();
|
||||
cString = cHSV.toString();
|
||||
cString = cHSV.hex();
|
||||
console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v);
|
||||
console.log('Opacity = %d', cHSV.opacity);
|
||||
|
||||
|
||||
Vendored
-6
@@ -68,12 +68,6 @@ export interface HSVColor extends Color {
|
||||
* Returns the RGB equivalent of this color.
|
||||
*/
|
||||
rgb(): RGBColor;
|
||||
|
||||
/**
|
||||
* Returns a hexadecimal string representing this color.
|
||||
* If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255.
|
||||
*/
|
||||
hex(): string;
|
||||
}
|
||||
|
||||
export const hsv: HSVColorFactory;
|
||||
|
||||
@@ -229,3 +229,16 @@ iString = d3Interpolate.interpolateCubehelixLong.gamma(2.2)('purple', 'orange');
|
||||
iNum = d3Interpolate.interpolateBasis([1, 50, 30, 10]);
|
||||
|
||||
iNum = d3Interpolate.interpolateBasisClosed([1, 50, 30, 10]);
|
||||
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateRgb.gamma(2.2), ['red', 'green', 'blue']);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateCubehelix, ['red', 'green', 'blue']);
|
||||
iZoom = d3Interpolate.piecewise(d3Interpolate.interpolateZoom, [[50, 50, 300], [100, 100, 500]]);
|
||||
iNum = d3Interpolate.piecewise(d3Interpolate.interpolateNumber, [1, 2, 3]);
|
||||
iNum = d3Interpolate.piecewise(d3Interpolate.interpolateRound, [1.1, 2.2, 3.3]);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateString, ['a', 'b', 'c']);
|
||||
iDate = d3Interpolate.piecewise(d3Interpolate.interpolateDate, [new Date(2018, 5, 1), new Date(2018, 5, 2), new Date(2018, 5, 3)]);
|
||||
iArrayNum = d3Interpolate.piecewise<number[]>(d3Interpolate.interpolateArray, [1, 2, 4, 8]);
|
||||
iArrayStr = d3Interpolate.piecewise<string[]>(d3Interpolate.interpolateArray, ['a', 'b', 'c', 'd']);
|
||||
iArrayMixed = d3Interpolate.piecewise<[Date, string]>(d3Interpolate.interpolateArray, [new Date(2016, 6, 1), 'b: 1']);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateTransformCss, ['rotate(0deg)', 'rotate(60deg)']);
|
||||
iString = d3Interpolate.piecewise(d3Interpolate.interpolateTransformSvg, ['rotate(0)', 'rotate(60)']);
|
||||
|
||||
Vendored
+9
-3
@@ -1,9 +1,9 @@
|
||||
// Type definitions for D3JS d3-interpolate module 1.1
|
||||
// Type definitions for D3JS d3-interpolate module 1.2
|
||||
// Project: https://github.com/d3/d3-interpolate/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.1.1
|
||||
// Last module patch version validated against: 1.2.0
|
||||
|
||||
import { ColorCommonInstance } from 'd3-color';
|
||||
|
||||
@@ -55,7 +55,9 @@ export function interpolateString(a: string | { toString(): string }, b: string
|
||||
|
||||
export function interpolateDate(a: Date, b: Date): ((t: number) => Date);
|
||||
|
||||
export function interpolateArray<A extends any[]>(a: any[], b: A): ((t: number) => A);
|
||||
export type ArrayInterpolator<A extends any[]> = ((t: number) => A);
|
||||
|
||||
export function interpolateArray<A extends any[]>(a: any[], b: A): ArrayInterpolator<A>;
|
||||
|
||||
export function interpolateObject<U extends any>(a: any, b: U): ((t: number) => U); // TODO: extends 'any' should become 'object' with TS 2.2+ definitions
|
||||
export function interpolateObject(a: { [key: string]: any }, b: { [key: string]: any }): ((t: number) => { [key: string]: any });
|
||||
@@ -89,3 +91,7 @@ export const interpolateCubehelixLong: ColorGammaInterpolationFactory;
|
||||
|
||||
export function interpolateBasis(splineNodes: number[]): ((t: number) => number);
|
||||
export function interpolateBasisClosed(splineNodes: number[]): ((t: number) => number);
|
||||
|
||||
export function piecewise(interpolate: (a: ZoomView, b: ZoomView) => ZoomInterpolator, values: ZoomView[]): ZoomInterpolator;
|
||||
export function piecewise<A extends any[]>(interpolate: (a: any[], b: A) => ArrayInterpolator<A>, values: A): ArrayInterpolator<A>;
|
||||
export function piecewise<TData, Interpolator>(interpolate: (a: TData, b: TData) => Interpolator, values: TData[]): (t: number) => any;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false,
|
||||
"callable-types": false
|
||||
"callable-types": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.0.2
|
||||
// Last module patch version validated against: 1.0.7
|
||||
|
||||
/**
|
||||
* Returns the current time as defined by performance.now if available, and Date.now if not.
|
||||
@@ -44,7 +44,7 @@ export interface Timer {
|
||||
export function timer(callback: (elapsed: number) => void, delay?: number, time?: number): Timer;
|
||||
|
||||
/**
|
||||
* Immediately invoke any eligible timer callbacks
|
||||
* Immediately invoke any eligible timer callbacks.
|
||||
*/
|
||||
export function timerFlush(): void;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as ddTrace from 'dd-trace';
|
||||
import SpanContext = require('dd-trace/src/opentracing/span_context');
|
||||
|
||||
const tracer = ddTrace.init({
|
||||
service: 'MyLovelyService',
|
||||
hostname: 'localhost',
|
||||
port: 8126,
|
||||
});
|
||||
|
||||
tracer
|
||||
.trace('web.request', {
|
||||
service: 'my_service',
|
||||
childOf: new SpanContext({ traceId: 1337, spanId: 42 }),
|
||||
tags: {
|
||||
env: 'dev'
|
||||
}
|
||||
})
|
||||
.then(span => {
|
||||
span.setTag('my_tag', 'my_value');
|
||||
span.finish();
|
||||
});
|
||||
Vendored
+139
@@ -0,0 +1,139 @@
|
||||
// Type definitions for dd-trace-js 0.2
|
||||
// Project: https://github.com/DataDog/dd-trace-js
|
||||
// Definitions by: Colin Bradley <https://github.com/ColinBradley>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import Tracer = require('./src/opentracing/tracer');
|
||||
import Span = require('./src/opentracing/span');
|
||||
import SpanContext = require('./src/opentracing/span_context');
|
||||
|
||||
declare var trace: TraceProxy;
|
||||
export = trace;
|
||||
|
||||
declare class TraceProxy extends Tracer {
|
||||
/**
|
||||
* Initializes the tracer. This should be called before importing other libraries.
|
||||
*/
|
||||
init(options?: TracerOptions): this;
|
||||
|
||||
/**
|
||||
* Enable and optionally configure a plugin.
|
||||
* @param plugin The name of a built-in plugin.
|
||||
* @param config Configuration options.
|
||||
*/
|
||||
use(plugin: string, config: PluginOptions): this;
|
||||
|
||||
/**
|
||||
* Initiate a trace and creates a new span.
|
||||
* @param operationName The operation name to be used for this span.
|
||||
* @param options Configuration options. These will take precedence over environment variables.
|
||||
*/
|
||||
trace(operationName: string, options: TraceOptions): Promise<Span>;
|
||||
|
||||
/**
|
||||
* Initiate a trace and creates a new span.
|
||||
* @param operationName The operation name to be used for this span.
|
||||
* @param options Configuration options. These will take precedence over environment variables.
|
||||
*/
|
||||
trace(operationName: string, options: TraceOptions, callback: (span: Span) => void): void;
|
||||
|
||||
/**
|
||||
* Get the span from the current context.
|
||||
* @returns The current span or null if outside a trace context.
|
||||
*/
|
||||
currentSpan(): Span | null;
|
||||
}
|
||||
|
||||
interface TracerOptions {
|
||||
/**
|
||||
* Enable debug logging in the tracer.
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* The service name to be used for this program.
|
||||
*/
|
||||
service?: string;
|
||||
|
||||
/**
|
||||
* The address of the trace agent that the tracer will submit to.
|
||||
* @default 'localhost'
|
||||
*/
|
||||
hostname?: string;
|
||||
|
||||
/**
|
||||
* The port of the trace agent that the tracer will submit to.
|
||||
* @default 8126
|
||||
*/
|
||||
port?: number | string;
|
||||
|
||||
/**
|
||||
* Percentage of spans to sample as a float between 0 and 1.
|
||||
* @default 1
|
||||
*/
|
||||
sampleRate?: number;
|
||||
|
||||
/**
|
||||
* Interval in milliseconds at which the tracer will submit traces to the agent.
|
||||
* @default 2000
|
||||
*/
|
||||
flushInterval?: number;
|
||||
|
||||
/**
|
||||
* Experimental features can be enabled all at once by using true or individually using key / value pairs.
|
||||
* @default {}
|
||||
*/
|
||||
experimental?: ExperimentalOptions | boolean;
|
||||
|
||||
/**
|
||||
* Whether to load all built-in plugins.
|
||||
* @default true
|
||||
*/
|
||||
plugins?: boolean;
|
||||
}
|
||||
|
||||
interface ExperimentalOptions {
|
||||
/**
|
||||
* Whether to use Node's experimental async hooks.
|
||||
* @default false
|
||||
*/
|
||||
asyncHooks?: boolean;
|
||||
}
|
||||
|
||||
interface PluginOptions {
|
||||
/**
|
||||
* The service name to be used for this plugin.
|
||||
*/
|
||||
service: string;
|
||||
}
|
||||
|
||||
interface TraceOptions {
|
||||
/**
|
||||
* The service name to be used for this span.
|
||||
* The service name from the tracer will be used if this is not provided.
|
||||
*/
|
||||
service?: string;
|
||||
|
||||
/**
|
||||
* The resource name to be used for this span.
|
||||
* The operation name will be used if this is not provided.
|
||||
*/
|
||||
resource?: string;
|
||||
|
||||
/**
|
||||
* The span type to be used for this span.
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* The parent span or span context for the new span. Generally this is not needed as it will be
|
||||
* fetched from the current context.
|
||||
*/
|
||||
childOf?: Span | SpanContext;
|
||||
|
||||
/**
|
||||
* Global tags that should be assigned to every span.
|
||||
*/
|
||||
tags?: { [key: string]: any; } | string;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import Span = require('./span');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
declare class Reference {
|
||||
/**
|
||||
* @return The Reference type (e.g., REFERENCE_CHILD_OF or
|
||||
* REFERENCE_FOLLOWS_FROM).
|
||||
*/
|
||||
type(): string;
|
||||
|
||||
/**
|
||||
* @return The SpanContext being referred to (e.g., the
|
||||
* parent in a REFERENCE_CHILD_OF Reference).
|
||||
*/
|
||||
referencedContext(): SpanContext;
|
||||
|
||||
/**
|
||||
* Initialize a new Reference instance.
|
||||
*
|
||||
* @param type - the Reference type constant (e.g.,
|
||||
* REFERENCE_CHILD_OF or REFERENCE_FOLLOWS_FROM).
|
||||
* @param referencedContext - the SpanContext being referred
|
||||
* to. As a convenience, a Span instance may be passed in instead
|
||||
* (in which case its .context() is used here).
|
||||
*/
|
||||
constructor(type: string, referencedContext: SpanContext | Span);
|
||||
}
|
||||
|
||||
export = Reference;
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
import Tracer = require('./tracer');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
declare class Span {
|
||||
/**
|
||||
* Returns the SpanContext object associated with this Span.
|
||||
*/
|
||||
context(): SpanContext;
|
||||
|
||||
/**
|
||||
* Returns the Tracer object used to create this Span.
|
||||
*/
|
||||
tracer(): Tracer;
|
||||
|
||||
/**
|
||||
* Sets the string name for the logical operation this span represents.
|
||||
*/
|
||||
setOperationName(name: string): this;
|
||||
|
||||
/**
|
||||
* Sets a key:value pair on this Span that also propagates to future
|
||||
* children of the associated Span.
|
||||
*
|
||||
* setBaggageItem() enables powerful functionality given a full-stack
|
||||
* opentracing integration (e.g., arbitrary application data from a web
|
||||
* client can make it, transparently, all the way into the depths of a
|
||||
* storage system), and with it some powerful costs: use this feature with
|
||||
* care.
|
||||
*
|
||||
* IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to
|
||||
* *future* causal descendants of the associated Span.
|
||||
*
|
||||
* IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and
|
||||
* value is copied into every local *and remote* child of the associated
|
||||
* Span, and that can add up to a lot of network and cpu overhead.
|
||||
*/
|
||||
setBaggageItem(key: string, value: string): this;
|
||||
|
||||
/**
|
||||
* Returns the value for a baggage item given its key.
|
||||
*
|
||||
* @param key
|
||||
* The key for the given trace attribute.
|
||||
* @return String value for the given key, or undefined if the key does not
|
||||
* correspond to a set trace attribute.
|
||||
*/
|
||||
getBaggageItem(key: string): string | undefined;
|
||||
|
||||
/**
|
||||
* Adds a single tag to the span. See `addTags()` for details.
|
||||
*/
|
||||
setTag(key: string, value: any): this;
|
||||
|
||||
/**
|
||||
* Adds the given key value pairs to the set of span tags.
|
||||
*
|
||||
* Multiple calls to addTags() results in the tags being the superset of
|
||||
* all calls.
|
||||
*
|
||||
* The behavior of setting the same key multiple times on the same span
|
||||
* is undefined.
|
||||
*
|
||||
* The supported type of the values is implementation-dependent.
|
||||
* Implementations are expected to safely handle all types of values but
|
||||
* may choose to ignore unrecognized / unhandle-able values (e.g. objects
|
||||
* with cyclic references, function objects).
|
||||
*/
|
||||
addTags(keyValueMap: {
|
||||
[key: string]: any;
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Add a log record to this Span, optionally at a user-provided timestamp.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* span.log({
|
||||
* size: rpc.size(), // numeric value
|
||||
* URI: rpc.URI(), // string value
|
||||
* payload: rpc.payload(), // Object value
|
||||
* "keys can be arbitrary strings": rpc.foo(),
|
||||
* });
|
||||
*
|
||||
* span.log({
|
||||
* "error.description": someError.description(),
|
||||
* }, someError.timestampMillis());
|
||||
*
|
||||
* @param keyValuePairs
|
||||
* An object mapping string keys to arbitrary value types. All
|
||||
* Tracer implementations should support bool, string, and numeric
|
||||
* value types, and some may also support Object values.
|
||||
* @param timestamp
|
||||
* An optional parameter specifying the timestamp in milliseconds
|
||||
* since the Unix epoch. Fractional values are allowed so that
|
||||
* timestamps with sub-millisecond accuracy can be represented. If
|
||||
* not specified, the implementation is expected to use its notion
|
||||
* of the current time of the call.
|
||||
*/
|
||||
|
||||
log(keyValuePairs: {
|
||||
[key: string]: any;
|
||||
}, timestamp?: number): this;
|
||||
|
||||
/**
|
||||
* Sets the end timestamp and finalizes Span state.
|
||||
*
|
||||
* With the exception of calls to Span.context() (which are always allowed),
|
||||
* finish() must be the last call made to any span instance, and to do
|
||||
* otherwise leads to undefined behavior.
|
||||
*
|
||||
* @param finishTime
|
||||
* Optional finish time in milliseconds as a Unix timestamp. Decimal
|
||||
* values are supported for timestamps with sub-millisecond accuracy.
|
||||
* If not specified, the current time (as defined by the
|
||||
* implementation) will be used.
|
||||
*/
|
||||
finish(finishTime?: number): void;
|
||||
}
|
||||
|
||||
export = Span;
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* SpanContext represents Span state that must propagate to descendant Spans
|
||||
* and across process boundaries.
|
||||
*
|
||||
* SpanContext is logically divided into two pieces: the user-level "Baggage"
|
||||
* (see setBaggageItem and getBaggageItem) that propagates across Span
|
||||
* boundaries and any Tracer-implementation-specific fields that are needed to
|
||||
* identify or otherwise contextualize the associated Span instance (e.g., a
|
||||
* <trace_id, span_id, sampled> tuple).
|
||||
*/
|
||||
declare class SpanContext {
|
||||
/**
|
||||
* Use to create references to parent spans.
|
||||
*/
|
||||
constructor(props: SpanContextLike);
|
||||
|
||||
public traceId: number;
|
||||
|
||||
public spanId: number;
|
||||
|
||||
public parentId?: number | null;
|
||||
|
||||
public sampled?: boolean;
|
||||
|
||||
public baggageItems?: { [key: string]: string };
|
||||
|
||||
public trace?: {
|
||||
started: number[],
|
||||
finished: number[]
|
||||
}
|
||||
}
|
||||
|
||||
interface SpanContextLike {
|
||||
traceId: number;
|
||||
spanId: number;
|
||||
}
|
||||
|
||||
export = SpanContext;
|
||||
@@ -0,0 +1,37 @@
|
||||
import Span = require('./span');
|
||||
import Reference = require('./reference');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
interface SpanOptions {
|
||||
/**
|
||||
* a parent SpanContext (or Span, for convenience) that the newly-started
|
||||
* span will be the child of (per REFERENCE_CHILD_OF). If specified,
|
||||
* `references` must be unspecified.
|
||||
*/
|
||||
childOf?: Span | SpanContext;
|
||||
|
||||
/**
|
||||
* an array of Reference instances, each pointing to a causal parent
|
||||
* SpanContext. If specified, `fields.childOf` must be unspecified.
|
||||
*/
|
||||
references?: Reference[];
|
||||
|
||||
/**
|
||||
* set of key-value pairs which will be set as tags on the newly created
|
||||
* Span. Ownership of the object is passed to the created span for
|
||||
* efficiency reasons (the caller should not modify this object after
|
||||
* calling startSpan).
|
||||
*/
|
||||
tags?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
/**
|
||||
* a manually specified start time for the created Span object. The time
|
||||
* should be specified in milliseconds as Unix timestamp. Decimal value are
|
||||
* supported to represent time values with sub-millisecond accuracy.
|
||||
*/
|
||||
startTime?: number;
|
||||
}
|
||||
|
||||
export = SpanOptions;
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
import SpanOptions = require('./span_options');
|
||||
import Span = require('./span');
|
||||
import SpanContext = require('./span_context');
|
||||
|
||||
/**
|
||||
* Tracer is the entry-point between the instrumentation API and the tracing
|
||||
* implementation.
|
||||
*/
|
||||
declare class Tracer {
|
||||
/**
|
||||
* Starts and returns a new Span representing a logical unit of work.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* // Start a new (parentless) root Span:
|
||||
* var parent = Tracer.startSpan('DoWork');
|
||||
*
|
||||
* // Start a new (child) Span:
|
||||
* var child = Tracer.startSpan('load-from-db', {
|
||||
* childOf: parent.context(),
|
||||
* });
|
||||
*
|
||||
* // Start a new async (FollowsFrom) Span:
|
||||
* var child = Tracer.startSpan('async-cache-write', {
|
||||
* references: [
|
||||
* opentracing.followsFrom(parent.context())
|
||||
* ],
|
||||
* });
|
||||
*
|
||||
* @param name - the name of the operation (REQUIRED).
|
||||
* @param options - options for the newly created span.
|
||||
* @return A new Span object.
|
||||
*/
|
||||
startSpan(name: string, options?: SpanOptions): Span;
|
||||
|
||||
/**
|
||||
* Injects the given SpanContext instance for cross-process propagation
|
||||
* within `carrier`. The expected type of `carrier` depends on the value of
|
||||
* `format.
|
||||
*
|
||||
* OpenTracing defines a common set of `format` values (see
|
||||
* FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has
|
||||
* an expected carrier type.
|
||||
*
|
||||
* Consider this pseudocode example:
|
||||
*
|
||||
* var clientSpan = ...;
|
||||
* ...
|
||||
* // Inject clientSpan into a text carrier.
|
||||
* var headersCarrier = {};
|
||||
* Tracer.inject(clientSpan.context(), Tracer.FORMAT_HTTP_HEADERS, headersCarrier);
|
||||
* // Incorporate the textCarrier into the outbound HTTP request header
|
||||
* // map.
|
||||
* Object.assign(outboundHTTPReq.headers, headersCarrier);
|
||||
* // ... send the httpReq
|
||||
*
|
||||
* @param spanContext - the SpanContext to inject into the
|
||||
* carrier object. As a convenience, a Span instance may be passed
|
||||
* in instead (in which case its .context() is used for the
|
||||
* inject()).
|
||||
* @param format - the format of the carrier.
|
||||
* @param carrier - see the documentation for the chosen `format`
|
||||
* for a description of the carrier object.
|
||||
*/
|
||||
inject(spanContext: SpanContext | Span, format: string, carrier: any): void;
|
||||
|
||||
/**
|
||||
* Returns a SpanContext instance extracted from `carrier` in the given
|
||||
* `format`.
|
||||
*
|
||||
* OpenTracing defines a common set of `format` values (see
|
||||
* FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has
|
||||
* an expected carrier type.
|
||||
*
|
||||
* Consider this pseudocode example:
|
||||
*
|
||||
* // Use the inbound HTTP request's headers as a text map carrier.
|
||||
* var headersCarrier = inboundHTTPReq.headers;
|
||||
* var wireCtx = Tracer.extract(Tracer.FORMAT_HTTP_HEADERS, headersCarrier);
|
||||
* var serverSpan = Tracer.startSpan('...', { childOf : wireCtx });
|
||||
*
|
||||
* @param format - the format of the carrier.
|
||||
* @param carrier - the type of the carrier object is determined by
|
||||
* the format.
|
||||
* @return The extracted SpanContext, or null if no such SpanContext could
|
||||
* be found in `carrier`
|
||||
*/
|
||||
extract(format: string, carrier: any): SpanContext | null;
|
||||
}
|
||||
|
||||
export = Tracer;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dd-trace-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,5 @@
|
||||
import onKeypress = require("@derhuerst/cli-on-key");
|
||||
import { Key, OffKeyPress } from "@derhuerst/cli-on-key";
|
||||
|
||||
const onKey = (key: Key): void => undefined;
|
||||
const offKeypress: OffKeyPress = onKeypress(process.stdin, onKey);
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for @derhuerst/cli-on-key 0.1
|
||||
// Project: https://github.com/derhuerst/cli-on-key
|
||||
// Definitions by: Rong Shen <https://github.com/jacobbubu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import stream = require("stream");
|
||||
|
||||
declare namespace listen {
|
||||
interface Key {
|
||||
name?: string;
|
||||
ctrl: boolean;
|
||||
meta: boolean;
|
||||
shift: boolean;
|
||||
sequence: string;
|
||||
code?: string; // ansi code leaving out leading \x1b's
|
||||
raw: string;
|
||||
}
|
||||
|
||||
type Callback = (key: Key) => void;
|
||||
type OffKeyPress = (key: Key) => void;
|
||||
}
|
||||
|
||||
declare function listen(
|
||||
stream: stream.Readable,
|
||||
callback: listen.Callback
|
||||
): listen.OffKeyPress;
|
||||
|
||||
export = listen;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user