mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -6,7 +6,6 @@ const result: Database.RunResult = { changes: 1, lastInsertRowid: 1 };
|
||||
const options: Database.Options = { fileMustExist: true, memory: true, readonly: true };
|
||||
const registrationOptions: Database.RegistrationOptions = {
|
||||
deterministic: true,
|
||||
name: '',
|
||||
safeIntegers: true,
|
||||
varargs: true
|
||||
};
|
||||
@@ -15,26 +14,49 @@ let db = Database('.');
|
||||
db = new Database('.', { memory: true });
|
||||
db.exec('CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL);');
|
||||
db.exec('INSERT INTO test(name) VALUES("name");');
|
||||
db.pragma('data_version', true);
|
||||
db.pragma('data_version', { simple: true });
|
||||
db.checkpoint();
|
||||
db.checkpoint('main');
|
||||
db.register(() => { });
|
||||
db.register({ name: 'noop', deterministic: true, varargs: true }, () => { });
|
||||
db.function('noop', () => { });
|
||||
db.function('noop', { deterministic: true, varargs: true }, () => { });
|
||||
db.aggregate('add', {
|
||||
start: 0,
|
||||
step: (t, n) => t + n,
|
||||
deterministic: true,
|
||||
varargs: true
|
||||
});
|
||||
db.aggregate('getAverage', {
|
||||
start: () => [],
|
||||
step: (array, nextValue) => {
|
||||
array.push(nextValue);
|
||||
},
|
||||
result: array => array.reduce((t: any, v: any) => t + v) / array.length,
|
||||
});
|
||||
db.aggregate('addAll', {
|
||||
start: 0,
|
||||
step: (total, nextValue) => total + nextValue,
|
||||
inverse: (total, droppedValue) => total - droppedValue,
|
||||
result: total => Math.round(total),
|
||||
});
|
||||
db.defaultSafeIntegers();
|
||||
db.defaultSafeIntegers(true);
|
||||
|
||||
const stmt = db.prepare('SELECT * FROM test WHERE name == ?;');
|
||||
stmt.get(['name']);
|
||||
stmt.all({ name: 'name' });
|
||||
stmt.each('name', (row: { name: string }) => { });
|
||||
stmt.each((row: { name: string }) => { });
|
||||
for (const row of stmt.iterate('name')) {
|
||||
}
|
||||
stmt.pluck();
|
||||
stmt.pluck(true);
|
||||
stmt.expand();
|
||||
stmt.expand(true);
|
||||
stmt.bind('name');
|
||||
stmt.safeIntegers();
|
||||
stmt.safeIntegers(true);
|
||||
|
||||
const trans = db.transaction(['INSERT INTO test(name) VALUES(?);']);
|
||||
trans.run('name');
|
||||
trans.bind('name');
|
||||
trans.run();
|
||||
const trans = db.transaction((param) => stmt.all(param));
|
||||
trans('name');
|
||||
trans.default('name');
|
||||
trans.deferred('name');
|
||||
trans.immediate('name');
|
||||
trans.exclusive('name');
|
||||
|
||||
Vendored
+29
-22
@@ -3,35 +3,32 @@
|
||||
// Definitions by: Ben Davies <https://github.com/Morfent>
|
||||
// Mathew Rumsey <https://github.com/matrumz>
|
||||
// Santiago Aguilar <https://github.com/sant123>
|
||||
// Alessandro Vergani <https://github.com/loghorn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import Integer = require("integer");
|
||||
|
||||
declare class Statement {
|
||||
interface Statement {
|
||||
database: Database;
|
||||
source: string;
|
||||
returnsData: boolean;
|
||||
constructor(db: Database, sources: string[]);
|
||||
reader: boolean;
|
||||
|
||||
run(...params: any[]): Database.RunResult;
|
||||
get(...params: any[]): any;
|
||||
all(...params: any[]): any[];
|
||||
each(params: any, cb: (row: any) => void): void;
|
||||
each(cb: (row: any) => void): void;
|
||||
each(...params: any[]): void;
|
||||
iterate(...params: any[]): IterableIterator<any>;
|
||||
pluck(toggleState?: boolean): this;
|
||||
expand(toggleState?: boolean): this;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
|
||||
declare class Transaction {
|
||||
database: Database;
|
||||
source: string;
|
||||
constructor(db: Database, sources: string[]);
|
||||
|
||||
run(...params: any[]): Database.RunResult;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
interface Transaction {
|
||||
(...params: any[]): any;
|
||||
default(...params: any[]): any;
|
||||
deferred(...params: any[]): any;
|
||||
immediate(...params: any[]): any;
|
||||
exclusive(...params: any[]): any;
|
||||
}
|
||||
|
||||
interface Database {
|
||||
@@ -42,15 +39,14 @@ interface Database {
|
||||
inTransaction: boolean;
|
||||
|
||||
prepare(source: string): Statement;
|
||||
transaction(sources: string[]): Transaction;
|
||||
transaction(fn: (...params: any[]) => any): Transaction;
|
||||
exec(source: string): this;
|
||||
pragma(source: string, simplify?: boolean): any;
|
||||
pragma(source: string, options?: Database.PragmaOptions): any;
|
||||
checkpoint(databaseName?: string): this;
|
||||
register(cb: (...params: any[]) => any): this;
|
||||
register(
|
||||
options: Database.RegistrationOptions,
|
||||
cb: (...params: any[]) => any
|
||||
): this;
|
||||
function(name: string, cb: (...params: any[]) => any): this;
|
||||
function(name: string, options: Database.RegistrationOptions, cb: (...params: any[]) => any): this;
|
||||
aggregate(name: string, options: Database.AggregateOptions): this;
|
||||
loadExtension(path: string): this;
|
||||
close(): this;
|
||||
defaultSafeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
@@ -81,14 +77,25 @@ declare namespace Database {
|
||||
memory?: boolean;
|
||||
readonly?: boolean;
|
||||
fileMustExist?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface PragmaOptions {
|
||||
simple?: boolean;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
name?: string;
|
||||
varargs?: boolean;
|
||||
deterministic?: boolean;
|
||||
safeIntegers?: boolean;
|
||||
}
|
||||
|
||||
interface AggregateOptions extends RegistrationOptions {
|
||||
start?: any;
|
||||
step: (total: any, next: any) => any;
|
||||
inverse?: (total: any, dropped: any) => any;
|
||||
result?: (total: any) => any;
|
||||
}
|
||||
}
|
||||
|
||||
declare const Database: DatabaseConstructor;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
@@ -20,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"better-sqlite3-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+190
-91
@@ -35,7 +35,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
type CatchFilter<E> = (new (...args: any[]) => E) | ((error: E) => boolean) | (object & E);
|
||||
type Constructor<E> = new (...args: any[]) => E;
|
||||
type CatchFilter<E> = ((error: E) => boolean) | (object & E);
|
||||
type IterableItem<R> = R extends Iterable<infer U> ? U : never;
|
||||
type IterableOrNever<R> = Extract<R, Iterable<any>>;
|
||||
type Resolvable<R> = R | PromiseLike<R>;
|
||||
@@ -85,69 +86,74 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<E1, E2, E3, E4, E5>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter5: CatchFilter<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2, E3, E4, E5>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter5: CatchFilter<E5>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
filter5: Constructor<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1, E2, E3, E4>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2, E3, E4, E5>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
filter5: Constructor<E5> | CatchFilter<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2, E3, E4>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2, E3, E4>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1, E2, E3>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2, E3>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2, E3>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1, E2>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1>(
|
||||
filter1: CatchFilter<E1>,
|
||||
onReject: (error: E1) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter1: Constructor<E1>,
|
||||
onReject: (error: E1) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1>(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
onReject: (error: E1) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
@@ -201,33 +207,64 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
tapCatch(onReject: (error?: any) => Resolvable<any>): Bluebird<R>;
|
||||
|
||||
tapCatch<E1, E2, E3, E4, E5>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter5: CatchFilter<E5>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
filter5: Constructor<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3, E4, E5>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
filter5: Constructor<E5> | CatchFilter<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3, E4>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3, E4>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter1: Constructor<E1>,
|
||||
onReject: (error: E1) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1>(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
onReject: (error: E1) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
|
||||
@@ -376,33 +413,64 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
|
||||
// No need to be specific about Error types in these overrides, since there's no handler function
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter5: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
filter5: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
filter5: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
|
||||
@@ -420,33 +488,64 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
|
||||
// No need to be specific about Error types in these overrides, since there's no handler function
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter5: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
filter5: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
filter5: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
import * as utils from "ckeditor__ckeditor5-utils";
|
||||
import * as core from "ckeditor__ckeditor5-core";
|
||||
import * as engine from "ckeditor__ckeditor5-engine";
|
||||
|
||||
declare let bool: boolean;
|
||||
declare let command: core.Command;
|
||||
declare let commandCollection: core.CommandCollection;
|
||||
declare let commands: core.Command[];
|
||||
declare let componentFactory: core.ComponentFactory;
|
||||
declare let config: utils.Config;
|
||||
declare let conversion: engine.conversion.Conversion;
|
||||
declare let dataController: engine.controller.DataController;
|
||||
declare let editingController: engine.controller.EditingController;
|
||||
declare let editingKeystrokeHandler: core.EditingKeystrokeHandler;
|
||||
declare let editor: core.editor.Editor;
|
||||
declare let focusTracker: utils.FocusTracker;
|
||||
declare let htmlElement: HTMLElement;
|
||||
declare let keystrokes: core.EditingKeystrokeHandler;
|
||||
declare let locale: utils.Locale;
|
||||
declare let model: engine.model.Model;
|
||||
declare let num: number;
|
||||
declare let pendingActions: core.PendingActions;
|
||||
declare let plugin: core.Plugin;
|
||||
declare let pluginCollection: core.PluginCollection<any>;
|
||||
declare let pluginCollectionStr: core.PluginCollection<core.Plugin<string>>;
|
||||
declare let pluginStr: core.Plugin<string>;
|
||||
declare let myPlugin: MyPlugin;
|
||||
declare let myPluginMaybe: MyPlugin | undefined;
|
||||
declare let myPlugins: MyPlugin[];
|
||||
declare let str: string;
|
||||
declare let strOrUndef: string | undefined;
|
||||
declare let strs: string[];
|
||||
declare let ui: core.editor.EditorUI;
|
||||
declare let undef: undefined;
|
||||
declare let view: core.EditorUIView;
|
||||
|
||||
class MyPlugin extends core.Plugin {
|
||||
constructor(editor: core.editor.Editor) {
|
||||
super(editor);
|
||||
}
|
||||
|
||||
static get pluginName() {
|
||||
return "A";
|
||||
}
|
||||
|
||||
myMethod() {
|
||||
return "this is MyPlugin method";
|
||||
}
|
||||
}
|
||||
|
||||
class SomeCommand extends core.Command {
|
||||
execute() {}
|
||||
}
|
||||
|
||||
// core/editor/utils/dataapimixin =============================================
|
||||
|
||||
class DataApiEditor extends core.editor.Editor implements core.editor.utils.DataApi {
|
||||
// mixin by DataApiMixin
|
||||
getData: () => string;
|
||||
setData: (data: string) => void;
|
||||
}
|
||||
utils.mix(DataApiEditor, core.editor.utils.DataApiMixin);
|
||||
const dataApiEditor = new DataApiEditor();
|
||||
|
||||
dataApiEditor.setData("foo");
|
||||
str = dataApiEditor.getData();
|
||||
|
||||
// core/editor/utils/elementapimixin ==========================================
|
||||
|
||||
class ElementApiEditor extends core.editor.Editor implements core.editor.utils.ElementApi {
|
||||
// mixin by ElementApiMixin
|
||||
readonly sourceElement: HTMLElement;
|
||||
updateSourceElement: () => void;
|
||||
}
|
||||
utils.mix(ElementApiEditor, core.editor.utils.ElementApiMixin);
|
||||
const elementApiEditor = new ElementApiEditor();
|
||||
|
||||
htmlElement = elementApiEditor.sourceElement;
|
||||
elementApiEditor.updateSourceElement();
|
||||
|
||||
// core/editor/utils/attachtoform =============================================
|
||||
|
||||
// $ExpectError
|
||||
core.editor.utils.attachToForm(editor);
|
||||
core.editor.utils.attachToForm(elementApiEditor);
|
||||
|
||||
// core/editor/editor =========================================================
|
||||
|
||||
commandCollection = editor.commands;
|
||||
config = editor.config;
|
||||
editingController = editor.editing;
|
||||
conversion = editor.conversion;
|
||||
dataController = editor.data;
|
||||
editor.isReadOnly = bool;
|
||||
editingKeystrokeHandler = editor.keystrokes;
|
||||
locale = editor.locale;
|
||||
model = editor.model;
|
||||
pluginCollection = editor.plugins;
|
||||
|
||||
if (editor.state === "initializing") {
|
||||
console.log("new Editor()");
|
||||
} else if (editor.state === "ready") {
|
||||
console.log("Editor.create()");
|
||||
} else if (editor.state === "destroyed") {
|
||||
console.log("editor.destroy");
|
||||
} else {
|
||||
const n: never = editor.state;
|
||||
}
|
||||
|
||||
editor.state = "ready";
|
||||
|
||||
core.editor.Editor.builtinPlugins = [plugin, pluginStr, plugin];
|
||||
const plugins: Array<core.Plugin<any>> = core.editor.Editor.builtinPlugins;
|
||||
|
||||
core.editor.Editor.defaultConfig = {
|
||||
foo: {
|
||||
a: 1,
|
||||
b: 2
|
||||
}
|
||||
};
|
||||
|
||||
editor = new core.editor.Editor();
|
||||
editor = new core.editor.Editor({language: "pl"});
|
||||
|
||||
editor.destroy();
|
||||
editor.destroy().then(() => {
|
||||
console.log(`${editor.state} == destroyed`);
|
||||
});
|
||||
|
||||
editor.execute("someCommand");
|
||||
editor.execute("someCommand2", "arg1", 2);
|
||||
|
||||
editor.initPlugins();
|
||||
editor.initPlugins().then(() => {
|
||||
console.log(`init ${Array.from(editor.plugins).length} plugins`);
|
||||
});
|
||||
|
||||
locale.t = editor.t;
|
||||
str = editor.t("Label");
|
||||
str = editor.t('Created file "%0" in %1ms.', ["fileName", "100"]);
|
||||
|
||||
// core/editor/editorui =======================================================
|
||||
|
||||
componentFactory = ui.componentFactory;
|
||||
editor = ui.editor;
|
||||
focusTracker = ui.focusTracker;
|
||||
view = ui.view;
|
||||
|
||||
ui = new core.editor.EditorUI(editor, view);
|
||||
ui.destroy();
|
||||
ui.update();
|
||||
|
||||
// core/editor/editorwithui ===================================================
|
||||
|
||||
declare let ewui: core.editor.EditorWithUI;
|
||||
htmlElement = ewui.element!;
|
||||
ui = ewui.ui;
|
||||
|
||||
// core/command ===============================================================
|
||||
|
||||
editor = command.editor;
|
||||
|
||||
bool = command.isEnabled;
|
||||
|
||||
undef = command.value;
|
||||
strOrUndef = new core.Command<string>(editor).value;
|
||||
|
||||
command = new core.Command(editor);
|
||||
|
||||
command.destroy();
|
||||
|
||||
command.execute();
|
||||
|
||||
command.refresh();
|
||||
|
||||
// core/commandcollection =====================================================
|
||||
|
||||
commandCollection = new core.CommandCollection();
|
||||
|
||||
const collectionsPairs = Array.from(commandCollection);
|
||||
const collectionsPair = collectionsPairs[0];
|
||||
str = collectionsPair[0];
|
||||
command = collectionsPair[1];
|
||||
|
||||
commandCollection.add("foo", new SomeCommand(editor));
|
||||
|
||||
command = commandCollection.commands().next().value;
|
||||
commands = Array.from(commandCollection.commands());
|
||||
|
||||
commandCollection.destroy();
|
||||
|
||||
commandCollection.execute("foo");
|
||||
commandCollection.execute("bar", 1, "param");
|
||||
|
||||
command = commandCollection.get("foo");
|
||||
|
||||
str = commandCollection.names().next().value;
|
||||
strs = Array.from(commandCollection.names());
|
||||
|
||||
// core/editingkeystrokehandler ===============================================
|
||||
|
||||
keystrokes = new core.EditingKeystrokeHandler(editor);
|
||||
|
||||
editor = keystrokes.editor;
|
||||
|
||||
keystrokes.press({keyCode: 123});
|
||||
|
||||
keystrokes.set("Ctrl+A", "foo");
|
||||
keystrokes.set(["shift", "33"], "foo");
|
||||
keystrokes.set(["ctrl", "A"], "foo", {priority: 10});
|
||||
keystrokes.set(["ctrl", "A"], "foo", {priority: "high"});
|
||||
keystrokes.set(["ctrl", "A"], () => console.log("key"));
|
||||
keystrokes.set(["ctrl", "A"], (keyEvtData, cancel) => {
|
||||
console.log(keyEvtData.keyCode);
|
||||
cancel();
|
||||
});
|
||||
|
||||
// core/pendingactions ========================================================
|
||||
|
||||
pendingActions = new core.PendingActions(editor);
|
||||
|
||||
str = core.PendingActions.pluginName;
|
||||
|
||||
const firstAction = pendingActions.first;
|
||||
|
||||
bool = pendingActions.hasAny;
|
||||
|
||||
strs = Array.from(pendingActions, action => action.message);
|
||||
|
||||
const action1 = pendingActions.add("Action 1");
|
||||
|
||||
pendingActions.remove(action1);
|
||||
|
||||
firstAction!.fire("I'm an Observable with a message");
|
||||
str = firstAction!.message;
|
||||
str = action1.message;
|
||||
|
||||
// core/plugin ================================================================
|
||||
|
||||
class MyPluginMini extends core.Plugin {
|
||||
constructor(editor: core.editor.Editor) {
|
||||
super(editor);
|
||||
}
|
||||
}
|
||||
|
||||
class MyPluginAll extends core.Plugin<string> {
|
||||
constructor(editor: core.editor.Editor) {
|
||||
super(editor);
|
||||
}
|
||||
|
||||
static get pluginName() {
|
||||
return "All";
|
||||
}
|
||||
|
||||
static get requires() {
|
||||
return [MyPlugin, MyPluginMini];
|
||||
}
|
||||
|
||||
afterInit() {return Math.random() ? null : Promise.resolve("resolved"); }
|
||||
destroy() {return Math.random() ? null : Promise.resolve("destroy"); }
|
||||
init() {return Math.random() ? null : Promise.resolve("init"); }
|
||||
}
|
||||
|
||||
plugin = new MyPlugin(editor);
|
||||
plugin = new MyPluginMini(editor);
|
||||
pluginStr = new MyPluginAll(editor);
|
||||
|
||||
const Plugin: MyPlugin = new MyPlugin(editor);
|
||||
const pluginMini: MyPluginMini = new MyPluginMini(editor);
|
||||
const pluginAll: MyPluginAll = new MyPluginAll(editor);
|
||||
|
||||
editor = myPlugin.editor;
|
||||
|
||||
str = MyPluginAll.pluginName;
|
||||
strOrUndef = MyPluginMini.pluginName; // Todo: should be undefined.
|
||||
|
||||
plugin = new MyPluginAll.requires[0](editor);
|
||||
|
||||
const fs: Function[] = MyPluginAll.requires;
|
||||
const fsOrUndef = MyPluginMini.requires; // Todo: should be undefined.
|
||||
|
||||
// $ExpectError
|
||||
pluginMini.afterInit();
|
||||
pluginAll.afterInit();
|
||||
|
||||
// $ExpectError
|
||||
pluginMini.destroy();
|
||||
pluginAll.destroy();
|
||||
|
||||
// $ExpectError
|
||||
pluginMini.init();
|
||||
pluginAll.init();
|
||||
|
||||
// core/plugincollection ======================================================
|
||||
|
||||
pluginCollectionStr = new core.PluginCollection(editor, [MyPluginAll]);
|
||||
// $ExpectError
|
||||
pluginCollectionStr = new core.PluginCollection(editor, [MyPlugin]);
|
||||
|
||||
const aColl = new core.PluginCollection<MyPluginAll | MyPluginMini>(editor, [MyPluginAll, MyPluginMini]);
|
||||
|
||||
const myColl = new core.PluginCollection(editor, [MyPlugin]);
|
||||
|
||||
const myCollArray = Array.from(myColl);
|
||||
myPlugins = myCollArray.map(entry => entry[1]);
|
||||
myPlugin = new (myCollArray[0][0])(editor);
|
||||
|
||||
myColl.destroy()
|
||||
.then(destroyedPlugins => {
|
||||
num = destroyedPlugins.length;
|
||||
const plugin = destroyedPlugins[0];
|
||||
editor = plugin.editor;
|
||||
plugin.init!();
|
||||
plugin.destroy();
|
||||
str = plugin.myMethod();
|
||||
});
|
||||
|
||||
myPluginMaybe = myColl.get("A");
|
||||
myPluginMaybe = myColl.get(MyPlugin);
|
||||
|
||||
myColl.load([MyPlugin, "A"])
|
||||
.then((loadedPlugins) => {
|
||||
const plugin = loadedPlugins[0];
|
||||
editor = plugin.editor;
|
||||
str = plugin.myMethod();
|
||||
});
|
||||
|
||||
myColl.load([MyPlugin, "A"], [MyPlugin, "A"]);
|
||||
+269
@@ -0,0 +1,269 @@
|
||||
// Type definitions for @ckeditor/ckeditor5-core 11.0
|
||||
// Project: https://github.com/ckeditor/ckeditor5-core
|
||||
// Definitions by: denisname <https://github.com/denisname>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as engine from "ckeditor__ckeditor5-engine";
|
||||
import * as ckutils from "ckeditor__ckeditor5-utils";
|
||||
|
||||
// TODO: depends on other libraries
|
||||
export interface AlignmentConfig {}
|
||||
export interface AutosaveConfig {}
|
||||
export interface CKFinderAdapterConfig {}
|
||||
export interface CloudServicesConfig {}
|
||||
export interface FontFamilyConfig {}
|
||||
export interface FontSizeConfig {}
|
||||
export interface HeadingConfig {}
|
||||
export interface HighlightConfig {}
|
||||
export interface ImageConfig {}
|
||||
export interface MediaEmbedConfig {}
|
||||
export interface TypingConfig {}
|
||||
export interface ComponentFactory {} // CKEditor 5 UI
|
||||
export interface EditorUIView {} // CKEditor 5 UI
|
||||
|
||||
export namespace editor {
|
||||
namespace utils {
|
||||
// core/editor/utils/attachtoform
|
||||
|
||||
function attachToForm(editor: Editor & ElementApi): void;
|
||||
|
||||
// core/editor/utils/dataapimixin
|
||||
|
||||
const DataApiMixin: DataApi;
|
||||
|
||||
interface DataApi {
|
||||
getData(): string;
|
||||
setData(data: string): void;
|
||||
}
|
||||
|
||||
// core/editor/utils/elementapimixin
|
||||
|
||||
const ElementApiMixin: ElementApi;
|
||||
|
||||
interface ElementApi {
|
||||
readonly sourceElement: HTMLElement;
|
||||
updateSourceElement(): void;
|
||||
}
|
||||
}
|
||||
|
||||
// core/editor/editor
|
||||
|
||||
class Editor implements ckutils.Emitter, ckutils.Observable {
|
||||
readonly commands: CommandCollection;
|
||||
readonly config: ckutils.Config;
|
||||
readonly conversion: engine.conversion.Conversion;
|
||||
readonly data: engine.controller.DataController;
|
||||
readonly editing: engine.controller.EditingController;
|
||||
isReadOnly: boolean;
|
||||
readonly keystrokes: EditingKeystrokeHandler;
|
||||
readonly locale: ckutils.Locale;
|
||||
readonly model: engine.model.Model;
|
||||
readonly plugins: PluginCollection<Plugin<any>>;
|
||||
state: "initializing" | "ready" | "destroyed";
|
||||
|
||||
static builtinPlugins: Array<Plugin<any>>;
|
||||
static defaultConfig: object;
|
||||
|
||||
constructor(config?: object);
|
||||
destroy(): Promise<void>;
|
||||
execute(commandName: string, ...commandParams: any[]): void;
|
||||
initPlugins(): Promise<void>;
|
||||
t(str: string, values?: string[]): string;
|
||||
|
||||
static create(config: object): Promise<any>;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
|
||||
// Observable
|
||||
bind(...bindProperties: string[]): ckutils.BindChain;
|
||||
decorate(methodName: string): void;
|
||||
set(name: object): void;
|
||||
set(name: string, value: any): void;
|
||||
unbind(...unbindProperties: string[]): void;
|
||||
}
|
||||
|
||||
// core/editor/editorconfig
|
||||
|
||||
interface EditorConfig {
|
||||
alignment: AlignmentConfig;
|
||||
autosave: AutosaveConfig;
|
||||
balloonToolbar: string[];
|
||||
blockToolbar: string[];
|
||||
ckfinder: CKFinderAdapterConfig;
|
||||
cloudServices: CloudServicesConfig;
|
||||
fontFamily: FontFamilyConfig;
|
||||
fontSize: FontSizeConfig;
|
||||
heading: HeadingConfig;
|
||||
highlight: HighlightConfig;
|
||||
image: ImageConfig;
|
||||
language: string;
|
||||
mediaEmbed: MediaEmbedConfig;
|
||||
plugins: Array<string | Plugin>;
|
||||
removePlugins: string[];
|
||||
toolbar: string[] | {items: string[]; viewportTopOffset: number; };
|
||||
typing: TypingConfig;
|
||||
}
|
||||
|
||||
// core/editor/editorui
|
||||
|
||||
class EditorUI implements ckutils.Emitter {
|
||||
readonly componentFactory: ComponentFactory;
|
||||
readonly editor: Editor;
|
||||
readonly focusTracker: ckutils.FocusTracker;
|
||||
readonly view: EditorUIView;
|
||||
|
||||
constructor(editor: Editor, view: EditorUIView);
|
||||
destroy(): void;
|
||||
update(): void;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
}
|
||||
|
||||
// core/editor/editorwithui
|
||||
|
||||
interface EditorWithUI {
|
||||
readonly element: HTMLElement | null;
|
||||
readonly ui: EditorUI;
|
||||
}
|
||||
}
|
||||
|
||||
// core/command
|
||||
|
||||
export class Command<T = undefined> implements ckutils.Emitter, ckutils.Observable {
|
||||
readonly editor: editor.Editor;
|
||||
readonly isEnabled: boolean;
|
||||
readonly value: T | undefined;
|
||||
|
||||
constructor(editor: editor.Editor);
|
||||
destroy(): void;
|
||||
execute(): void;
|
||||
refresh(): void;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
|
||||
// Observable
|
||||
bind(...bindProperties: string[]): ckutils.BindChain;
|
||||
decorate(methodName: string): void;
|
||||
set(name: object): void;
|
||||
set(name: string, value: any): void;
|
||||
unbind(...unbindProperties: string[]): void;
|
||||
}
|
||||
|
||||
// core/commandcollection
|
||||
|
||||
export class CommandCollection {
|
||||
constructor();
|
||||
[Symbol.iterator](): Iterator<[string, Command]>;
|
||||
add(commandName: string, command: Command): void;
|
||||
commands(): IterableIterator<Command>;
|
||||
destroy(): void;
|
||||
execute(commandName: string, ...commandParams: any[]): void;
|
||||
get(commandName: string): Command;
|
||||
names(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
// core/editingkeystrokehandler
|
||||
|
||||
export class EditingKeystrokeHandler extends ckutils.KeystrokeHandler {
|
||||
readonly editor: editor.Editor;
|
||||
|
||||
constructor(editor: editor.Editor);
|
||||
set(
|
||||
keystroke: string | Array<string | number>,
|
||||
callback: string | ((keyEvtData: engine.view.observer.KeyEventData, cancel: () => void) => void),
|
||||
options?: {priority: ckutils.PriorityString | number}
|
||||
): void;
|
||||
}
|
||||
|
||||
// core/pendingactions
|
||||
|
||||
export class PendingActions extends Plugin {
|
||||
static readonly pluginName: "PendingActions";
|
||||
|
||||
first: null | ckutils.Observable & {message: string};
|
||||
readonly hasAny: boolean;
|
||||
|
||||
[Symbol.iterator](): Iterator<ckutils.Observable & {message: string}>;
|
||||
add(message: string): ckutils.Observable & {message: string};
|
||||
remove(action: ckutils.Observable & {message: string}): void;
|
||||
}
|
||||
|
||||
// core/plugin
|
||||
|
||||
export abstract class Plugin<T = void> implements ckutils.Emitter, ckutils.Observable {
|
||||
readonly editor: editor.Editor;
|
||||
|
||||
static readonly pluginName?: string;
|
||||
static readonly requires?: Array<new(editor: editor.Editor) => Plugin>;
|
||||
|
||||
constructor(editor: editor.Editor);
|
||||
afterInit?(): null | Promise<T>;
|
||||
destroy?(): null | Promise<T>;
|
||||
init?(): null | Promise<T>;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
|
||||
// Observable
|
||||
bind(...bindProperties: string[]): ckutils.BindChain;
|
||||
decorate(methodName: string): void;
|
||||
set(name: object): void;
|
||||
set(name: string, value: any): void;
|
||||
unbind(...unbindProperties: string[]): void;
|
||||
}
|
||||
|
||||
// PluginInterface, see Plugin
|
||||
|
||||
// core/plugincollection
|
||||
|
||||
export class PluginCollection<P extends Plugin<any>> {
|
||||
constructor(
|
||||
editor: editor.Editor,
|
||||
availablePlugins?: Array<new(editor: editor.Editor) => P>
|
||||
);
|
||||
|
||||
[Symbol.iterator](): Iterator<[new(editor: editor.Editor) => P, P]>;
|
||||
|
||||
destroy(): Promise<Array<P & {destroy(): void | null | Promise<any>}>>;
|
||||
|
||||
get(
|
||||
key: string | (new(editor: editor.Editor) => P)
|
||||
): P | undefined;
|
||||
|
||||
load(
|
||||
plugins: Array<string | (new(editor: editor.Editor) => P)>,
|
||||
removePlugins?: Array<string | (new(editor: editor.Editor) => P)>
|
||||
): Promise<P[]>;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom",
|
||||
"es2015.promise"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ckeditor__ckeditor5-core-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": {
|
||||
"options": [
|
||||
["Object", "Avoid using the `Object` type. Did you mean `object`?"],
|
||||
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
|
||||
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
|
||||
["String", "Avoid using the `String` type. Did you mean `string`?"],
|
||||
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"]
|
||||
]
|
||||
},
|
||||
"no-empty-interface": false,
|
||||
"prefer-switch": false,
|
||||
"quotemark": [
|
||||
true,
|
||||
"double",
|
||||
"avoid-escape",
|
||||
"avoid-template"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import * as engine from "ckeditor__ckeditor5-engine";
|
||||
|
||||
declare let pattern: engine.view.MatcherPattern;
|
||||
|
||||
pattern = {name: /^p/};
|
||||
|
||||
pattern = {
|
||||
attributes: {
|
||||
title: "foobar",
|
||||
foo: /^\w+/,
|
||||
bar: true,
|
||||
}
|
||||
};
|
||||
|
||||
pattern = {
|
||||
classes: "foobar"
|
||||
};
|
||||
|
||||
pattern = {
|
||||
classes: /foo.../
|
||||
};
|
||||
|
||||
pattern = {
|
||||
classes: ["baz", "bar", /foo.../]
|
||||
};
|
||||
|
||||
pattern = {
|
||||
styles: {
|
||||
position: "absolute",
|
||||
color: /^\w*blue$/
|
||||
}
|
||||
};
|
||||
|
||||
pattern = {
|
||||
name: "span",
|
||||
styles: {
|
||||
"font-weight": "bold"
|
||||
},
|
||||
classes: "highlighted"
|
||||
};
|
||||
|
||||
pattern = (element: engine.view.Element) => {
|
||||
if (element.name === "div" && element.childCount > 0) {
|
||||
return {name: true};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
pattern = (element: engine.view.Element) => {
|
||||
if (element.name === "p") {
|
||||
const fontSize = element.getStyle("font-size")!;
|
||||
const size = fontSize.match(/(\d+)/px);
|
||||
|
||||
if (size && Number(size[1]) > 26) {
|
||||
return {name: true, attribute: ["font-size"]};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
declare let viewDefinition: engine.view.ElementDefinition;
|
||||
|
||||
viewDefinition = "p";
|
||||
|
||||
viewDefinition = {
|
||||
name: "h1",
|
||||
classes: ["foo", "bar"],
|
||||
};
|
||||
|
||||
viewDefinition = {
|
||||
name: "span",
|
||||
styles: {
|
||||
"font-size": "12px",
|
||||
"font-weight": "bold",
|
||||
},
|
||||
attributes: {
|
||||
"data-id": "123",
|
||||
}
|
||||
};
|
||||
+1368
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"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",
|
||||
"ckeditor__ckeditor5-engine-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": {
|
||||
"options": [
|
||||
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
|
||||
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
|
||||
["String", "Avoid using the `String` type. Did you mean `string`?"],
|
||||
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"]
|
||||
]
|
||||
},
|
||||
"no-empty-interface": false,
|
||||
"quotemark": [
|
||||
true,
|
||||
"double",
|
||||
"avoid-escape",
|
||||
"avoid-template"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -489,24 +489,30 @@ utils.mapsEqual(map, map);
|
||||
|
||||
// utils/mix ==================================================================
|
||||
|
||||
class Editor {
|
||||
b: () => number;
|
||||
}
|
||||
|
||||
interface SomeMixin {
|
||||
a: () => string;
|
||||
}
|
||||
|
||||
class Editor implements SomeMixin {
|
||||
a: () => string;
|
||||
b() { return 3; }
|
||||
}
|
||||
|
||||
const SomeMixin = {
|
||||
a() {
|
||||
return "a";
|
||||
}
|
||||
a() { return "a"; }
|
||||
};
|
||||
|
||||
const SomeMixinNum = {
|
||||
a() { return 3; }
|
||||
};
|
||||
|
||||
utils.mix(Editor, SomeMixin);
|
||||
const mixEditor = new Editor() as Editor & SomeMixin;
|
||||
mixEditor.a();
|
||||
mixEditor.b();
|
||||
// $ExpectError
|
||||
utils.mix(Editor, SomeMixinNum);
|
||||
|
||||
const editor = new Editor();
|
||||
str = editor.a();
|
||||
num = editor.b();
|
||||
|
||||
// utils/nth ==================================================================
|
||||
|
||||
|
||||
+6
-2
@@ -367,7 +367,11 @@ export class KeystrokeHandler {
|
||||
destroy(): void;
|
||||
listenTo(emitter: Emitter): void;
|
||||
press(keyEvtData: KeystrokeInfo): boolean;
|
||||
set(keystroke: string | Array<string | number>, callback: Function, options?: {priority?: PriorityString | number}): void;
|
||||
set(
|
||||
keystroke: string | Array<string | number>,
|
||||
callback: (keyEvtData: KeystrokeInfo, cancel: () => void) => void,
|
||||
options?: {priority?: PriorityString | number}
|
||||
): void;
|
||||
}
|
||||
|
||||
// utils/locale
|
||||
@@ -392,7 +396,7 @@ export function mapsEqual<K, V>(mapsA: Map<K, V>, mapsB: Map<K, V>): boolean;
|
||||
|
||||
// utils/mix
|
||||
|
||||
export function mix(baseClass: {new(): any}, ...mixins: any[]): void;
|
||||
export function mix<T>(baseClass: {new(...p: any[]): T}, ...mixins: Array<Partial<T>>): void;
|
||||
|
||||
// utils/nth
|
||||
|
||||
|
||||
@@ -4,18 +4,24 @@ const conf = new Conf<string | number | boolean>();
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow'
|
||||
unicorn: 'rainbow',
|
||||
},
|
||||
configName: '',
|
||||
projectName: 'foo',
|
||||
cwd: ''
|
||||
});
|
||||
new Conf<string>({ configName: '' });
|
||||
new Conf<string>({ projectName: 'foo' });
|
||||
new Conf<string>({ cwd: '' });
|
||||
new Conf<string>({ encryptionKey: '' });
|
||||
new Conf<string>({ encryptionKey: new Buffer('') });
|
||||
new Conf<string>({ encryptionKey: new Uint8Array([1]) });
|
||||
new Conf<string>({ encryptionKey: new DataView(new ArrayBuffer(2)) });
|
||||
new Conf<string>({ fileExtension: '.foo' });
|
||||
|
||||
// $ExpectError
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: ['rainbow']
|
||||
}
|
||||
unicorn: ['rainbow'],
|
||||
},
|
||||
});
|
||||
conf.set('foo', 'bar');
|
||||
conf.set('hello', 1);
|
||||
@@ -28,10 +34,17 @@ conf.get('foo', null); // $ExpectError
|
||||
conf.delete('foo');
|
||||
conf.has('foo'); // $ExpectType boolean
|
||||
conf.clear();
|
||||
conf.onDidChange('foo', (oldVal, newVal) => {
|
||||
// $ExpectType string | number | boolean | undefined
|
||||
oldVal;
|
||||
// $ExpectType string | number | boolean | undefined
|
||||
newVal;
|
||||
});
|
||||
|
||||
conf.size; // $ExpectType number
|
||||
conf.store = {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow'
|
||||
unicorn: 'rainbow',
|
||||
};
|
||||
conf.path; // $ExpectType string
|
||||
|
||||
|
||||
Vendored
+24
-18
@@ -1,31 +1,37 @@
|
||||
// Type definitions for conf 1.4
|
||||
// Type definitions for conf 2.1
|
||||
// Project: https://github.com/sindresorhus/conf
|
||||
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface Options<T> {
|
||||
defaults?: {[key: string]: T};
|
||||
configName?: string;
|
||||
projectName?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
/// <reference types="node" />
|
||||
|
||||
declare class Conf<T = any> implements Iterable<[string, T]> {
|
||||
store: {[key: string]: T};
|
||||
store: { [key: string]: T };
|
||||
readonly path: string;
|
||||
readonly size: number;
|
||||
readonly size: number;
|
||||
|
||||
constructor(options?: Options<T>);
|
||||
get(key: string, defaultValue?: T): T;
|
||||
set(key: string, val: T): void;
|
||||
set(object: {[key: string]: T}): void;
|
||||
has(key: string): boolean;
|
||||
delete(key: string): void;
|
||||
clear(): void;
|
||||
onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void;
|
||||
[Symbol.iterator](): Iterator<[string, T]>;
|
||||
constructor(options?: Conf.Options<T>);
|
||||
get(key: string, defaultValue?: T): T;
|
||||
set(key: string, val: T): void;
|
||||
set(object: { [key: string]: T }): void;
|
||||
has(key: string): boolean;
|
||||
delete(key: string): void;
|
||||
clear(): void;
|
||||
onDidChange(key: string, callback: (oldVal: T | undefined, newVal: T | undefined) => void): void;
|
||||
[Symbol.iterator](): Iterator<[string, T]>;
|
||||
}
|
||||
|
||||
declare namespace Conf {
|
||||
interface Options<T> {
|
||||
defaults?: { [key: string]: T };
|
||||
configName?: string;
|
||||
projectName?: string;
|
||||
cwd?: string;
|
||||
encryptionKey?: string | Buffer | NodeJS.TypedArray | DataView;
|
||||
fileExtension?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = Conf;
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"conf-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import Conf = require('conf');
|
||||
|
||||
const conf = new Conf<string | number | boolean>();
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow',
|
||||
},
|
||||
configName: '',
|
||||
projectName: 'foo',
|
||||
cwd: '',
|
||||
});
|
||||
// $ExpectError
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: ['rainbow'],
|
||||
},
|
||||
});
|
||||
conf.set('foo', 'bar');
|
||||
conf.set('hello', 1);
|
||||
conf.set('unicorn', false);
|
||||
conf.set('null', null); // $ExpectError
|
||||
|
||||
conf.get('foo'); // $ExpectType string | number | boolean
|
||||
conf.get('foo', 'bar'); // $ExpectType string | number | boolean
|
||||
conf.get('foo', null); // $ExpectError
|
||||
conf.delete('foo');
|
||||
conf.has('foo'); // $ExpectType boolean
|
||||
conf.clear();
|
||||
|
||||
conf.store = {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow',
|
||||
};
|
||||
conf.path; // $ExpectType string
|
||||
|
||||
for (const [key, value] of conf) {
|
||||
key; // $ExpectType string
|
||||
value; // $ExpectType string | number | boolean
|
||||
}
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for conf 1.4
|
||||
// Project: https://github.com/sindresorhus/conf
|
||||
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface Options<T> {
|
||||
defaults?: { [key: string]: T };
|
||||
configName?: string;
|
||||
projectName?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
declare class Conf<T = any> implements Iterable<[string, T]> {
|
||||
store: { [key: string]: T };
|
||||
readonly path: string;
|
||||
readonly size: number;
|
||||
|
||||
constructor(options?: Options<T>);
|
||||
get(key: string, defaultValue?: T): T;
|
||||
set(key: string, val: T): void;
|
||||
set(object: { [key: string]: T }): void;
|
||||
has(key: string): boolean;
|
||||
delete(key: string): void;
|
||||
clear(): void;
|
||||
onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void;
|
||||
[Symbol.iterator](): Iterator<[string, T]>;
|
||||
}
|
||||
|
||||
export = Conf;
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"conf": [
|
||||
"conf/v1"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"conf-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -12,6 +12,7 @@ import * as d3Hierarchy from 'd3-hierarchy';
|
||||
// Preparatory Steps
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
let str: string;
|
||||
let num: number;
|
||||
let numOrUndefined: number | undefined;
|
||||
let size: [number, number];
|
||||
@@ -825,22 +826,34 @@ copiedPackNode = packRootNode.copy();
|
||||
// Pack Siblings and Enclosure
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
interface CircleData extends d3Hierarchy.PackCircle {
|
||||
v: string;
|
||||
}
|
||||
|
||||
let circles: CircleData[] = [
|
||||
const radius = [
|
||||
{ r: 10, v: 'a' },
|
||||
{ r: 1, v: 'b' },
|
||||
{ r: 30, v: 'b' },
|
||||
{ r: 20, v: 'c' }
|
||||
];
|
||||
|
||||
// packSiblings
|
||||
|
||||
circles = d3Hierarchy.packSiblings(circles);
|
||||
const circles = d3Hierarchy.packSiblings(radius);
|
||||
str = circles[0].v;
|
||||
num = circles[0].r;
|
||||
num = circles[0].x;
|
||||
num = circles[0].y;
|
||||
|
||||
// packEnclose
|
||||
|
||||
let enclosure: { r: number, x: number, y: number };
|
||||
const moreCircles = [
|
||||
{ r: 10, v: 'a', x: 0, y: 10 },
|
||||
{ r: 30, v: 'b', x: 5, y: 15 },
|
||||
{ r: 20, v: 'c', x: 7, y: 30 }
|
||||
];
|
||||
|
||||
enclosure = d3Hierarchy.packEnclose(circles);
|
||||
const circle = d3Hierarchy.packEnclose(moreCircles);
|
||||
num = circle.r;
|
||||
num = circle.x;
|
||||
num = circle.y;
|
||||
// $ExpectError
|
||||
str = circle.v; // fails, property 'v' does not exist
|
||||
|
||||
// $ExpectError
|
||||
d3Hierarchy.packEnclose(radius);
|
||||
|
||||
Vendored
+20
-5
@@ -802,7 +802,7 @@ export function pack<Datum>(): PackLayout<Datum>;
|
||||
// Pack Siblings and Enclosure
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
export interface PackCircle {
|
||||
export interface PackRadius {
|
||||
/**
|
||||
* The radius of the circle.
|
||||
*/
|
||||
@@ -819,10 +819,25 @@ export interface PackCircle {
|
||||
y?: number;
|
||||
}
|
||||
|
||||
export interface PackCircle {
|
||||
/**
|
||||
* The radius of the circle.
|
||||
*/
|
||||
r: number;
|
||||
|
||||
/**
|
||||
* The x-coordinate of the circle’s center.
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* The y-coordinate of the circle’s center.
|
||||
*/
|
||||
y: number;
|
||||
}
|
||||
|
||||
// TODO: Since packSiblings manipulates the circles array in place, technically the x and y properties
|
||||
// are optional on invocation, but will be created after execution for each entry.
|
||||
// For invocation of packEnclose the x and y coordinates are mandatory. It seems easier to just comment
|
||||
// on the mandatory nature, then to create separate interfaces and having to deal with recasting.
|
||||
|
||||
/**
|
||||
* Packs the specified array of circles, each of which must have a `circle.r` property specifying the circle’s radius.
|
||||
@@ -830,7 +845,7 @@ export interface PackCircle {
|
||||
*
|
||||
* @param circles The specified array of circles to pack.
|
||||
*/
|
||||
export function packSiblings<Datum extends PackCircle>(circles: Datum[]): Datum[];
|
||||
export function packSiblings<Datum extends PackRadius>(circles: Datum[]): Array<Datum & PackCircle>;
|
||||
|
||||
/**
|
||||
* Computes the smallest circle that encloses the specified array of circles, each of which must have
|
||||
@@ -839,4 +854,4 @@ export function packSiblings<Datum extends PackCircle>(circles: Datum[]): Datum[
|
||||
*
|
||||
* @param circles The specified array of circles to pack.
|
||||
*/
|
||||
export function packEnclose<Datum extends PackCircle>(circles: Datum[]): { r: number, x: number, y: number };
|
||||
export function packEnclose<Datum extends PackCircle>(circles: Datum[]): PackCircle;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import * as d3Zoom from 'd3-zoom';
|
||||
import { ArrayLike, select, Selection, event } from 'd3-selection';
|
||||
import { Transition } from 'd3-transition';
|
||||
import { scaleLinear, ScaleLinear } from 'd3-scale';
|
||||
import { scaleLinear, ScaleLinear, ScaleTime, scaleTime } from 'd3-scale';
|
||||
import { interpolateZoom, interpolate, interpolateArray, ZoomInterpolator, ZoomView } from 'd3-interpolate';
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -248,15 +248,15 @@ let zoomInterpolatorFactory: (a: ZoomView, b: ZoomView) => ZoomInterpolator;
|
||||
// Basic case without casting
|
||||
basicInterpolatorFactory = svgZoom.interpolate();
|
||||
|
||||
// Assuming it is know that a specialized interpolation factory was used. E.g. ZoomInterpolator also has a duration
|
||||
// argument
|
||||
// Assuming it is know that a specialized interpolation factory was used. E.g. ZoomInterpolator also has a duration argument
|
||||
zoomInterpolatorFactory = svgZoom.interpolate<(a: ZoomView, b: ZoomView) => ZoomInterpolator>();
|
||||
|
||||
// on() --------------------------------------------------------------------
|
||||
|
||||
// chainable
|
||||
svgZoom = svgZoom.on('zoom', zoomedSVGOverlay);
|
||||
// svgZoom = svgZoom.on('zoom', zoomedCanvas); // fails, zoom event handler has wrong this and datum type
|
||||
// $ExpectError
|
||||
svgZoom = svgZoom.on('zoom', zoomedCanvas); // fails, zoom event handler has wrong this and datum type
|
||||
|
||||
let zoomHandler: ((this: SVGRectElement, datum: SVGDatum, index: number, group: SVGRectElement[] | ArrayLike<SVGRectElement>) => void) | undefined;
|
||||
zoomHandler = svgZoom.on('zoom');
|
||||
@@ -297,7 +297,8 @@ const svgOverlayTransition = svgOverlay.transition();
|
||||
|
||||
// use on selection
|
||||
svgZoom.transform(svgOverlay, d3Zoom.zoomIdentity);
|
||||
// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.transform(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@@ -308,9 +309,11 @@ svgZoom.transform(svgOverlay, function(datum, index, groups) {
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return d3Zoom.zoomIdentity;
|
||||
});
|
||||
|
||||
// use on transition
|
||||
svgOverlayTransition.call(svgZoom.transform, d3Zoom.zoomIdentity);
|
||||
// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.transform(svgOverlayTransition, d3Zoom.zoomIdentity);
|
||||
svgZoom.transform(svgOverlayTransition, function(datum, index, groups) {
|
||||
@@ -327,7 +330,8 @@ svgZoom.transform(svgOverlayTransition, function(datum, index, groups) {
|
||||
|
||||
// use on selection
|
||||
svgZoom.translateBy(svgOverlay, 20, 50);
|
||||
// svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateBy(
|
||||
svgOverlay,
|
||||
@@ -376,7 +380,8 @@ svgZoom.translateBy(
|
||||
|
||||
// use on transition
|
||||
svgZoom.translateBy(svgOverlayTransition, 20, 50);
|
||||
// svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateBy(
|
||||
svgOverlayTransition,
|
||||
@@ -427,7 +432,8 @@ svgZoom.translateBy(
|
||||
|
||||
// use on selection
|
||||
svgZoom.translateTo(svgOverlay, 20, 50);
|
||||
// svgZoom.translateTo(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.translateTo(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateTo(
|
||||
svgOverlay,
|
||||
@@ -476,7 +482,8 @@ svgZoom.translateTo(
|
||||
|
||||
// use on transition
|
||||
svgZoom.translateTo(svgOverlayTransition, 20, 50);
|
||||
// svgZoom.translateTo(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.translateTo(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateTo(
|
||||
svgOverlayTransition,
|
||||
@@ -527,7 +534,8 @@ svgZoom.translateTo(
|
||||
|
||||
// use on selection
|
||||
svgZoom.scaleBy(svgOverlay, 3);
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleBy(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@@ -540,7 +548,8 @@ svgZoom.scaleBy(svgOverlay, function(datum, index, groups) {
|
||||
});
|
||||
// use on transition
|
||||
svgZoom.scaleBy(svgOverlayTransition, 3);
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@@ -556,7 +565,8 @@ svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) {
|
||||
|
||||
// use on selection
|
||||
svgZoom.scaleTo(svgOverlay, 3);
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleTo(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@@ -569,7 +579,8 @@ svgZoom.scaleTo(svgOverlay, function(datum, index, groups) {
|
||||
});
|
||||
// use on transition
|
||||
svgZoom.scaleTo(svgOverlayTransition, 3);
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
// $ExpectError
|
||||
svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleTo(svgOverlayTransition, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@@ -616,15 +627,18 @@ const invertedPoint: [number, number] = zTransform.invert([150, 240]);
|
||||
const invertedX: number = zTransform.invertX(150);
|
||||
const invertedY: number = zTransform.invertY(240);
|
||||
|
||||
// TODO: reScaleX, reScaleY
|
||||
|
||||
let linearScale: ScaleLinear<number, number> = scaleLinear();
|
||||
let timeScale: ScaleTime<number, number> = scaleTime();
|
||||
|
||||
linearScale = zTransform.rescaleX(linearScale);
|
||||
linearScale = zTransform.rescaleY(linearScale);
|
||||
|
||||
timeScale = zTransform.rescaleX(timeScale);
|
||||
timeScale = zTransform.rescaleY(timeScale);
|
||||
|
||||
const transformation: string = zTransform.toString();
|
||||
|
||||
zTransform = zTransform.scale(2);
|
||||
zTransform = zTransform.translate(50, 40);
|
||||
|
||||
// zoomIdentity -------------------------------------------------------------
|
||||
|
||||
Vendored
+7
-4
@@ -1,6 +1,9 @@
|
||||
// Type definitions for d3JS d3-zoom module 1.7
|
||||
// Project: https://github.com/d3/d3-zoom/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
|
||||
// Alex Ford <https://github.com/gustavderdrache>
|
||||
// Boris Yankov <https://github.com/borisyankov>
|
||||
// denisname <https://github.com/denisname>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -26,12 +29,12 @@ export type ZoomedElementBaseType = Element;
|
||||
* that can be passed into zoomTransform methods rescaleX and rescaleY
|
||||
*/
|
||||
export interface ZoomScale {
|
||||
domain(): number[];
|
||||
domain(domain: number[]): this;
|
||||
domain(): number[] | Date[];
|
||||
domain(domain: Array<Date | number>): this;
|
||||
range(): number[];
|
||||
range(range: number[]): this;
|
||||
copy(): ZoomScale;
|
||||
invert(value: number): number;
|
||||
invert(value: number): number | Date;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -318,4 +318,4 @@ db.runSqlAsync('DROP TABLE `pets`').then(onResolve);
|
||||
|
||||
/// allAsync(sql, [params])
|
||||
db.allAsync('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test']).then(onResolve);
|
||||
db.allAsync('SELECT * FROM `module_user`').then(onResolve);
|
||||
db.allAsync('SELECT * FROM `module_user`').then(onResolve);
|
||||
|
||||
Vendored
+1
@@ -478,6 +478,7 @@ export namespace Ember {
|
||||
const addObserver: typeof EmberObjectObserversNs.addObserver;
|
||||
const removeObserver: typeof EmberObjectObserversNs.removeObserver;
|
||||
const get: typeof EmberObjectNs.get;
|
||||
const notifyPropertyChange: typeof EmberObjectNs.notifyPropertyChange;
|
||||
const getWithDefault: typeof EmberObjectNs.getWithDefault;
|
||||
const getProperties: typeof EmberObjectNs.getProperties;
|
||||
const setProperties: typeof EmberObjectNs.setProperties;
|
||||
|
||||
@@ -65,4 +65,11 @@ export class Foo2 extends Ember.Object {
|
||||
name
|
||||
});
|
||||
}
|
||||
|
||||
bar() {
|
||||
Ember.notifyPropertyChange(this, 'name');
|
||||
Ember.notifyPropertyChange(this); // $ExpectError
|
||||
Ember.notifyPropertyChange('name'); // $ExpectError
|
||||
Ember.notifyPropertyChange(this, 'name', 'bar'); // $ExpectError
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -385,6 +385,8 @@ export function defineProperty(
|
||||
meta?: any
|
||||
): void;
|
||||
|
||||
export function notifyPropertyChange(obj: object, keyName: string): void;
|
||||
|
||||
declare module '@ember/utils/-private/types' {
|
||||
interface TypeLookup {
|
||||
class: typeof EmberObject;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import EmberObject, { computed } from "@ember/object";
|
||||
import EmberObject, { computed, notifyPropertyChange } from "@ember/object";
|
||||
|
||||
const LifetimeHooks = EmberObject.extend({
|
||||
resource: null as {} | null,
|
||||
@@ -47,6 +47,12 @@ class Foo extends EmberObject {
|
||||
b: 11
|
||||
});
|
||||
}
|
||||
bar() {
|
||||
notifyPropertyChange(this, 'name');
|
||||
notifyPropertyChange(this); // $ExpectError
|
||||
notifyPropertyChange('name'); // $ExpectError
|
||||
notifyPropertyChange(this, 'name', 'bar'); // $ExpectError
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: enable after TS 3.0 https://github.com/typed-ember/ember-cli-typescript/issues/291
|
||||
|
||||
+119
-18
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { Text } from 'react-native';
|
||||
import { Text, AccessibilityInfo } from 'react-native';
|
||||
|
||||
import {
|
||||
Accelerometer,
|
||||
@@ -8,40 +8,46 @@ import {
|
||||
AdMobInterstitial,
|
||||
AdMobRewarded,
|
||||
Amplitude,
|
||||
Asset,
|
||||
AuthSession,
|
||||
Audio,
|
||||
AppLoading,
|
||||
Asset,
|
||||
Audio,
|
||||
AuthSession,
|
||||
BarCodeScanner,
|
||||
BlurViewProps,
|
||||
BlurView,
|
||||
Brightness,
|
||||
Calendar,
|
||||
Camera,
|
||||
CameraObject,
|
||||
Constants,
|
||||
DocumentPicker,
|
||||
EdgeInsets,
|
||||
EdgePadding,
|
||||
EventUserLocation,
|
||||
Facebook,
|
||||
FacebookAds,
|
||||
FileSystem,
|
||||
ImagePicker,
|
||||
ImageManipulator,
|
||||
FaceDetector,
|
||||
Linking,
|
||||
Svg,
|
||||
FileSystem,
|
||||
Haptic,
|
||||
ImageManipulator,
|
||||
ImagePicker,
|
||||
IntentLauncherAndroid,
|
||||
KeepAwake,
|
||||
KmlMapEvent,
|
||||
LinearGradient,
|
||||
Linking,
|
||||
Location,
|
||||
MailComposer,
|
||||
MapEvent,
|
||||
MapStyleElement,
|
||||
MapView,
|
||||
MediaLibrary,
|
||||
Permissions,
|
||||
PublisherBanner,
|
||||
Region,
|
||||
registerRootComponent,
|
||||
ScreenOrientation,
|
||||
SQLite,
|
||||
Calendar,
|
||||
MailComposer,
|
||||
Location,
|
||||
Updates,
|
||||
MediaLibrary,
|
||||
Haptic,
|
||||
Constants
|
||||
Svg,
|
||||
Updates
|
||||
} from 'expo';
|
||||
|
||||
const reverseGeocode: Promise<Location.GeocodeData[]> = Location.reverseGeocodeAsync({
|
||||
@@ -837,6 +843,100 @@ async () => {
|
||||
result.status === 'saved';
|
||||
};
|
||||
|
||||
// #region MapView
|
||||
const initialRegion: Region = {
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
latitudeDelta: 0,
|
||||
longitudeDelta: 0,
|
||||
};
|
||||
|
||||
const edgePadding: EdgePadding = {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
};
|
||||
|
||||
const edgeInsets: EdgeInsets = {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
};
|
||||
|
||||
const mapStyleElements: MapStyleElement[] = [{
|
||||
featureType: 'featureType',
|
||||
elementType: 'elementType',
|
||||
stylers: [{}, {}],
|
||||
}];
|
||||
|
||||
const mapEventCallback = (event: MapEvent) => console.log(event);
|
||||
const regionCallback = (region: Region) => console.log(region);
|
||||
const kmlCallback = (kml: KmlMapEvent) => console.log(kml);
|
||||
const userLocationCallback = (event: EventUserLocation) => console.log(event);
|
||||
|
||||
() => (
|
||||
<MapView
|
||||
provider="google"
|
||||
customMapStyle={mapStyleElements}
|
||||
customMapStyleString="some-string"
|
||||
showsUserLocation={true}
|
||||
userLocationAnnotationTitle="title"
|
||||
showsMyLocationButton={true}
|
||||
followsUserLocation={true}
|
||||
showsPointsOfInterest={true}
|
||||
showsCompass={true}
|
||||
zoomEnabled={true}
|
||||
zoomControlEnabled={true}
|
||||
rotateEnabled={true}
|
||||
cacheEnabled={true}
|
||||
loadingEnabled={true}
|
||||
loadingBackgroundColor="#000"
|
||||
loadingIndicatorColor="#000"
|
||||
scrollEnabled={true}
|
||||
pitchEnabled={true}
|
||||
toolbarEnabled={true}
|
||||
moveOnMarkerPress={true}
|
||||
showsScale={true}
|
||||
showsBuildings={true}
|
||||
showsTraffic={true}
|
||||
showsIndoors={true}
|
||||
showsIndoorLevelPicker={true}
|
||||
mapType="standard"
|
||||
region={initialRegion}
|
||||
initialRegion={initialRegion}
|
||||
liteMode={true}
|
||||
mapPadding={edgePadding}
|
||||
maxDelta={0}
|
||||
minDelta={0}
|
||||
legalLabelInsets={edgeInsets}
|
||||
|
||||
onMapReady={() => ({})}
|
||||
onKmlReady={kmlCallback}
|
||||
onRegionChange={regionCallback}
|
||||
onRegionChangeComplete={regionCallback}
|
||||
onPress={mapEventCallback}
|
||||
onLongPress={mapEventCallback}
|
||||
onUserLocationChange={userLocationCallback}
|
||||
onPanDrag={mapEventCallback}
|
||||
onPoiClick={(event: MapEvent<{ placeId: string, name: string }>) => console.log(event)}
|
||||
onMarkerPress={(event: MapEvent<{ action: 'marker-press', id: string }>) => console.log(event)}
|
||||
onMarkerSelect={(event: MapEvent<{ action: 'marker-select', id: string }>) => console.log(event)}
|
||||
onMarkerDeselect={(event: MapEvent<{ action: 'marker-deselect', id: string }>) => console.log(event)}
|
||||
onCalloutPress={(event: MapEvent<{ action: 'callout-press' }>) => console.log(event)}
|
||||
onMarkerDragStart={mapEventCallback}
|
||||
onMarkerDrag={mapEventCallback}
|
||||
onMarkerDragEnd={mapEventCallback}
|
||||
|
||||
minZoomLevel={0}
|
||||
maxZoomLevel={0}
|
||||
kmlSrc="src"
|
||||
style={{ flex: 1 }}
|
||||
/>
|
||||
);
|
||||
// #endegion
|
||||
|
||||
async () => {
|
||||
const updateEventListener: Updates.UpdateEventListener = ({ type, manifest, message }) => {
|
||||
switch (type) {
|
||||
@@ -916,6 +1016,7 @@ async () => {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// #region MediaLibrary
|
||||
async () => {
|
||||
const mlAsset: MediaLibrary.Asset = await MediaLibrary.createAssetAsync('localUri');
|
||||
|
||||
Vendored
+3
@@ -16,6 +16,9 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export * from 'react-native-maps';
|
||||
export { default as MapView } from 'react-native-maps';
|
||||
|
||||
import { EventSubscription } from 'fbemitter';
|
||||
import { Component, ComponentClass, Ref, ComponentType } from 'react';
|
||||
import {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"react-native-maps": "*"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import fileType = require("file-type");
|
||||
|
||||
// $ExpectType FileTypeResult | null
|
||||
fileType(new Buffer([0xFF, 0xD8, 0xFF]));
|
||||
fileType(new Uint8Array([0xFF, 0xD8, 0xFF]));
|
||||
|
||||
const minimumBytes: number = fileType.minimumBytes;
|
||||
// $ExpectType number
|
||||
fileType.minimumBytes;
|
||||
|
||||
Vendored
+16
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for file-type 5.2
|
||||
// Type definitions for file-type 10.6
|
||||
// Project: https://github.com/sindresorhus/file-type
|
||||
// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk <https://github.com/tcaesvk>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
@@ -8,7 +8,17 @@
|
||||
|
||||
export = FileType;
|
||||
|
||||
declare function FileType(buf: Buffer | Uint8Array): FileType.FileTypeResult;
|
||||
/**
|
||||
* The file type is detected by checking the
|
||||
* [magic number](http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.
|
||||
*
|
||||
* @param buf It only needs the first `.minimumBytes` bytes. The exception is detection of
|
||||
* `docx`, `pptx`, and `xlsx` which potentially requires reading the whole file.
|
||||
* @returns an Object with:
|
||||
* - ext - One of the [supported file types](https://github.com/sindresorhus/file-type/blob/master/readme.md#supported-file-types)
|
||||
* - mime - The [MIME type](http://en.wikipedia.org/wiki/Internet_media_type)
|
||||
*/
|
||||
declare function FileType(buf: Buffer | Uint8Array): FileType.FileTypeResult | null;
|
||||
|
||||
declare namespace FileType {
|
||||
interface FileTypeResult {
|
||||
@@ -16,5 +26,9 @@ declare namespace FileType {
|
||||
mime: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum amount of bytes needed to detect a file type. Currently,
|
||||
* it's 4100 bytes, but it can change, so don't hard-code it.
|
||||
*/
|
||||
const minimumBytes: number;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"file-type-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1428,7 +1428,7 @@ export interface RouteOptionsPreObject {
|
||||
/**
|
||||
* key name used to assign the response of the method to in request.pre and request.preResponses.
|
||||
*/
|
||||
assign: string;
|
||||
assign?: string;
|
||||
/**
|
||||
* A failAction value which determine what to do when a pre-handler method throws an error. If assign is specified and the failAction setting is not 'error', the error will be assigned.
|
||||
*/
|
||||
|
||||
Vendored
+8
-3
@@ -1,7 +1,12 @@
|
||||
// Type definitions for internal-ip 2.0
|
||||
// Type definitions for internal-ip 3.0
|
||||
// Project: https://github.com/sindresorhus/internal-ip#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function v6(): Promise<string>;
|
||||
export function v4(): Promise<string>;
|
||||
export const v6: IPGetterFn;
|
||||
export const v4: IPGetterFn;
|
||||
|
||||
export interface IPGetterFn { // tslint:disable-line:interface-name
|
||||
(): Promise<string | null>;
|
||||
sync(): string | null;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import * as internalIp from 'internal-ip';
|
||||
|
||||
let str: string;
|
||||
internalIp.v6().then(ip => {
|
||||
str = ip;
|
||||
// $ExpectType string | null
|
||||
ip;
|
||||
});
|
||||
// $ExpectType string | null
|
||||
internalIp.v6.sync();
|
||||
|
||||
internalIp.v4().then(ip => {
|
||||
str = ip;
|
||||
// $ExpectType string | null
|
||||
ip;
|
||||
});
|
||||
// $ExpectType string | null
|
||||
internalIp.v4.sync();
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"internal-ip-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for internal-ip 2.0
|
||||
// Project: https://github.com/sindresorhus/internal-ip#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function v6(): Promise<string>;
|
||||
export function v4(): Promise<string>;
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as internalIp from 'internal-ip';
|
||||
|
||||
let str: string;
|
||||
internalIp.v6().then(ip => {
|
||||
str = ip;
|
||||
});
|
||||
|
||||
internalIp.v4().then(ip => {
|
||||
str = ip;
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"internal-ip": [
|
||||
"internal-ip/v2"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"internal-ip-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+19
-13
@@ -7304,10 +7304,12 @@ $( "body" ).on( "click", "p", foo );
|
||||
$( "body" ).off( "click", "p", foo );
|
||||
```
|
||||
*/
|
||||
off(events: string,
|
||||
off<TType extends string>(
|
||||
events: TType,
|
||||
selector: JQuery.Selector,
|
||||
handler: JQuery.TypeEventHandler<TElement, any, any, any, string> |
|
||||
false): this;
|
||||
handler: JQuery.TypeEventHandler<TElement, any, any, any, TType> |
|
||||
false
|
||||
): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as
|
||||
@@ -7337,10 +7339,12 @@ $( "form" ).on( "keypress.validator", "input[type='text']", validate );
|
||||
$( "form" ).off( ".validator" );
|
||||
```
|
||||
*/
|
||||
off(events: string,
|
||||
off<TType extends string>(
|
||||
events: TType,
|
||||
selector_handler?: JQuery.Selector |
|
||||
JQuery.TypeEventHandler<TElement, any, any, any, string> |
|
||||
false): this;
|
||||
JQuery.TypeEventHandler<TElement, any, any, any, TType> |
|
||||
false
|
||||
): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
* @param events An object where the string keys represent one or more space-separated event types and optional
|
||||
@@ -11968,9 +11972,10 @@ $( "p" ).bind( "click", foo ); // ... Now foo will be called when paragraphs are
|
||||
$( "p" ).unbind( "click", foo ); // ... foo will no longer be called.
|
||||
```
|
||||
*/
|
||||
unbind(event: string,
|
||||
handler: JQuery.TypeEventHandler<TElement, any, TElement, TElement, string> |
|
||||
false
|
||||
unbind<TType extends string>(
|
||||
event: TType,
|
||||
handler: JQuery.TypeEventHandler<TElement, any, TElement, TElement, TType> |
|
||||
false
|
||||
): this;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
@@ -12062,10 +12067,11 @@ $( "body" ).delegate( "p", "click", foo );
|
||||
$( "body" ).undelegate( "p", "click", foo );
|
||||
```
|
||||
*/
|
||||
undelegate(selector: JQuery.Selector,
|
||||
eventType: string,
|
||||
handler: JQuery.TypeEventHandler<TElement, any, any, any, string> |
|
||||
false
|
||||
undelegate<TType extends string>(
|
||||
selector: JQuery.Selector,
|
||||
eventType: TType,
|
||||
handler: JQuery.TypeEventHandler<TElement, any, any, any, TType> |
|
||||
false
|
||||
): this;
|
||||
/**
|
||||
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
|
||||
|
||||
Vendored
+11
-6
@@ -148,21 +148,26 @@ $( "div", xml.responseXML );
|
||||
$( document.body ).css( "background", "black" );
|
||||
```
|
||||
*/
|
||||
// Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810)
|
||||
<T extends Element>(element: T): JQuery<T>;
|
||||
// NOTE: `HTMLSelectElement` is both an Element and an Array-Like Object but jQuery treats it as an Element.
|
||||
(element: HTMLSelectElement): JQuery<HTMLSelectElement>;
|
||||
/**
|
||||
* Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
|
||||
* @param elementArray An array containing a set of DOM elements to wrap in a jQuery object.
|
||||
* @param element_elementArray _@param_ `element_elementArray`
|
||||
* <br>
|
||||
* * `element` — A DOM element to wrap in a jQuery object. <br>
|
||||
* * `elementArray` — An array containing a set of DOM elements to wrap in a jQuery object.
|
||||
* @see \`{@link https://api.jquery.com/jQuery/ }\`
|
||||
* @since 1.0
|
||||
* @example ````Set the background color of the page to black.
|
||||
```javascript
|
||||
$( document.body ).css( "background", "black" );
|
||||
```
|
||||
* @example ````Hide all the input elements within a form.
|
||||
```javascript
|
||||
$( myForm.elements ).hide();
|
||||
```
|
||||
*/
|
||||
// Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810)
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
<T extends Element>(elementArray: T[]): JQuery<T>;
|
||||
<T extends Element>(element_elementArray: T | ArrayLike<T>): JQuery<T>;
|
||||
/**
|
||||
* Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
|
||||
* @param selection An existing jQuery object to clone.
|
||||
|
||||
@@ -160,6 +160,9 @@ function JQueryStatic() {
|
||||
// $ExpectType JQuery<HTMLSelectElement>
|
||||
$([new HTMLSelectElement()]);
|
||||
|
||||
// $ExpectType JQuery<HTMLParagraphElement>
|
||||
$(document.querySelectorAll('p'));
|
||||
|
||||
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19597#issuecomment-378218432
|
||||
function issue_19597_378218432() {
|
||||
const myDiv = $(document.createElement('div'));
|
||||
@@ -3969,12 +3972,17 @@ function JQuery() {
|
||||
|
||||
function customData(this: HTMLElement, event: JQuery.TriggeredEvent<HTMLElement, string>) { }
|
||||
|
||||
function specificEventType(this: HTMLElement, event: JQuery.MouseDownEvent<HTMLElement>) { }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('mousedown', 'td', specificEventType);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', false);
|
||||
|
||||
@@ -3987,6 +3995,9 @@ function JQuery() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('mousedown', specificEventType);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', false);
|
||||
|
||||
@@ -4486,12 +4497,17 @@ function JQuery() {
|
||||
|
||||
function customData(this: HTMLElement, event: JQuery.TriggeredEvent<HTMLElement, string>) { }
|
||||
|
||||
function specificEventType(this: HTMLElement, event: JQuery.MouseDownEvent<HTMLElement>) { }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').unbind('myEvent', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').unbind('myEvent', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').unbind('mousedown', specificEventType);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').unbind('myEvent', false);
|
||||
|
||||
@@ -4511,12 +4527,17 @@ function JQuery() {
|
||||
|
||||
function customData(this: HTMLElement, event: JQuery.TriggeredEvent<HTMLElement, string>) { }
|
||||
|
||||
function specificEventType(this: HTMLElement, event: JQuery.MouseDownEvent<HTMLElement>) { }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').undelegate('td', 'click', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').undelegate('td', 'click', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').undelegate('td', 'mousedown', specificEventType);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').undelegate('td', 'click', false);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ matchMediaMock('(max-width: 991px)').matches // false
|
||||
matchMediaMock('(max-width: 1240px)').matches // true
|
||||
|
||||
const mediaQueryList = matchMediaMock('(max-width: 991px)');
|
||||
const listener = (mql: MediaQueryList) => { };
|
||||
const listener = function (this: MediaQueryList) { };
|
||||
|
||||
mediaQueryList.addListener(listener)
|
||||
mediaQueryList.removeListener(listener)
|
||||
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
declare namespace M {
|
||||
/**
|
||||
* Automatically initialize components.
|
||||
*/
|
||||
function AutoInit(context?: Element): void;
|
||||
}
|
||||
Vendored
+1
@@ -9,6 +9,7 @@
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference path="./autocomplete.d.ts" />
|
||||
/// <reference path="./autoinit.d.ts" />
|
||||
/// <reference path="./carousel.d.ts" />
|
||||
/// <reference path="./character-counter.d.ts" />
|
||||
/// <reference path="./chips.d.ts" />
|
||||
|
||||
Vendored
+264
@@ -1912,6 +1912,90 @@ declare module "inspector" {
|
||||
}
|
||||
}
|
||||
|
||||
namespace NodeTracing {
|
||||
interface TraceConfig {
|
||||
/**
|
||||
* Controls how the trace buffer stores data.
|
||||
*/
|
||||
recordMode?: string;
|
||||
/**
|
||||
* Included category filters.
|
||||
*/
|
||||
includedCategories: string[];
|
||||
}
|
||||
|
||||
interface StartParameterType {
|
||||
traceConfig: TraceConfig;
|
||||
}
|
||||
|
||||
interface GetCategoriesReturnType {
|
||||
/**
|
||||
* A list of supported tracing categories.
|
||||
*/
|
||||
categories: string[];
|
||||
}
|
||||
|
||||
interface DataCollectedEventDataType {
|
||||
value: Array<{}>;
|
||||
}
|
||||
}
|
||||
|
||||
namespace NodeWorker {
|
||||
type WorkerID = string;
|
||||
|
||||
/**
|
||||
* Unique identifier of attached debugging session.
|
||||
*/
|
||||
type SessionID = string;
|
||||
|
||||
interface WorkerInfo {
|
||||
workerId: WorkerID;
|
||||
type: string;
|
||||
title: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface SendMessageToWorkerParameterType {
|
||||
message: string;
|
||||
/**
|
||||
* Identifier of the session.
|
||||
*/
|
||||
sessionId: SessionID;
|
||||
}
|
||||
|
||||
interface EnableParameterType {
|
||||
/**
|
||||
* Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger`
|
||||
* message to run them.
|
||||
*/
|
||||
waitForDebuggerOnStart: boolean;
|
||||
}
|
||||
|
||||
interface AttachedToWorkerEventDataType {
|
||||
/**
|
||||
* Identifier assigned to the session used to send/receive messages.
|
||||
*/
|
||||
sessionId: SessionID;
|
||||
workerInfo: WorkerInfo;
|
||||
waitingForDebugger: boolean;
|
||||
}
|
||||
|
||||
interface DetachedFromWorkerEventDataType {
|
||||
/**
|
||||
* Detached session identifier.
|
||||
*/
|
||||
sessionId: SessionID;
|
||||
}
|
||||
|
||||
interface ReceivedMessageFromWorkerEventDataType {
|
||||
/**
|
||||
* Identifier of a session which sends a message.
|
||||
*/
|
||||
sessionId: SessionID;
|
||||
message: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The inspector.Session is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications.
|
||||
*/
|
||||
@@ -1958,6 +2042,7 @@ declare module "inspector" {
|
||||
* `messageAdded` notification.
|
||||
*/
|
||||
post(method: "Console.enable", callback?: (err: Error | null) => void): void;
|
||||
|
||||
/**
|
||||
* Continues execution until specific location is reached.
|
||||
*/
|
||||
@@ -2155,6 +2240,7 @@ declare module "inspector" {
|
||||
* Steps over the statement.
|
||||
*/
|
||||
post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void;
|
||||
|
||||
/**
|
||||
* Enables console to refer to the node with given id via $x (see Command Line API for more details
|
||||
* $x functions).
|
||||
@@ -2193,6 +2279,7 @@ declare module "inspector" {
|
||||
|
||||
post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void;
|
||||
post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void;
|
||||
|
||||
post(method: "Profiler.disable", callback?: (err: Error | null) => void): void;
|
||||
|
||||
post(method: "Profiler.enable", callback?: (err: Error | null) => void): void;
|
||||
@@ -2250,6 +2337,7 @@ declare module "inspector" {
|
||||
* @experimental
|
||||
*/
|
||||
post(method: "Profiler.takeTypeProfile", callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void;
|
||||
|
||||
/**
|
||||
* Add handler to promise with given promise object id.
|
||||
*/
|
||||
@@ -2360,11 +2448,47 @@ declare module "inspector" {
|
||||
* @experimental
|
||||
*/
|
||||
post(method: "Runtime.terminateExecution", callback?: (err: Error | null) => void): void;
|
||||
|
||||
/**
|
||||
* Returns supported domains.
|
||||
*/
|
||||
post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void;
|
||||
|
||||
/**
|
||||
* Gets supported tracing categories.
|
||||
*/
|
||||
post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void;
|
||||
|
||||
/**
|
||||
* Start trace events collection.
|
||||
*/
|
||||
post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void;
|
||||
post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void;
|
||||
|
||||
/**
|
||||
* Stop trace events collection. Remaining collected events will be sent as a sequence of
|
||||
* dataCollected events followed by tracingComplete event.
|
||||
*/
|
||||
post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void;
|
||||
|
||||
/**
|
||||
* Sends protocol message over session with given id.
|
||||
*/
|
||||
post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void;
|
||||
post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void;
|
||||
|
||||
/**
|
||||
* Instructs the inspector to attach to running workers. Will also attach to new workers
|
||||
* as they start
|
||||
*/
|
||||
post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void;
|
||||
post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void;
|
||||
|
||||
/**
|
||||
* Detaches from all running workers and disables attaching to new workers as they are started.
|
||||
*/
|
||||
post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void;
|
||||
|
||||
// Events
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
@@ -2464,6 +2588,33 @@ declare module "inspector" {
|
||||
*/
|
||||
addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Contains an bucket of collected trace events.
|
||||
*/
|
||||
addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
|
||||
* delivered via dataCollected events.
|
||||
*/
|
||||
addListener(event: "NodeTracing.tracingComplete", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Issued when attached to a worker.
|
||||
*/
|
||||
addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Issued when detached from the worker.
|
||||
*/
|
||||
addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Notifies about a new protocol message received from the session
|
||||
* (session ID is provided in attachedToWorker notification).
|
||||
*/
|
||||
addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "inspectorNotification", message: InspectorNotification<{}>): boolean;
|
||||
emit(event: "Console.messageAdded", message: InspectorNotification<Console.MessageAddedEventDataType>): boolean;
|
||||
@@ -2486,6 +2637,11 @@ declare module "inspector" {
|
||||
emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification<Runtime.ExecutionContextDestroyedEventDataType>): boolean;
|
||||
emit(event: "Runtime.executionContextsCleared"): boolean;
|
||||
emit(event: "Runtime.inspectRequested", message: InspectorNotification<Runtime.InspectRequestedEventDataType>): boolean;
|
||||
emit(event: "NodeTracing.dataCollected", message: InspectorNotification<NodeTracing.DataCollectedEventDataType>): boolean;
|
||||
emit(event: "NodeTracing.tracingComplete"): boolean;
|
||||
emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>): boolean;
|
||||
emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>): boolean;
|
||||
emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
|
||||
@@ -2584,6 +2740,33 @@ declare module "inspector" {
|
||||
*/
|
||||
on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Contains an bucket of collected trace events.
|
||||
*/
|
||||
on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
|
||||
* delivered via dataCollected events.
|
||||
*/
|
||||
on(event: "NodeTracing.tracingComplete", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Issued when attached to a worker.
|
||||
*/
|
||||
on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Issued when detached from the worker.
|
||||
*/
|
||||
on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Notifies about a new protocol message received from the session
|
||||
* (session ID is provided in attachedToWorker notification).
|
||||
*/
|
||||
on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
|
||||
/**
|
||||
@@ -2681,6 +2864,33 @@ declare module "inspector" {
|
||||
*/
|
||||
once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Contains an bucket of collected trace events.
|
||||
*/
|
||||
once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
|
||||
* delivered via dataCollected events.
|
||||
*/
|
||||
once(event: "NodeTracing.tracingComplete", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Issued when attached to a worker.
|
||||
*/
|
||||
once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Issued when detached from the worker.
|
||||
*/
|
||||
once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Notifies about a new protocol message received from the session
|
||||
* (session ID is provided in attachedToWorker notification).
|
||||
*/
|
||||
once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
|
||||
/**
|
||||
@@ -2778,6 +2988,33 @@ declare module "inspector" {
|
||||
*/
|
||||
prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Contains an bucket of collected trace events.
|
||||
*/
|
||||
prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
|
||||
* delivered via dataCollected events.
|
||||
*/
|
||||
prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Issued when attached to a worker.
|
||||
*/
|
||||
prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Issued when detached from the worker.
|
||||
*/
|
||||
prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Notifies about a new protocol message received from the session
|
||||
* (session ID is provided in attachedToWorker notification).
|
||||
*/
|
||||
prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
|
||||
/**
|
||||
@@ -2874,6 +3111,33 @@ declare module "inspector" {
|
||||
* call).
|
||||
*/
|
||||
prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Contains an bucket of collected trace events.
|
||||
*/
|
||||
prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
|
||||
* delivered via dataCollected events.
|
||||
*/
|
||||
prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Issued when attached to a worker.
|
||||
*/
|
||||
prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Issued when detached from the worker.
|
||||
*/
|
||||
prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
|
||||
|
||||
/**
|
||||
* Notifies about a new protocol message received from the session
|
||||
* (session ID is provided in attachedToWorker notification).
|
||||
*/
|
||||
prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
|
||||
}
|
||||
|
||||
// Top Level API
|
||||
|
||||
@@ -4725,6 +4725,10 @@ import * as constants from 'constants';
|
||||
const pauseReason: string = message.params.reason;
|
||||
});
|
||||
session.on('Debugger.resumed', () => {});
|
||||
// Node Inspector events
|
||||
session.on('NodeTracing.dataCollected', (message: inspector.InspectorNotification<inspector.NodeTracing.DataCollectedEventDataType>) => {
|
||||
const value: Array<{}> = message.params.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,10 +66,11 @@ export const createListeners = (events: Event[]): string[] => {
|
||||
"",
|
||||
...createListenerBlockFn("prependOnceListener")(events),
|
||||
].reduce((acc, next, index, arr) => {
|
||||
// removes trailing and consecutive empty lines
|
||||
// removes leading, trailing and consecutive empty lines
|
||||
const isFirst = index === 0;
|
||||
const isLast = index === arr.length - 1;
|
||||
const followsEmptyLine = acc.length > 0 && acc[acc.length - 1] === "";
|
||||
if ((isLast || followsEmptyLine) && next === "") {
|
||||
if ((isFirst || isLast || followsEmptyLine) && next === "") {
|
||||
return acc;
|
||||
} else {
|
||||
acc.push(next);
|
||||
|
||||
@@ -4,17 +4,21 @@ import { capitalize, createDocs, flattenArgs, hasElements, isObjectReference } f
|
||||
|
||||
const INDENT = " ";
|
||||
|
||||
// Turns a type into a type representing an array of that type
|
||||
const arrify = (typeString: string) => {
|
||||
return typeString === '{}' ? `Array<${typeString}>` : `${typeString}[]`;
|
||||
}
|
||||
|
||||
// Converts DevTools type to TS type
|
||||
const createTypeString = (type: schema.Field, domain?: string): string => {
|
||||
return isObjectReference(type) ? type.$ref :
|
||||
type.type === "any" ? "any" :
|
||||
type.type === "any" ? "any" :
|
||||
type.type === "integer" ? "number" :
|
||||
type.type === "number" ? "number" :
|
||||
type.type === "boolean" ? "boolean" :
|
||||
type.type === "string" ? "string" :
|
||||
type.type === "array" ? `${createTypeString(type.items, domain)}[]` :
|
||||
type.type === "object" ? "{}" // this code path is likely never exercised
|
||||
: "never";
|
||||
type.type === "array" ? arrify(createTypeString(type.items, domain)) :
|
||||
type.type === "object" ? "{}" : "never"; // "never" has yet to be observed
|
||||
};
|
||||
|
||||
// Helper for createInterface -- constructs a list of interface fields
|
||||
@@ -138,7 +142,7 @@ export const generateSubstituteArgs = (protocol: schema.Schema): { [propName: st
|
||||
.map(item => item.commands
|
||||
.map(command => createPostFunctions(command, item.domain))
|
||||
.reduce(flattenArgs(""), []))
|
||||
.reduce(flattenArgs(), []);
|
||||
.reduce(flattenArgs(""), []);
|
||||
|
||||
const eventOverloads: string[] = createListeners(protocol.domains
|
||||
.map(item => {
|
||||
|
||||
@@ -2,25 +2,55 @@
|
||||
// [tag] corresponds to a tag name in the node-core repository.
|
||||
|
||||
import { execSync } from "child_process";
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
||||
import { existsSync, readFileSync, writeFileSync } from "fs";
|
||||
import * as https from "https";
|
||||
import * as schema from "./devtools-protocol-schema";
|
||||
import { generateSubstituteArgs } from "./generate-substitute-args";
|
||||
import { flattenArgs, substitute, trimRight } from "./utils";
|
||||
import { substitute, trimRight } from "./utils";
|
||||
import { string } from "parsimmon";
|
||||
|
||||
const httpsGet = (url: string) => new Promise<string>((resolve, reject) => {
|
||||
https.get(url, res => {
|
||||
const frames: Buffer[] = [];
|
||||
res.on("data", (data: Buffer) => {
|
||||
frames.push(data);
|
||||
});
|
||||
res.on("end", () => {
|
||||
resolve(Buffer.concat(frames).toString("utf8"));
|
||||
});
|
||||
res.on("error", (err: Error) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Input arguments
|
||||
const tag = process.argv[2] || process.version;
|
||||
|
||||
const PROTOCOL_URL = `https://raw.githubusercontent.com/nodejs/node/${tag}/deps/v8/src/inspector/js_protocol.json`;
|
||||
|
||||
const devToolsPath = `${__dirname}/../../node_modules/devtools-protocol`;
|
||||
|
||||
function writeProtocolToFile(json: string) {
|
||||
const protocol: schema.Schema = JSON.parse(json);
|
||||
const V8_PROTOCOL_URL = `https://raw.githubusercontent.com/nodejs/node/${tag}/deps/v8/src/inspector/js_protocol.json`;
|
||||
const NODE_PROTOCOL_URL = `https://raw.githubusercontent.com/nodejs/node/${tag}/src/inspector/node_protocol.pdl`;
|
||||
const INSPECTOR_PROTOCOL_REMOTE = `https://chromium.googlesource.com/deps/inspector_protocol`;
|
||||
const INSPECTOR_PROTOCOL_LOCAL_DIR = "/tmp/inspector_protocol";
|
||||
|
||||
/**
|
||||
* Given a list of Inspector protocol definitions, write an inspector.d.ts
|
||||
* containing all of those definitions merged together.
|
||||
* @param jsonProtocols A list of Inspector protocol definitions.
|
||||
*/
|
||||
function writeProtocolsToFile(jsonProtocols: string[]) {
|
||||
const combinedProtocol: schema.Schema = {
|
||||
version: { major: '', minor: '' }, // doesn't matter
|
||||
domains: []
|
||||
};
|
||||
for (const json of jsonProtocols) {
|
||||
if (json) {
|
||||
const protocol: schema.Schema = JSON.parse(json);
|
||||
combinedProtocol.domains.push(...protocol.domains);
|
||||
}
|
||||
}
|
||||
const substituteArgs = generateSubstituteArgs(combinedProtocol);
|
||||
const template = readFileSync(`${__dirname}/inspector.d.ts.template`, "utf8");
|
||||
|
||||
const substituteArgs = generateSubstituteArgs(protocol);
|
||||
|
||||
const inspectorDts = substitute(template, substituteArgs).split("\n")
|
||||
.map(line => trimRight(line))
|
||||
.join("\n");
|
||||
@@ -28,12 +58,24 @@ function writeProtocolToFile(json: string) {
|
||||
writeFileSync("./inspector.d.ts", inspectorDts, "utf8");
|
||||
}
|
||||
|
||||
https.get(PROTOCOL_URL, res => {
|
||||
const frames: Buffer[] = [];
|
||||
res.on("data", (data: Buffer) => {
|
||||
frames.push(data);
|
||||
});
|
||||
res.on("end", () => {
|
||||
writeProtocolToFile(Buffer.concat(frames).toString("utf8"));
|
||||
});
|
||||
});
|
||||
/**
|
||||
* Given a PDL-formatted string, return a JSON-formatted string.
|
||||
* Note that this function run blocking shell commands, as it depends on an
|
||||
* external script to do the conversion.
|
||||
* @param pdl A PDL-formatted string.
|
||||
*/
|
||||
function convertPdlToJson(pdl: string): string {
|
||||
if (!existsSync(INSPECTOR_PROTOCOL_LOCAL_DIR)) {
|
||||
execSync(`git clone ${INSPECTOR_PROTOCOL_REMOTE} ${INSPECTOR_PROTOCOL_LOCAL_DIR}`);
|
||||
}
|
||||
writeFileSync("/tmp/inspector_protocol.pdl", pdl);
|
||||
execSync(`${INSPECTOR_PROTOCOL_LOCAL_DIR}/convert_protocol_to_json.py /tmp/inspector_protocol.pdl /tmp/inspector_protocol.json`);
|
||||
return readFileSync("/tmp/inspector_protocol.json", 'utf8');
|
||||
}
|
||||
|
||||
// "Main" -- get the V8 built-in inspector protocol definition, as well as the
|
||||
// Node extensions, and then write this to inspector.d.ts.
|
||||
Promise.all([
|
||||
httpsGet(V8_PROTOCOL_URL),
|
||||
httpsGet(NODE_PROTOCOL_URL).then(convertPdlToJson).catch(() => '')
|
||||
]).then(writeProtocolsToFile).catch(console.error);
|
||||
|
||||
Vendored
+2
-2
@@ -9421,7 +9421,7 @@ declare namespace Office {
|
||||
}
|
||||
|
||||
/**
|
||||
* The InternetHeaders object represents properties that are preserved after the item leaves Exchange and converted to a MIME message.
|
||||
* The InternetHeaders object represents properties that are preserved after the message item leaves Exchange and is converted to a MIME message.
|
||||
* These properties are stored as x-headers in the MIME message.
|
||||
*
|
||||
* InternetHeaders are stored as key/value pairs on a per-item basis.
|
||||
@@ -15225,7 +15225,7 @@ declare namespace Office {
|
||||
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose or read</td></tr></table>
|
||||
*
|
||||
* Item IDs retrieved via EWS or via the itemId property use a different format than the format used by REST APIs (such as the
|
||||
* {@link https://docs.microsoft.com/previous-versions/office/office-365-api/api/version-2.0/mail-rest-operations | Outlook Mail API} or the {@link http://graph.microsoft.io/ | Microsoft Graph}.
|
||||
* {@link https://docs.microsoft.com/previous-versions/office/office-365-api/api/version-2.0/mail-rest-operations | Outlook Mail API} or the {@link https://graph.microsoft.io/ | Microsoft Graph}.
|
||||
* The convertToRestId method converts an EWS-formatted ID into the proper format for REST.
|
||||
*
|
||||
* @param itemId An item ID formatted for Exchange Web Services (EWS)
|
||||
|
||||
Vendored
+7
-3
@@ -1,12 +1,16 @@
|
||||
// Type definitions for public-ip 2.3
|
||||
// Type definitions for public-ip 2.4
|
||||
// Project: https://github.com/sindresorhus/public-ip#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function v4(options?: Options): Promise<string>;
|
||||
export function v6(options?: Options): Promise<string>;
|
||||
export function v4(options?: Options): CancelablePromise<string>;
|
||||
export function v6(options?: Options): CancelablePromise<string>;
|
||||
|
||||
export interface Options {
|
||||
https?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export type CancelablePromise<T> = Promise<T> & {
|
||||
cancel(): void;
|
||||
};
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import * as publicIp from 'public-ip';
|
||||
|
||||
let str: string;
|
||||
publicIp.v4().then(ip => {
|
||||
str = ip;
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v4({https: false, timeout: 10}).then(ip => {
|
||||
str = ip;
|
||||
publicIp.v4({ https: false, timeout: 10 }).then(ip => {
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v4().cancel();
|
||||
|
||||
publicIp.v6().then(ip => {
|
||||
str = ip;
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v6({https: false, timeout: 10}).then(ip => {
|
||||
str = ip;
|
||||
publicIp.v6({ https: false, timeout: 10 }).then(ip => {
|
||||
ip; // $ExpectType string
|
||||
});
|
||||
publicIp.v6().cancel();
|
||||
|
||||
Vendored
+20
-16
@@ -15,6 +15,10 @@
|
||||
import * as React from "react";
|
||||
import * as Popper from "popper.js";
|
||||
|
||||
export function registerLocale(localeName: string, localeData: {}): void;
|
||||
export function setDefaultLocale(localeName: string): void;
|
||||
export function getDefaultLocale(): string;
|
||||
|
||||
export interface ReactDatePickerProps {
|
||||
adjustDateOnChange?: boolean;
|
||||
allowSameDay?: boolean;
|
||||
@@ -24,6 +28,7 @@ export interface ReactDatePickerProps {
|
||||
calendarContainer?(props: { children: React.ReactNode[] }): React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
clearButtonTitle?: string;
|
||||
customInput?: React.ReactNode;
|
||||
customInputRef?: string;
|
||||
dateFormat?: string | string[];
|
||||
@@ -38,6 +43,7 @@ export interface ReactDatePickerProps {
|
||||
filterDate?(date: Date): boolean;
|
||||
fixedHeight?: boolean;
|
||||
forceShowMonthNavigation?: boolean;
|
||||
formatWeekDay?(date: Date): string;
|
||||
formatWeekNumber?(date: Date): string | number;
|
||||
highlightDates?: Date[];
|
||||
id?: string;
|
||||
@@ -53,18 +59,19 @@ export interface ReactDatePickerProps {
|
||||
minTime?: Date;
|
||||
monthsShown?: number;
|
||||
name?: string;
|
||||
nextMonthButtonLabel?: string;
|
||||
onBlur?(event: React.FocusEvent<HTMLInputElement>): void;
|
||||
onChange(date: Date | null, event: React.SyntheticEvent<any> | undefined): void;
|
||||
onChangeRaw?(event: React.FocusEvent<HTMLInputElement>): void;
|
||||
onClickOutside?(event: React.MouseEvent<HTMLDivElement>): void;
|
||||
onFocus?(event: React.FocusEvent<HTMLInputElement>): void;
|
||||
onInputClick?(): void;
|
||||
onInputError?(err: {code: number; msg: string}): void;
|
||||
onKeyDown?(event: React.KeyboardEvent<HTMLDivElement>): void;
|
||||
onMonthChange?(date: Date): void;
|
||||
onSelect?(date: Date, event: React.SyntheticEvent<any> | undefined): void;
|
||||
onWeekSelect?(firstDayOfWeek: Date, weekNumber: string | number, event: React.SyntheticEvent<any> | undefined): void;
|
||||
onInputClick?(): void;
|
||||
onYearChange?(date: Date): void;
|
||||
onInputError?(err: {code: number; msg: string}): void;
|
||||
open?: boolean;
|
||||
openToDate?: Date;
|
||||
peekNextMonth?: boolean;
|
||||
@@ -75,7 +82,18 @@ export interface ReactDatePickerProps {
|
||||
popperPlacement?: string;
|
||||
popperProps?: {};
|
||||
preventOpenOnFocus?: boolean;
|
||||
previousMonthButtonLabel?: string;
|
||||
readOnly?: boolean;
|
||||
renderCustomHeader?(params: {
|
||||
date: Date;
|
||||
changeYear(year: number): void;
|
||||
changeMonth(month: number): void;
|
||||
decreaseMonth(): void;
|
||||
increaseMonth(): void;
|
||||
prevMonthButtonDisabled: boolean;
|
||||
nextMonthButtonDisabled: boolean;
|
||||
}): React.ReactNode;
|
||||
renderDayContents?(dayOfMonth: number): React.ReactNode;
|
||||
required?: boolean;
|
||||
scrollableMonthYearDropdown?: boolean;
|
||||
scrollableYearDropdown?: boolean;
|
||||
@@ -104,20 +122,6 @@ export interface ReactDatePickerProps {
|
||||
weekLabel?: string;
|
||||
withPortal?: boolean;
|
||||
yearDropdownItemNumber?: number;
|
||||
formatWeekDay?(date: Date): string;
|
||||
clearButtonTitle?: string;
|
||||
previousMonthButtonLabel?: string;
|
||||
nextMonthButtonLabel?: string;
|
||||
renderCustomHeader?(params: {
|
||||
date: Date;
|
||||
changeYear(year: number): void;
|
||||
changeMonth(month: number): void;
|
||||
decreaseMonth(): void;
|
||||
increaseMonth(): void;
|
||||
prevMonthButtonDisabled: boolean;
|
||||
nextMonthButtonDisabled: boolean;
|
||||
}): React.ReactNode;
|
||||
renderDayContents?(dayOfMonth: number): React.ReactNode;
|
||||
}
|
||||
declare const ReactDatePicker: React.ClassicComponentClass<ReactDatePickerProps>;
|
||||
export default ReactDatePicker;
|
||||
|
||||
@@ -1,17 +1,121 @@
|
||||
import * as React from 'react';
|
||||
import DatePicker from 'react-datepicker';
|
||||
import DatePicker, {
|
||||
registerLocale,
|
||||
setDefaultLocale,
|
||||
getDefaultLocale,
|
||||
} from 'react-datepicker';
|
||||
|
||||
registerLocale('en-GB', { options: { weekStartsOn: 1 } });
|
||||
setDefaultLocale('en-GB');
|
||||
const defaultLocale = getDefaultLocale();
|
||||
|
||||
<DatePicker
|
||||
selected={new Date()}
|
||||
adjustDateOnChange
|
||||
allowSameDay
|
||||
autoComplete=""
|
||||
autoFocus
|
||||
calendarClassName=""
|
||||
calendarContainer={props => <div />}
|
||||
className=""
|
||||
clearButtonTitle=""
|
||||
customInput={<input />}
|
||||
customInputRef=""
|
||||
dateFormat=""
|
||||
dateFormatCalendar=""
|
||||
dayClassName={date => ''}
|
||||
disabled
|
||||
disabledKeyboardNavigation
|
||||
dropdownMode="scroll"
|
||||
endDate={new Date()}
|
||||
excludeDates={[new Date()]}
|
||||
excludeTimes={[new Date()]}
|
||||
filterDate={date => true}
|
||||
fixedHeight
|
||||
forceShowMonthNavigation
|
||||
formatWeekDay={date => ''}
|
||||
formatWeekNumber={date => 0}
|
||||
highlightDates={[new Date()]}
|
||||
id=""
|
||||
includeDates={[new Date()]}
|
||||
includeTimes={[new Date()]}
|
||||
injectTimes={[new Date()]}
|
||||
inline
|
||||
isClearable
|
||||
locale=""
|
||||
maxDate={new Date()}
|
||||
maxTime={new Date()}
|
||||
minDate={new Date()}
|
||||
minTime={new Date()}
|
||||
monthsShown={1}
|
||||
name=""
|
||||
nextMonthButtonLabel=""
|
||||
onBlur={event => null}
|
||||
onChange={(date: Date | null) => {}}
|
||||
onChangeRaw={event => null}
|
||||
onClickOutside={event => null}
|
||||
onFocus={event => null}
|
||||
onInputClick={() => null}
|
||||
onInputError={err => err.code + err.msg}
|
||||
onKeyDown={event => null}
|
||||
onMonthChange={date => null}
|
||||
onSelect={(date, event) => null}
|
||||
onWeekSelect={(firstDayOfWeek, weekNumber, event) => null}
|
||||
onYearChange={(date: Date) => {}}
|
||||
open
|
||||
openToDate={new Date()}
|
||||
peekNextMonth
|
||||
placeholderText=""
|
||||
popperClassName=""
|
||||
popperContainer={props => <div />}
|
||||
popperModifiers={{
|
||||
flip: {
|
||||
enabled: false
|
||||
}
|
||||
enabled: false,
|
||||
},
|
||||
}}
|
||||
includeTimes={[new Date()]}
|
||||
popperPlacement=""
|
||||
popperProps={{}}
|
||||
preventOpenOnFocus
|
||||
previousMonthButtonLabel=""
|
||||
readOnly
|
||||
renderCustomHeader={({
|
||||
date,
|
||||
changeYear,
|
||||
changeMonth,
|
||||
decreaseMonth,
|
||||
increaseMonth,
|
||||
prevMonthButtonDisabled,
|
||||
nextMonthButtonDisabled,
|
||||
}) => <div />}
|
||||
renderDayContents={dayOfMonth => <div />}
|
||||
required
|
||||
scrollableMonthYearDropdown
|
||||
scrollableYearDropdown
|
||||
selected={new Date()}
|
||||
selectsEnd
|
||||
selectsStart
|
||||
shouldCloseOnSelect
|
||||
showDisabledMonthNavigation
|
||||
showMonthDropdown
|
||||
showMonthYearDropdown
|
||||
showTimeSelect
|
||||
showTimeSelectOnly
|
||||
showWeekNumbers
|
||||
showYearDropdown
|
||||
startDate={new Date()}
|
||||
startOpen
|
||||
tabIndex={1}
|
||||
timeCaption=""
|
||||
timeFormat=""
|
||||
timeIntervals={1}
|
||||
title=""
|
||||
todayButton={<div />}
|
||||
useShortMonthInDropdown
|
||||
useWeekdaysShort
|
||||
value=""
|
||||
weekLabel=""
|
||||
withPortal
|
||||
yearDropdownItemNumber={1}
|
||||
>
|
||||
<div/>
|
||||
<span/>
|
||||
<div />
|
||||
<span />
|
||||
</DatePicker>;
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import { ComponentType } from 'react';
|
||||
import { ComponentType, ComponentClass } from 'react';
|
||||
|
||||
import { TableProps } from '../../index';
|
||||
|
||||
@@ -49,8 +49,8 @@ export interface SelectTableHOCOptions {
|
||||
}
|
||||
|
||||
declare function selectTableHOC<Props extends Partial<TableProps>>(
|
||||
Component: ComponentType<Props>,
|
||||
WrappedComponent: ComponentType<Props>,
|
||||
options?: SelectTableHOCOptions
|
||||
): ComponentType<Props & SelectTableAdditionalProps>;
|
||||
): ComponentClass<Props & SelectTableAdditionalProps>;
|
||||
|
||||
export default selectTableHOC;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
import { ComponentType } from 'react';
|
||||
import { ComponentType, ComponentClass } from 'react';
|
||||
|
||||
import { TableProps } from '../../index';
|
||||
|
||||
declare function treeTableHOC<Props extends Partial<TableProps>>(
|
||||
Component: ComponentType<Props>
|
||||
): ComponentType<Props>;
|
||||
WrappedComponent: ComponentType<Props>
|
||||
): ComponentClass<Props>;
|
||||
|
||||
export default treeTableHOC;
|
||||
|
||||
@@ -52,6 +52,7 @@ ReactDOM.render(
|
||||
{...selectTableAdditionalProps}
|
||||
data={data}
|
||||
columns={columns}
|
||||
ref={React.createRef()}
|
||||
/>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as ReactDOM from 'react-dom';
|
||||
import ReactTable, { Column } from 'react-table';
|
||||
import treeTableHOC from 'react-table/lib/hoc/treeTable';
|
||||
|
||||
const SelectTable = treeTableHOC(ReactTable);
|
||||
const TreeTable = treeTableHOC(ReactTable);
|
||||
|
||||
const data = [{ id: 1, name: 'Foo' }, { id: 2, name: 'Bar' }];
|
||||
|
||||
@@ -14,6 +14,6 @@ const columns: Column[] = [
|
||||
];
|
||||
|
||||
ReactDOM.render(
|
||||
<SelectTable data={data} columns={columns} />,
|
||||
<TreeTable data={data} columns={columns} ref={React.createRef()} />,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
Vendored
+3
-3
@@ -273,10 +273,10 @@ declare module 'recompose' {
|
||||
|
||||
// fromRenderProps: https://github.com/acdlite/recompose/blob/master/docs/API.md#fromrenderprops
|
||||
export function fromRenderProps<TInner, TOutter, TRenderProps = {}>(
|
||||
RenderPropsComponent: StatelessComponent<any>,
|
||||
propsMapper: (props: TRenderProps) => Partial<TInner>,
|
||||
RenderPropsComponent: Component<any>,
|
||||
propsMapper: (props: TRenderProps) => TInner,
|
||||
renderPropName?: string
|
||||
): ComponentEnhancer<TInner, TOutter>;
|
||||
): ComponentEnhancer<TInner & TOutter, TOutter>;
|
||||
|
||||
// Static property helpers: https://github.com/acdlite/recompose/blob/master/docs/API.md#static-property-helpers
|
||||
|
||||
|
||||
@@ -521,18 +521,30 @@ function testFromRenderProps() {
|
||||
|
||||
interface InnerProps {
|
||||
renderValue: string;
|
||||
outterValue: number;
|
||||
}
|
||||
|
||||
interface OutterProps {
|
||||
outterValue: number;
|
||||
}
|
||||
|
||||
const RenderPropComponent: React.StatelessComponent<{
|
||||
render: (renderProps: RenderProps) => React.ReactElement<any>;
|
||||
}> = ({ render }) => render({ value: 'test' });
|
||||
interface ComponentProps {
|
||||
renderValue: string;
|
||||
outterValue: number;
|
||||
}
|
||||
|
||||
const component: React.StatelessComponent<InnerProps> = ({ renderValue }) => <div>{renderValue}</div>;
|
||||
interface RenderComponentProps {
|
||||
render: (renderProps: RenderProps) => React.ReactElement<any>;
|
||||
}
|
||||
|
||||
class RenderPropComponent extends React.Component<RenderComponentProps> {
|
||||
render () {
|
||||
return this.props.render({ value: 'test' });
|
||||
}
|
||||
}
|
||||
|
||||
const component: React.StatelessComponent<ComponentProps> = ({ outterValue, renderValue }) => (
|
||||
<div>{outterValue}{renderValue}</div>
|
||||
);
|
||||
|
||||
const Enhanced = fromRenderProps<InnerProps, OutterProps, RenderProps>(
|
||||
RenderPropComponent,
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/coderhaoxin/redux-action
|
||||
// Definitions by: newraina <https://github.com/newraina>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/**
|
||||
* inspired by @types/redux-actions, thanks.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0",
|
||||
"redux-thunk": "^2.2.0"
|
||||
"redux": "^4.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as ReduxAction from 'redux-action';
|
||||
import * as ReduxThunk from 'redux-thunk';
|
||||
import * as Redux from 'redux';
|
||||
|
||||
interface Payload {
|
||||
@@ -11,7 +10,7 @@ const dispatch: Redux.Dispatch<any> = (...args: any[]): any => { };
|
||||
|
||||
const actionCreator0 = ReduxAction.createAction<Payload>('get items');
|
||||
|
||||
dispatch(actionCreator0(1))
|
||||
actionCreator0(1)(dispatch, () => { })
|
||||
.then(action => {
|
||||
const type: string = action.type;
|
||||
const payload: Payload = action.payload;
|
||||
@@ -19,7 +18,7 @@ dispatch(actionCreator0(1))
|
||||
|
||||
const actionCreator1 = ReduxAction.createAction<Payload>();
|
||||
|
||||
dispatch(actionCreator1(1))
|
||||
actionCreator1(1)(dispatch, () => { })
|
||||
.then(action => {
|
||||
const type: string = action.type;
|
||||
const payload: Payload = action.payload;
|
||||
@@ -27,7 +26,7 @@ dispatch(actionCreator1(1))
|
||||
|
||||
const actionCreator2 = ReduxAction.createAction('get items', (name: string) => name);
|
||||
|
||||
dispatch(actionCreator2(1))
|
||||
actionCreator2(1)(dispatch, () => { })
|
||||
.then(action => {
|
||||
const type: string = action.type;
|
||||
const payload: string = action.payload;
|
||||
@@ -35,7 +34,7 @@ dispatch(actionCreator2(1))
|
||||
|
||||
const actionCreator3 = ReduxAction.createAction('get items', (name: string) => Promise.resolve(name));
|
||||
|
||||
dispatch(actionCreator3(1))
|
||||
actionCreator3(1)(dispatch, () => { })
|
||||
.then(action => {
|
||||
const type: string = action.type;
|
||||
const payload: string = action.payload;
|
||||
@@ -43,7 +42,7 @@ dispatch(actionCreator3(1))
|
||||
|
||||
const actionCreator4 = ReduxAction.createAction((name: string) => name);
|
||||
|
||||
dispatch(actionCreator4(1))
|
||||
actionCreator4(1)(dispatch, () => { })
|
||||
.then(action => {
|
||||
const type: string = action.type;
|
||||
const payload: string = action.payload;
|
||||
@@ -51,7 +50,7 @@ dispatch(actionCreator4(1))
|
||||
|
||||
const actionCreator5 = ReduxAction.createAction<number, string>((name: string) => 1);
|
||||
|
||||
dispatch(actionCreator5('items'))
|
||||
actionCreator5('items')(dispatch, () => { })
|
||||
.then(action => {
|
||||
const type: string = action.type;
|
||||
const payload: number = action.payload;
|
||||
@@ -59,7 +58,7 @@ dispatch(actionCreator5('items'))
|
||||
|
||||
const actionCreator6 = ReduxAction.createAction<number, string, boolean>((name: string) => 1);
|
||||
|
||||
dispatch(actionCreator6('items', false))
|
||||
actionCreator6('items', false)(dispatch, () => { })
|
||||
.then(action => {
|
||||
const type: string = action.type;
|
||||
const payload: number = action.payload;
|
||||
@@ -80,4 +79,4 @@ const reducer = ReduxAction.createReducer<State>({ name: 'name' }, {
|
||||
}
|
||||
});
|
||||
|
||||
const combinedReducer: Redux.Reducer<State> = Redux.combineReducers<State>({ reducer });
|
||||
const combinedReducer: Redux.Reducer<{ reducer: State }> = Redux.combineReducers<{ reducer: State }>({ reducer });
|
||||
|
||||
Vendored
+4
-9
@@ -6,7 +6,7 @@
|
||||
// Patrick Sachs <https://github.com/PatrickSachs>
|
||||
// Brandon Shelton <https://github.com/YangusKhan>
|
||||
// Irwan Fario Subastian <https://github.com/isubasti>
|
||||
// Sebastian Greaves <https://github.com/sgreav>
|
||||
// Hanna Greaves <https://github.com/sgreav>
|
||||
// Francesco Agnoletto <https://github.com/Kornil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
@@ -18,8 +18,7 @@ import {
|
||||
Block,
|
||||
Inline,
|
||||
Operations,
|
||||
Schema,
|
||||
Stack,
|
||||
SchemaProperties,
|
||||
Value,
|
||||
Operation,
|
||||
MarkProperties,
|
||||
@@ -112,7 +111,7 @@ export interface BasicEditorProps {
|
||||
plugins?: Plugin[];
|
||||
readOnly?: boolean;
|
||||
role?: string;
|
||||
schema?: Schema;
|
||||
schema?: SchemaProperties;
|
||||
spellCheck?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
tabIndex?: number;
|
||||
@@ -121,15 +120,11 @@ export interface BasicEditorProps {
|
||||
export type EditorProps = BasicEditorProps & Plugin;
|
||||
|
||||
export interface EditorState {
|
||||
schema: Schema;
|
||||
value: Value;
|
||||
stack: Stack;
|
||||
}
|
||||
|
||||
export class Editor extends React.Component<EditorProps, EditorState> implements Controller {
|
||||
controller: CoreEditor;
|
||||
schema: Schema;
|
||||
stack: Stack;
|
||||
|
||||
readonly plugins: Plugin[];
|
||||
readonly operations: Immutable.List<Operation>;
|
||||
@@ -137,7 +132,7 @@ export class Editor extends React.Component<EditorProps, EditorState> implements
|
||||
readonly value: Value;
|
||||
|
||||
// Instance methods
|
||||
resolveController(plugins: Plugin[], schema: Schema, commands: any[], queries: any[]): void;
|
||||
resolveController(plugins: Plugin[], schema: SchemaProperties, commands: any[], queries: any[]): void;
|
||||
|
||||
// Controller
|
||||
addMark: CoreEditor['addMark'];
|
||||
|
||||
Vendored
+5
-98
@@ -53,39 +53,9 @@ export interface SchemaProperties {
|
||||
inlines?: RulesByNodeType;
|
||||
}
|
||||
|
||||
export class Schema extends Immutable.Record({}) {
|
||||
stack: Stack;
|
||||
rules: Rules[];
|
||||
|
||||
static create(properties: SchemaProperties | Schema): Schema;
|
||||
static fromJSON(object: SchemaProperties): Schema;
|
||||
static fromJS(object: SchemaProperties): Schema;
|
||||
static isSchema(maybeSchema: any): maybeSchema is Schema;
|
||||
|
||||
validateNode(node: Node): Error | void;
|
||||
testNode(node: Node): boolean;
|
||||
assertNode(node: Node): boolean;
|
||||
getNodeRules(node: Node): any[];
|
||||
isVoid(node: Node): boolean;
|
||||
isAtomic(mark: Mark): boolean;
|
||||
normalizeNode(node: Node): () => void;
|
||||
testRules(object: any, rules: object | any[]): boolean;
|
||||
validateRules(
|
||||
object: any,
|
||||
rule: object | any[],
|
||||
rules: any[] | null,
|
||||
options?: object
|
||||
): Error | void;
|
||||
|
||||
toJSON(): SchemaProperties;
|
||||
toJS(): SchemaProperties;
|
||||
}
|
||||
|
||||
export interface ValueProperties {
|
||||
document?: Document;
|
||||
selection?: Selection;
|
||||
history?: History;
|
||||
schema?: Schema;
|
||||
data?: Data;
|
||||
decorations?: Immutable.List<Decoration> | null;
|
||||
}
|
||||
@@ -93,8 +63,6 @@ export interface ValueProperties {
|
||||
export interface ValueJSON {
|
||||
document?: DocumentJSON;
|
||||
selection?: Selection;
|
||||
history?: History;
|
||||
schema?: Schema;
|
||||
data?: Data;
|
||||
decorations?: Immutable.List<Decoration> | null;
|
||||
object?: "value";
|
||||
@@ -105,8 +73,6 @@ export type Path = Immutable.List<number> | string;
|
||||
export class Value extends Immutable.Record({}) {
|
||||
document: Document;
|
||||
selection: Selection;
|
||||
history: History;
|
||||
schema: Schema;
|
||||
data: Data;
|
||||
object: "value";
|
||||
decorations: Immutable.List<Decoration>;
|
||||
@@ -350,9 +316,6 @@ export class Text extends Immutable.Record({}) {
|
||||
): Text;
|
||||
splitText(offset: number): Text[];
|
||||
mergeText(text: Text): Text;
|
||||
normalize(schema: Schema): () => void | null;
|
||||
validate(schema: Schema): Error | null;
|
||||
getFirstInvalidNode(schema: Schema): Text | null;
|
||||
setLeaves(leaves: Immutable.List<Leaf>): Text;
|
||||
}
|
||||
|
||||
@@ -446,13 +409,12 @@ declare class BaseNode<
|
||||
getChild(path: Path): Node | null;
|
||||
getClosestBlock(path: Path): Block | null;
|
||||
getClosestInline(path: Path): Inline | null;
|
||||
getClosestVoid(path: Path, schema: Schema): Node | null;
|
||||
getClosestVoid(key: string | Path): Node | null;
|
||||
getClosest(path: Path, iterator: (node: Node) => boolean): Node | null;
|
||||
getCommonAncestor(a: Path, b: Path): Node;
|
||||
getDecorations(stack: Stack): Immutable.List<Range>;
|
||||
getDecorations(editor: Editor): Immutable.List<Decoration>;
|
||||
getDepth(path: Path, startAt?: number): number;
|
||||
getDescendant(path: Path): Node | null;
|
||||
getFirstInvalidNode(schema: Schema): Node | null;
|
||||
getFirstText(): Text | null;
|
||||
getFragmentAtRange(range: Range): Document;
|
||||
getFurthest(path: Path, iterator: (node: Node) => boolean): Node | null;
|
||||
@@ -514,7 +476,7 @@ declare class BaseNode<
|
||||
hasInlineChildren(): boolean;
|
||||
hasDescendant(path: Path): boolean;
|
||||
hasNode(path: Path): boolean;
|
||||
hasVoidParent(path: Path, schema: Schema): boolean;
|
||||
hasVoidParent(path: Path, editor: Editor): boolean;
|
||||
insertNode(path: Path, node: Node): Node;
|
||||
insertText(
|
||||
path: Path,
|
||||
@@ -528,7 +490,7 @@ declare class BaseNode<
|
||||
mapDescendants(iterator: () => void): Node;
|
||||
mergeNode(path: Path): Node;
|
||||
moveNode(path: Path, newPath: Path, newIndex?: number): Node;
|
||||
normalize(schema: Schema): () => void | void;
|
||||
normalize(editor: Editor): () => void | void;
|
||||
refinedNOde(path: Path, key: string): Node | null;
|
||||
refindPath(path: Path, key: string): Immutable.List<string> | null;
|
||||
regenerateKey(): Node;
|
||||
@@ -548,7 +510,7 @@ declare class BaseNode<
|
||||
properties: MarkProperties
|
||||
): Node;
|
||||
splitNode(path: Path, position: number, properties: NodeProperties): Node;
|
||||
validate(schema: Schema): Error | void;
|
||||
validate(editor: Editor): Error | void;
|
||||
}
|
||||
|
||||
export interface MarkProperties {
|
||||
@@ -914,61 +876,6 @@ export interface Operations {
|
||||
invert: (operation: Operation) => Operation;
|
||||
}
|
||||
|
||||
export interface StackProperties {
|
||||
plugins?: any[];
|
||||
}
|
||||
|
||||
export interface StackJSON {
|
||||
object: "stack";
|
||||
plugins: any[];
|
||||
}
|
||||
|
||||
export class Stack extends Immutable.Record({}) {
|
||||
object: "stack";
|
||||
plugins: any[];
|
||||
|
||||
static create(attrs: StackProperties): Stack;
|
||||
static isStack(maybeStack: any): maybeStack is Stack;
|
||||
|
||||
static fromJSON(properties: StackJSON): Stack;
|
||||
static fromJS(properties: StackJSON): Stack;
|
||||
toJSON(options: any): object;
|
||||
}
|
||||
|
||||
export interface HistoryProperties {
|
||||
undos?: Operation[];
|
||||
redos?: Operation[];
|
||||
}
|
||||
|
||||
export interface HistoryJSON {
|
||||
object: "history";
|
||||
undos: any[];
|
||||
redos: any[];
|
||||
}
|
||||
|
||||
export interface HistoryOptions {
|
||||
merge?: boolean;
|
||||
skip?: boolean;
|
||||
}
|
||||
|
||||
export class History extends Immutable.Record({}) {
|
||||
redos: Stack;
|
||||
undos: Stack;
|
||||
object: "history";
|
||||
|
||||
static create(attrs: History | HistoryProperties): History;
|
||||
static createOperationsList(
|
||||
oeprations?: Immutable.List<Operation> | Operation[]
|
||||
): Immutable.List<Operation>;
|
||||
static fromJSON(object: HistoryJSON): History;
|
||||
static fromJS(object: HistoryJSON): History;
|
||||
static isHistory(maybeHistory: any): maybeHistory is History;
|
||||
|
||||
save(operation: Operation, options?: HistoryOptions): History;
|
||||
toJSON(): HistoryJSON;
|
||||
toJS(): HistoryJSON;
|
||||
}
|
||||
|
||||
export type ErrorCode =
|
||||
| "child_object_invalid"
|
||||
| "child_required"
|
||||
|
||||
Vendored
+7
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for subsume 1.0
|
||||
// Type definitions for subsume 2.0
|
||||
// Project: https://github.com/sindresorhus/subsume#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -7,6 +7,7 @@ export = Subsume;
|
||||
|
||||
declare class Subsume {
|
||||
static parse(text: string, id: string): Subsume.ParseResult;
|
||||
static parseAll(text: string, ids?: string[]): Subsume.ParseResults;
|
||||
|
||||
id: string;
|
||||
prefix: string;
|
||||
@@ -23,4 +24,9 @@ declare namespace Subsume {
|
||||
data?: string;
|
||||
rest: string;
|
||||
}
|
||||
|
||||
interface ParseResults {
|
||||
data: Map<string, string>;
|
||||
rest: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,5 +18,13 @@ res; // $ExpectType ParseResult
|
||||
res.data; // $ExpectType string | undefined
|
||||
res.rest; // $ExpectType string
|
||||
|
||||
const input = 'some@@[7febcd0b3806fbc48c01d7cea4ed1219]@@🦄##[7febcd0b3806fbc48c01d7cea4ed1219]## random text';
|
||||
Subsume.parse(text, '7febcd0b3806fbc48c01d7cea4ed1219'); // $ExpectType ParseResult
|
||||
const input =
|
||||
'some@@[7febcd0b3806fbc48c01d7cea4ed1219]@@🦄##[7febcd0b3806fbc48c01d7cea4ed1219]## random text';
|
||||
Subsume.parse(input, '7febcd0b3806fbc48c01d7cea4ed1219'); // $ExpectType ParseResult
|
||||
|
||||
const input2 =
|
||||
'some@@[7febcd0b3806fbc48c01d7cea4ed1219]@@🦄##[7febcd0b3806fbc48c01d7cea4ed1219]## ' +
|
||||
'random@@[7febcd0b3806fbc48c01d7cea4ed1218]@@🦄##[7febcd0b3806fbc48c01d7cea4ed1218]## ' +
|
||||
'text@@[7febcd0b3806fbc48c01d7cea4ed1217]@@🦄##[7febcd0b3806fbc48c01d7cea4ed1217]##';
|
||||
Subsume.parseAll(input2); // $ExpectType ParseResults
|
||||
Subsume.parseAll(input2, ['7febcd0b3806fbc48c01d7cea4ed1219']); // $ExpectType ParseResults
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"subsume-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for subsume 1.0
|
||||
// Project: https://github.com/sindresorhus/subsume#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = Subsume;
|
||||
|
||||
declare class Subsume {
|
||||
static parse(text: string, id: string): Subsume.ParseResult;
|
||||
|
||||
id: string;
|
||||
prefix: string;
|
||||
postfix: string;
|
||||
regex: RegExp;
|
||||
|
||||
constructor(id?: string);
|
||||
compose(text: string): string;
|
||||
parse(text: string): Subsume.ParseResult;
|
||||
}
|
||||
|
||||
declare namespace Subsume {
|
||||
interface ParseResult {
|
||||
data?: string;
|
||||
rest: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import Subsume = require('subsume');
|
||||
|
||||
const subsume = new Subsume();
|
||||
new Subsume('foo');
|
||||
|
||||
subsume.id; // $ExpectType string
|
||||
subsume.prefix; // $ExpectType string
|
||||
subsume.postfix; // $ExpectType string
|
||||
subsume.regex; // $ExpectType RegExp
|
||||
|
||||
const text = subsume.compose('🦄');
|
||||
text; // $ExpectType string
|
||||
|
||||
const output = `some${text} random text`;
|
||||
|
||||
const res = subsume.parse(output);
|
||||
res; // $ExpectType ParseResult
|
||||
res.data; // $ExpectType string | undefined
|
||||
res.rest; // $ExpectType string
|
||||
|
||||
const input = 'some@@[7febcd0b3806fbc48c01d7cea4ed1219]@@🦄##[7febcd0b3806fbc48c01d7cea4ed1219]## random text';
|
||||
Subsume.parse(text, '7febcd0b3806fbc48c01d7cea4ed1219'); // $ExpectType ParseResult
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"subsume": [
|
||||
"subsume/v1"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"subsume-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
@@ -24,6 +24,7 @@
|
||||
// Julian Strecker <https://github.com/JulianSSS>
|
||||
// Zhang Hao <https://github.com/devilsparta>
|
||||
// Konstantin Lukaschenko <https://github.com/KonstantinLukaschenko>
|
||||
// Daniel Yim <https://github.com/danyim>
|
||||
// Definitions: https://github.com//DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -45,6 +46,7 @@ export * from "./three-FirstPersonControls";
|
||||
export * from "./three-gltfexporter";
|
||||
export * from "./three-gltfloader";
|
||||
export * from "./three-lensflare";
|
||||
export * from "./three-mapcontrols";
|
||||
export * from "./three-maskpass";
|
||||
export * from "./three-mtlloader";
|
||||
export * from "./three-objloader";
|
||||
|
||||
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
import {
|
||||
Camera,
|
||||
EventDispatcher,
|
||||
MOUSE,
|
||||
Object3D,
|
||||
Vector3
|
||||
} from "./three-core";
|
||||
|
||||
export class MapControls extends EventDispatcher {
|
||||
constructor(object: Camera, domElement?: HTMLElement);
|
||||
|
||||
object: Camera;
|
||||
domElement: HTMLElement | HTMLDocument;
|
||||
|
||||
// API
|
||||
enabled: boolean;
|
||||
target: Vector3;
|
||||
|
||||
enableZoom: boolean;
|
||||
zoomSpeed: number;
|
||||
minDistance: number;
|
||||
maxDistance: number;
|
||||
enableRotate: boolean;
|
||||
rotateSpeed: number;
|
||||
enablePan: boolean;
|
||||
keyPanSpeed: number;
|
||||
maxZoom: number;
|
||||
minZoom: number;
|
||||
panSpeed: number;
|
||||
autoRotate: boolean;
|
||||
autoRotateSpeed: number;
|
||||
minPolarAngle: number;
|
||||
maxPolarAngle: number;
|
||||
minAzimuthAngle: number;
|
||||
maxAzimuthAngle: number;
|
||||
enableKeys: boolean;
|
||||
screenSpacePanning: boolean;
|
||||
keys: { LEFT: number; UP: number; RIGHT: number; BOTTOM: number };
|
||||
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
||||
enableDamping: boolean;
|
||||
dampingFactor: number;
|
||||
target0: Vector3;
|
||||
position0: Vector3;
|
||||
zoom0: number;
|
||||
|
||||
rotateLeft(angle?: number): void;
|
||||
|
||||
rotateUp(angle?: number): void;
|
||||
|
||||
panLeft(distance?: number): void;
|
||||
|
||||
panUp(distance?: number): void;
|
||||
|
||||
pan(deltaX: number, deltaY: number): void;
|
||||
|
||||
dollyIn(dollyScale: number): void;
|
||||
|
||||
dollyOut(dollyScale: number): void;
|
||||
|
||||
saveState(): void;
|
||||
|
||||
update(): boolean;
|
||||
|
||||
reset(): void;
|
||||
|
||||
dispose(): void;
|
||||
|
||||
getPolarAngle(): number;
|
||||
|
||||
getAzimuthalAngle(): number;
|
||||
}
|
||||
Vendored
+3
-2
@@ -1,8 +1,9 @@
|
||||
// Type definitions for universal-router 6.0
|
||||
// Type definitions for universal-router 7.0
|
||||
// Project: https://github.com/kriasoft/universal-router
|
||||
// Definitions by: Jack Moore <https://github.com/jtmthf>
|
||||
// Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Lodin <https://github.com/Lodin>
|
||||
// acidghost <https://github.com/acidghost>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -101,7 +102,7 @@ export interface Options<C extends Context = Context, R = any> {
|
||||
context?: C;
|
||||
baseUrl?: string;
|
||||
resolveRoute?: (context: ActionContext<C, R> & C, params: Params) => any;
|
||||
errorHandler?: (error: Error & { context: C, code: number }) => any;
|
||||
errorHandler?: (error: Error & { status: number }, context: C) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,10 +12,10 @@ new UniversalRouter(
|
||||
user: 'name',
|
||||
},
|
||||
baseUrl: '/base',
|
||||
errorHandler: (error) => {
|
||||
errorHandler: (error, context) => {
|
||||
console.error(error);
|
||||
console.dir(error.context);
|
||||
return error.code === 404
|
||||
console.dir(context);
|
||||
return error.status === 404
|
||||
? '<h1>Page Not Found</h1>'
|
||||
: '<h1>Oops! Something went wrong</h1>';
|
||||
},
|
||||
|
||||
Vendored
+161
-18
@@ -3501,20 +3501,20 @@ declare namespace wx {
|
||||
*/
|
||||
interface InputEvent
|
||||
extends BuiltInEvent<
|
||||
"input",
|
||||
{
|
||||
value: string;
|
||||
cursor: number;
|
||||
}
|
||||
> {}
|
||||
"input",
|
||||
{
|
||||
value: string;
|
||||
cursor: number;
|
||||
}
|
||||
> {}
|
||||
|
||||
interface FormEvent
|
||||
extends BuiltInEvent<
|
||||
"form",
|
||||
{
|
||||
value: { [name: string]: string | boolean | number };
|
||||
}
|
||||
> {}
|
||||
"form",
|
||||
{
|
||||
value: { [name: string]: string | boolean | number };
|
||||
}
|
||||
> {}
|
||||
|
||||
interface ScrollEvent extends BuiltInEvent<"scroll", {}> {}
|
||||
|
||||
@@ -3528,12 +3528,12 @@ declare namespace wx {
|
||||
|
||||
interface TouchEvent<T extends TouchEventType>
|
||||
extends BuiltInEvent<
|
||||
T,
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
> {
|
||||
T,
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
> {
|
||||
touches: Touch[];
|
||||
changedTouches: Touch[];
|
||||
}
|
||||
@@ -4096,6 +4096,79 @@ declare namespace wx {
|
||||
}
|
||||
// #endregion
|
||||
// #region App里的onLaunch、onShow回调参数
|
||||
|
||||
type SceneValues =
|
||||
| 1001
|
||||
| 1005
|
||||
| 1006
|
||||
| 1007
|
||||
| 1008
|
||||
| 1011
|
||||
| 1012
|
||||
| 1013
|
||||
| 1014
|
||||
| 1017
|
||||
| 1019
|
||||
| 1020
|
||||
| 1022
|
||||
| 1023
|
||||
| 1024
|
||||
| 1025
|
||||
| 1026
|
||||
| 1027
|
||||
| 1028
|
||||
| 1029
|
||||
| 1030
|
||||
| 1031
|
||||
| 1032
|
||||
| 1034
|
||||
| 1035
|
||||
| 1036
|
||||
| 1037
|
||||
| 1038
|
||||
| 1039
|
||||
| 1042
|
||||
| 1043
|
||||
| 1044
|
||||
| 1045
|
||||
| 1046
|
||||
| 1047
|
||||
| 1048
|
||||
| 1049
|
||||
| 1052
|
||||
| 1053
|
||||
| 1054
|
||||
| 1056
|
||||
| 1057
|
||||
| 1058
|
||||
| 1059
|
||||
| 1064
|
||||
| 1067
|
||||
| 1068
|
||||
| 1069
|
||||
| 1071
|
||||
| 1072
|
||||
| 1073
|
||||
| 1074
|
||||
| 1077
|
||||
| 1078
|
||||
| 1079
|
||||
| 1081
|
||||
| 1082
|
||||
| 1084
|
||||
| 1089
|
||||
| 1090
|
||||
| 1091
|
||||
| 1092
|
||||
| 1095
|
||||
| 1096
|
||||
| 1097
|
||||
| 1099
|
||||
| 1102
|
||||
| 1103
|
||||
| 1104
|
||||
| number;
|
||||
|
||||
interface LaunchOptions {
|
||||
/**
|
||||
* 打开小程序的路径
|
||||
@@ -4107,8 +4180,78 @@ declare namespace wx {
|
||||
query: object;
|
||||
/**
|
||||
* 打开小程序的[场景值](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/app-service/scene.html)
|
||||
*
|
||||
* - 1001: 发现栏小程序主入口,「最近使用」列表(基础库2.2.4版本起包含「我的小程序」列表)
|
||||
* - 1005: 顶部搜索框的搜索结果页
|
||||
* - 1006: 发现栏小程序主入口搜索框的搜索结果页
|
||||
* - 1007: 单人聊天会话中的小程序消息卡片
|
||||
* - 1008: 群聊会话中的小程序消息卡片
|
||||
* - 1011: 扫描二维码
|
||||
* - 1012: 长按图片识别二维码
|
||||
* - 1013: 手机相册选取二维码
|
||||
* - 1014: 小程序模板消息
|
||||
* - 1017: 前往体验版的入口页
|
||||
* - 1019: 微信钱包
|
||||
* - 1020: 公众号 profile 页相关小程序列表
|
||||
* - 1022: 聊天顶部置顶小程序入口
|
||||
* - 1023: 安卓系统桌面图标
|
||||
* - 1024: 小程序 profile 页
|
||||
* - 1025: 扫描一维码
|
||||
* - 1026: 附近小程序列表
|
||||
* - 1027: 顶部搜索框搜索结果页「使用过的小程序」列表
|
||||
* - 1028: 我的卡包
|
||||
* - 1029: 卡券详情页
|
||||
* - 1030: 自动化测试下打开小程序
|
||||
* - 1031: 长按图片识别一维码
|
||||
* - 1032: 手机相册选取一维码
|
||||
* - 1034: 微信支付完成页
|
||||
* - 1035: 公众号自定义菜单
|
||||
* - 1036: App 分享消息卡片
|
||||
* - 1037: 小程序打开小程序
|
||||
* - 1038: 从另一个小程序返回
|
||||
* - 1039: 摇电视
|
||||
* - 1042: 添加好友搜索框的搜索结果页
|
||||
* - 1043: 公众号模板消息
|
||||
* - 1044: 带 shareTicket 的小程序消息卡片 [详情]((转发#获取更多转发信息))
|
||||
* - 1045: 朋友圈广告
|
||||
* - 1046: 朋友圈广告详情页
|
||||
* - 1047: 扫描小程序码
|
||||
* - 1048: 长按图片识别小程序码
|
||||
* - 1049: 手机相册选取小程序码
|
||||
* - 1052: 卡券的适用门店列表
|
||||
* - 1053: 搜一搜的结果页
|
||||
* - 1054: 顶部搜索框小程序快捷入口
|
||||
* - 1056: 音乐播放器菜单
|
||||
* - 1057: 钱包中的银行卡详情页
|
||||
* - 1058: 公众号文章
|
||||
* - 1059: 体验版小程序绑定邀请页
|
||||
* - 1064: 微信连Wi-Fi状态栏
|
||||
* - 1067: 公众号文章广告
|
||||
* - 1068: 附近小程序列表广告
|
||||
* - 1069: 移动应用
|
||||
* - 1071: 钱包中的银行卡列表页
|
||||
* - 1072: 二维码收款页面
|
||||
* - 1073: 客服消息列表下发的小程序消息卡片
|
||||
* - 1074: 公众号会话下发的小程序消息卡片
|
||||
* - 1077: 摇周边
|
||||
* - 1078: 连Wi-Fi成功页
|
||||
* - 1079: 微信游戏中心
|
||||
* - 1081: 客服消息下发的文字链
|
||||
* - 1082: 公众号会话下发的文字链
|
||||
* - 1084: 朋友圈广告原生页
|
||||
* - 1089: 微信聊天主界面下拉,「最近使用」栏(基础库2.2.4版本起包含「我的小程序」栏)
|
||||
* - 1090: 长按小程序右上角菜单唤出最近使用历史
|
||||
* - 1091: 公众号文章商品卡片
|
||||
* - 1092: 城市服务入口
|
||||
* - 1095: 小程序广告组件
|
||||
* - 1096: 聊天记录
|
||||
* - 1097: 微信支付签约页
|
||||
* - 1099: 页面内嵌插件
|
||||
* - 1102: 公众号 profile 页服务预览
|
||||
* - 1103: 发现栏小程序主入口,「我的小程序」列表(基础库2.2.4版本起废弃)
|
||||
* - 1104: 微信聊天主界面下拉,「我的小程序」栏(基础库2.2.4版本起废弃)
|
||||
*/
|
||||
scene: number;
|
||||
scene: SceneValues;
|
||||
/**
|
||||
* shareTicket,详见 获取更多[转发信息](https://mp.weixin.qq.com/debug/wxadoc/dev/api/share.html#获取更多转发信息)
|
||||
*/
|
||||
|
||||
Vendored
+8
@@ -617,6 +617,14 @@ declare namespace wx {
|
||||
* 支付成功后的回调函数
|
||||
*/
|
||||
success(res: any): void;
|
||||
/**
|
||||
* 支付取消后的回调函数
|
||||
*/
|
||||
cancel?(res: any): void;
|
||||
/**
|
||||
* 支付失败后的回调函数
|
||||
*/
|
||||
fail?(res: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,9 @@ wx.chooseWXPay({
|
||||
nonceStr: '',
|
||||
package: '',
|
||||
paySign: '',
|
||||
success: (res) => {}
|
||||
success: (res) => {},
|
||||
cancel: (res) => {},
|
||||
fail: (res) => {}
|
||||
});
|
||||
|
||||
wx.getLocation({
|
||||
|
||||
Reference in New Issue
Block a user