mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Apply more lint rules (#15348)
This commit is contained in:
@@ -116,7 +116,6 @@ function test_timeZone() {
|
||||
strFormats = dp.timeZone() as string;
|
||||
}
|
||||
|
||||
|
||||
function test_widgetParent() {
|
||||
let nullW: null = null;
|
||||
let str: string = "myId";
|
||||
|
||||
+23
-24
@@ -49,9 +49,9 @@ export interface Datetimepicker {
|
||||
hide(): void;
|
||||
/**Returns the components current options object.
|
||||
* Note that the changing the values of the returned object does not change the components actual configuration. */
|
||||
options(): DatetimepickerOptions
|
||||
options(): DatetimepickerOptions;
|
||||
/**Takes an object variable with option key:value properties and configures the component. Use this to update multiple options on the component. */
|
||||
options(options: DatetimepickerOptions): void
|
||||
options(options: DatetimepickerOptions): void;
|
||||
/**Shows the widget
|
||||
* Emits:
|
||||
* - dp.show - if the widget was hidden before that call
|
||||
@@ -85,14 +85,14 @@ export interface Datetimepicker {
|
||||
/**Returns the options.daysOfWeekDisabled configuration
|
||||
* IMPORTANT! Throws exception if not set explicitly https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1459
|
||||
*/
|
||||
daysOfWeekDisabled(): Array<number>;
|
||||
daysOfWeekDisabled(): number[];
|
||||
/**Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array.
|
||||
* This has lower priority over the options.minDate, options.maxDate, options.disabledDates and options.enabledDates configuration settings.
|
||||
* Emits:
|
||||
* - dp.change - if the currently selected moment falls in the values passed on the daysOfWeek parameter.
|
||||
* - dp.error - if the currently selected moment falls in the values passed on the daysOfWeek parameter.
|
||||
*/
|
||||
daysOfWeekDisabled(days: Array<number>): void;
|
||||
daysOfWeekDisabled(days: number[]): void;
|
||||
/**Returns the options.dayViewHeaderFormat option. */
|
||||
dayViewHeaderFormat(): string;
|
||||
/**Used to customize the header of the day view. */
|
||||
@@ -117,22 +117,22 @@ export interface Datetimepicker {
|
||||
*/
|
||||
disabledDates(dates: boolean | Array<string | Date | moment.Moment>): void;
|
||||
/**Returns the options.disabledHours option.
|
||||
* NOTES: probably should be: disabledHours(): boolean | Array<number>; see: DatetimepickerOptions
|
||||
* NOTES: probably should be: disabledHours(): boolean | number[]; see: DatetimepickerOptions
|
||||
*/
|
||||
disabledHours(): boolean | any;
|
||||
/**Must be in 24 hour format. Will disallow hour selections (much like disabledTimeIntervals) but will affect all days.
|
||||
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */
|
||||
disabledHours(value: boolean | Array<number>): void;
|
||||
disabledHours(value: boolean | number[]): void;
|
||||
/**Returns the options.disabledTimeIntervals option, or... not exactly
|
||||
* IMPORTANT! Creates an object from the options.disabledTimeIntervals with the keys being numbers, the values being the moment arrays.
|
||||
* eg { "0": [<moment.Moment1>, <moment.Moment2>], "1": [...] }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1498
|
||||
*/
|
||||
disabledTimeIntervals(): boolean | Array<Array<moment.Moment>>;
|
||||
disabledTimeIntervals(): boolean | moment.Moment[][];
|
||||
/**Disables time selection between the given moments
|
||||
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
|
||||
*/
|
||||
disabledTimeIntervals(value: boolean | Array<Array<moment.Moment>>): void;
|
||||
disabledTimeIntervals(value: boolean | moment.Moment[][]): void;
|
||||
/**Returns the options.enabledDates option
|
||||
* NOTES: probably should be: enabledDates(): boolean | Array<moment.Moment>; see: DatetimepickerOptions
|
||||
*/
|
||||
@@ -144,12 +144,12 @@ export interface Datetimepicker {
|
||||
*/
|
||||
enabledDates(dates: boolean | Array<string | Date | moment.Moment>): void;
|
||||
/**Returns the options.enabledHours option.
|
||||
* NOTES: probably should be: enabledHours(): boolean | Array<number>; see: DatetimepickerOptions
|
||||
* NOTES: probably should be: enabledHours(): boolean | number[]; see: DatetimepickerOptions
|
||||
*/
|
||||
enabledHours(): boolean | any;
|
||||
/**Must be in 24 hour format. Will allow hour selections (much like enabledTimeIntervals) but will affect all days.
|
||||
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */
|
||||
enabledHours(value: boolean | Array<number>): void;
|
||||
enabledHours(value: boolean | number[]): void;
|
||||
/**Returns a boolean or array with the options.extraFormats option configuration */
|
||||
extraFormats(): boolean | Array<string | moment.MomentBuiltinFormat>;
|
||||
/**Takes an array of valid input moment format options, or boolean:false */
|
||||
@@ -303,7 +303,7 @@ export interface Datetimepicker {
|
||||
*/
|
||||
viewMode(value: string): void;
|
||||
/**Returns a $(element) variable with the currently set options.widgetParent option. */
|
||||
widgetParent(): string | JQuery | null
|
||||
widgetParent(): string | JQuery | null;
|
||||
/**Takes a string or $(element) value. */
|
||||
widgetParent(widgetParent: string | JQuery | null): void;
|
||||
/**Returns the options.widgetPositioning object */
|
||||
@@ -332,7 +332,7 @@ export interface DatetimepickerOptions {
|
||||
* Accepts: array of numbers from 0-6
|
||||
* @default: false
|
||||
*/
|
||||
daysOfWeekDisabled?: Array<number> | boolean;
|
||||
daysOfWeekDisabled?: number[] | boolean;
|
||||
/**Changes the heading of the datepicker when in "days" view.
|
||||
* @default: "MMMM YYYY"
|
||||
*/
|
||||
@@ -358,12 +358,12 @@ export interface DatetimepickerOptions {
|
||||
* eg disabledHours = [0, 1]; -> disabledHours will be { "0": true, "1": true }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
|
||||
*/
|
||||
disabledHours?: boolean | Array<number> | any;
|
||||
disabledHours?: boolean | number[] | any;
|
||||
/**Disables time selection between the given moments
|
||||
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
|
||||
* @default: false
|
||||
*/
|
||||
disabledTimeIntervals?: boolean | Array<Array<moment.Moment>>;
|
||||
disabledTimeIntervals?: boolean | moment.Moment[][];
|
||||
/**Disables selection of dates NOT in the array, e.g. holidays
|
||||
* @default: false
|
||||
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
|
||||
@@ -377,7 +377,7 @@ export interface DatetimepickerOptions {
|
||||
* eg enabledHours = [0, 1]; -> enabledHours will be { "0": true, "1": true }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
|
||||
*/
|
||||
enabledHours?: boolean | Array<number>;
|
||||
enabledHours?: boolean | number[];
|
||||
/**Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
|
||||
* @default: false
|
||||
*/
|
||||
@@ -566,7 +566,6 @@ type EventName = "dp.show" | "dp.hide" | "dp.error";
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
|
||||
datetimepicker(options?: DatetimepickerOptions): JQuery;
|
||||
|
||||
data(key: "DateTimePicker"): Datetimepicker;
|
||||
@@ -575,21 +574,21 @@ declare global {
|
||||
on(events: "dp.change", selector: string, handler: (eventobject: ChangeEvent) => any): JQuery;
|
||||
on(events: "dp.change", selector: string, data: any, handler?: (eventobject: ChangeEvent) => any): JQuery;
|
||||
|
||||
off(events: "dp.change", handler: (eventobject: ChangeEvent) => any): JQuery;
|
||||
off(events: "dp.change", selector?: string, handler?: (eventobject: ChangeEvent) => any): JQuery;
|
||||
on(events: "dp.update", handler: (eventObject: UpdateEvent) => any): JQuery;
|
||||
on(events: "dp.update", selector: string, handler: (eventobject: UpdateEvent) => any): JQuery;
|
||||
on(events: "dp.update", selector: string, data: any, handler?: (eventobject: UpdateEvent) => any): JQuery;
|
||||
|
||||
on(events: EventName , handler: (eventObject: Event) => any): JQuery;
|
||||
on(events: EventName, selector: string, handler: (eventobject: Event) => any): JQuery;
|
||||
on(events: EventName, selector: string, data: any, handler?: (eventobject: Event) => any): JQuery;
|
||||
|
||||
off(events: EventName, handler: (eventobject: Event) => any): JQuery;
|
||||
off(events: EventName, selector?: string, handler?: (eventobject: Event) => any): JQuery;
|
||||
|
||||
on(events: "dp.update", handler: (eventObject: UpdateEvent) => any): JQuery;
|
||||
on(events: "dp.update", selector: string, handler: (eventobject: UpdateEvent) => any): JQuery;
|
||||
on(events: "dp.update", selector: string, data: any, handler?: (eventobject: UpdateEvent) => any): JQuery;
|
||||
off(events: "dp.change", handler: (eventobject: ChangeEvent) => any): JQuery;
|
||||
off(events: "dp.change", selector?: string, handler?: (eventobject: ChangeEvent) => any): JQuery;
|
||||
|
||||
off(events: "dp.update", handler: (eventobject: UpdateEvent) => any): JQuery;
|
||||
off(events: "dp.update", selector?: string, handler?: (eventobject: UpdateEvent) => any): JQuery;
|
||||
|
||||
off(events: EventName, handler: (eventobject: Event) => any): JQuery;
|
||||
off(events: EventName, selector?: string, handler?: (eventobject: Event) => any): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as bunyan from "browser-bunyan";
|
||||
|
||||
var log = bunyan.createLogger({
|
||||
const log = bunyan.createLogger({
|
||||
name: 'play',
|
||||
serializers: bunyan.stdSerializers
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
import bunyan = require("bunyan");
|
||||
|
||||
declare module "bunyan" {
|
||||
export function ConsoleFormattedStream(): void;
|
||||
function ConsoleFormattedStream(): void;
|
||||
}
|
||||
|
||||
export = bunyan;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
|
||||
import BufferStream = require('bufferstream');
|
||||
|
||||
var stream = new BufferStream({encoding: 'utf8', size: 'flexible'});
|
||||
const stream = new BufferStream({encoding: 'utf8', size: 'flexible'});
|
||||
stream.enable();
|
||||
stream.disable();
|
||||
stream.split('//', ':');
|
||||
@@ -11,4 +9,3 @@ stream.on('split', (chunk: any, token: any) => {
|
||||
});
|
||||
stream.write("buffer:stream//23");
|
||||
console.log(stream.toString());
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -59,9 +59,9 @@ declare class BufferStream extends stream.Duplex {
|
||||
*/
|
||||
length: number;
|
||||
} // https://github.com/dodo/node-bufferstream/blob/master/src/buffer-stream.coffee#L28
|
||||
declare namespace BufferStream {
|
||||
|
||||
export interface Opts {
|
||||
declare namespace BufferStream {
|
||||
interface Opts {
|
||||
/*
|
||||
default encoding for writing strings
|
||||
*/
|
||||
@@ -85,5 +85,5 @@ declare namespace BufferStream {
|
||||
// String or Buffer
|
||||
split?: any;
|
||||
}
|
||||
export var fn: {warn: boolean};
|
||||
const fn: {warn: boolean};
|
||||
}
|
||||
|
||||
@@ -65,4 +65,3 @@ const data2 = [true, 123];
|
||||
|
||||
expect(chai.tv4.validate(data1, schema)).to.be.true;
|
||||
expect(chai.tv4.validate(data2, schema)).to.be.false;
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -9,16 +9,16 @@ import tv4 = require('tv4');
|
||||
|
||||
declare global {
|
||||
namespace Chai {
|
||||
export interface Assert {
|
||||
interface Assert {
|
||||
jsonSchema(value: any, schema: any, msg?: string): void;
|
||||
notJsonSchema(value: any, schema: any, msg?: string): void;
|
||||
}
|
||||
|
||||
export interface LanguageChains {
|
||||
interface LanguageChains {
|
||||
jsonSchema(schema: any, msg?: string): void;
|
||||
}
|
||||
|
||||
export interface ChaiStatic {
|
||||
interface ChaiStatic {
|
||||
tv4: tv4.TV4;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace clamp {
|
||||
export interface ClampOptions {
|
||||
interface ClampOptions {
|
||||
clamp?: number|string;
|
||||
useNativeClamp?: boolean;
|
||||
splitOnChars?: string[];
|
||||
@@ -13,9 +13,9 @@ declare namespace clamp {
|
||||
truncationHTML?: string | null;
|
||||
}
|
||||
|
||||
export interface ClampResponse {
|
||||
'original': string;
|
||||
'clamped': string;
|
||||
interface ClampResponse {
|
||||
original: string;
|
||||
clamped: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace CoViews {
|
||||
export interface Options {
|
||||
interface Options {
|
||||
/**
|
||||
* default extname
|
||||
*/
|
||||
|
||||
Vendored
+3
-3
@@ -43,14 +43,14 @@ declare class CombinedStream extends Stream implements CombinedStream.Options {
|
||||
}
|
||||
|
||||
declare namespace CombinedStream {
|
||||
export interface Options {
|
||||
interface Options {
|
||||
maxDataSize?: number;
|
||||
pauseStreams?: boolean;
|
||||
}
|
||||
|
||||
export function create(options?: Options): CombinedStream;
|
||||
function create(options?: Options): CombinedStream;
|
||||
|
||||
export function isStreamLike(stream: any): stream is Stream;
|
||||
function isStreamLike(stream: any): stream is Stream;
|
||||
}
|
||||
|
||||
export = CombinedStream;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ declare class CompressionPlugin extends Plugin {
|
||||
}
|
||||
|
||||
declare namespace CompressionPlugin {
|
||||
export interface Options {
|
||||
interface Options {
|
||||
asset?: string;
|
||||
algorithm?: string;
|
||||
test?: RegExp | RegExp[];
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
|
||||
import Configstore = require('configstore');
|
||||
var cs = new Configstore('foo');
|
||||
const cs = new Configstore('foo');
|
||||
|
||||
var value: any;
|
||||
var key: string;
|
||||
var num: number;
|
||||
var bool: any;
|
||||
var object: any;
|
||||
let value: any;
|
||||
let key: string;
|
||||
let num: number;
|
||||
let object: any;
|
||||
|
||||
cs.set(key, value);
|
||||
value = cs.get(key);
|
||||
|
||||
Vendored
+1
-1
@@ -65,7 +65,7 @@ declare class Configstore {
|
||||
}
|
||||
|
||||
declare namespace Configstore {
|
||||
export interface ConfigstoreOptions {
|
||||
interface ConfigstoreOptions {
|
||||
globalConfigPath?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ login.ensureLoggedOut();
|
||||
login.ensureLoggedOut("/");
|
||||
login.ensureLoggedOut({
|
||||
redirectTo: "/",
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+2
-2
@@ -47,7 +47,7 @@ interface LoggedOutOptions {
|
||||
* ensureLoggedIn({ redirectTo: '/session/new', setReturnTo: false }),
|
||||
* function(req, res) { ... });
|
||||
*/
|
||||
export declare function ensureLoggedIn(options?: LoggedInOptions | string): RequestHandler;
|
||||
export function ensureLoggedIn(options?: LoggedInOptions | string): RequestHandler;
|
||||
|
||||
/**
|
||||
* Ensure that no user is logged in before proceeding to next route middleware.
|
||||
@@ -70,4 +70,4 @@ export declare function ensureLoggedIn(options?: LoggedInOptions | string): Requ
|
||||
* ensureLoggedOut({ redirectTo: '/home' }),
|
||||
* function(req, res) { ... });
|
||||
*/
|
||||
export declare function ensureLoggedOut(options?: LoggedOutOptions | string): RequestHandler;
|
||||
export function ensureLoggedOut(options?: LoggedOutOptions | string): RequestHandler;
|
||||
|
||||
Vendored
+3
-3
@@ -4,17 +4,17 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace contentDisposition {
|
||||
export interface ContentDisposition {
|
||||
interface ContentDisposition {
|
||||
type: string;
|
||||
parameters: any;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
interface Options {
|
||||
type?: string;
|
||||
fallback?: string | boolean;
|
||||
}
|
||||
|
||||
export function parse(contentDispositionHeader: string): ContentDisposition;
|
||||
function parse(contentDispositionHeader: string): ContentDisposition;
|
||||
}
|
||||
|
||||
declare function contentDisposition(filename?: string, options?: contentDisposition.Options): string;
|
||||
|
||||
@@ -36,4 +36,4 @@ const server = http.createServer((req, res) => {
|
||||
"tampered expected: undefined\n\n" +
|
||||
"tampered: " + tampered + "\n\n"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+9
-10
@@ -7,7 +7,7 @@
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import * as Keygrip from 'keygrip';
|
||||
|
||||
declare interface Cookies {
|
||||
interface Cookies {
|
||||
secure: boolean;
|
||||
request: IncomingMessage;
|
||||
response: ServerResponse;
|
||||
@@ -27,27 +27,26 @@ declare interface Cookies {
|
||||
set(name: string, value?: string, opts?: Cookies.SetOption): this;
|
||||
}
|
||||
|
||||
|
||||
declare namespace Cookies {
|
||||
/**
|
||||
* for backward-compatibility
|
||||
*/
|
||||
export type ICookies = Cookies;
|
||||
type ICookies = Cookies;
|
||||
/**
|
||||
* for backward-compatibility
|
||||
*/
|
||||
export type IOptions = SetOption;
|
||||
type IOptions = SetOption;
|
||||
|
||||
export interface Option {
|
||||
interface Option {
|
||||
keys: string[] | Keygrip;
|
||||
secure?: boolean;
|
||||
}
|
||||
|
||||
export interface GetOption {
|
||||
interface GetOption {
|
||||
signed: boolean;
|
||||
}
|
||||
|
||||
export interface SetOption {
|
||||
interface SetOption {
|
||||
/**
|
||||
* a number representing the milliseconds from Date.now() for expiry
|
||||
*/
|
||||
@@ -97,9 +96,9 @@ declare namespace Cookies {
|
||||
overwrite?: boolean;
|
||||
}
|
||||
|
||||
export type CookieAttr = SetOption;
|
||||
type CookieAttr = SetOption;
|
||||
|
||||
export interface Cookie {
|
||||
interface Cookie {
|
||||
name: string;
|
||||
value: string;
|
||||
/**
|
||||
@@ -119,7 +118,7 @@ declare namespace Cookies {
|
||||
}
|
||||
}
|
||||
|
||||
declare interface CookiesFunction {
|
||||
interface CookiesFunction {
|
||||
(request: IncomingMessage, response: ServerResponse, options?: Cookies.Option): Cookies;
|
||||
/**
|
||||
* "options" array of key strings is deprecated, provide using options {"keys": keygrip}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
//
|
||||
// @autobind
|
||||
//
|
||||
@@ -35,7 +34,7 @@ class Meal {
|
||||
entree: string = 'steak';
|
||||
}
|
||||
|
||||
var dinner = new Meal();
|
||||
const dinner = new Meal();
|
||||
dinner.entree = 'salmon';
|
||||
|
||||
//
|
||||
@@ -99,11 +98,9 @@ person2.facepalmHarder();
|
||||
// @debounce
|
||||
//
|
||||
|
||||
|
||||
import { debounce } from 'core-decorators';
|
||||
|
||||
class Editor {
|
||||
|
||||
content = '';
|
||||
|
||||
@debounce(500)
|
||||
@@ -119,7 +116,6 @@ class Editor {
|
||||
import { throttle } from 'core-decorators';
|
||||
|
||||
class Editor2 {
|
||||
|
||||
content = '';
|
||||
|
||||
@throttle(500, {leading: false})
|
||||
@@ -162,8 +158,8 @@ class Meal2 {
|
||||
cost: number = 4.44;
|
||||
}
|
||||
|
||||
var dinner2 = new Meal2();
|
||||
for (var key in dinner2) {
|
||||
const dinner2 = new Meal2();
|
||||
for (const key in dinner2) {
|
||||
key;
|
||||
// "entree" only, not "cost"
|
||||
}
|
||||
@@ -182,7 +178,7 @@ class Meal3 {
|
||||
entree: string = 'steak';
|
||||
}
|
||||
|
||||
var dinner3 = new Meal3();
|
||||
const dinner3 = new Meal3();
|
||||
|
||||
Object.defineProperty(dinner3, 'entree', {
|
||||
enumerable: false
|
||||
@@ -196,7 +192,7 @@ Object.defineProperty(dinner3, 'entree', {
|
||||
declare function memoize<T extends Function>(func: T): T;
|
||||
import { decorate } from 'core-decorators';
|
||||
|
||||
var count = 0;
|
||||
let count = 0;
|
||||
|
||||
class Task {
|
||||
@decorate(memoize)
|
||||
@@ -207,8 +203,8 @@ class Task {
|
||||
}
|
||||
}
|
||||
|
||||
var task = new Task();
|
||||
var data = [1, 2, 3];
|
||||
const task = new Task();
|
||||
const data = [1, 2, 3];
|
||||
|
||||
task.doSomethingExpensive(data);
|
||||
task.doSomethingExpensive(data);
|
||||
@@ -232,7 +228,7 @@ class Editor3 {
|
||||
hugeBuffer = createHugeBuffer();
|
||||
}
|
||||
|
||||
var editor = new Editor3();
|
||||
const editor = new Editor3();
|
||||
// createHugeBuffer() has not been called yet
|
||||
|
||||
editor.hugeBuffer;
|
||||
@@ -270,7 +266,7 @@ class Bird {
|
||||
}
|
||||
}
|
||||
|
||||
var bird = new Bird();
|
||||
const bird = new Bird();
|
||||
bird.singMatingCall();
|
||||
// alerts "tweet tweet"
|
||||
|
||||
@@ -288,17 +284,12 @@ const myConsole = {
|
||||
|
||||
class Bird2 {
|
||||
@time('sing')
|
||||
sing() {
|
||||
}
|
||||
sing() {}
|
||||
|
||||
@time('sing2', myConsole)
|
||||
sing2() {
|
||||
|
||||
}
|
||||
sing2() {}
|
||||
}
|
||||
|
||||
var bird2 = new Bird2();
|
||||
const bird2 = new Bird2();
|
||||
bird2.sing(); // console.time label will be 'sing-0'
|
||||
bird2.sing(); // console.time label will be 'sing-1'
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
interface Point { x: number; y: number; }
|
||||
interface Point3D extends Point { z: number; }
|
||||
|
||||
|
||||
Vendored
+389
-389
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ csv({ noheader: true })
|
||||
console.log(csvRow); // => [1,2,3] , [4,5,6] , [7,8,9]
|
||||
})
|
||||
.on('done', () => {
|
||||
//parsing finished
|
||||
// parsing finished
|
||||
});
|
||||
|
||||
// event emitter version using Converter class
|
||||
@@ -26,7 +26,7 @@ new csv.Converter({ noheader: true })
|
||||
console.log(csvRow); // => [1,2,3] , [4,5,6] , [7,8,9]
|
||||
})
|
||||
.on('done', () => {
|
||||
//parsing finished
|
||||
// parsing finished
|
||||
});
|
||||
|
||||
// callback version using Converter class
|
||||
|
||||
Vendored
-3
@@ -8,7 +8,6 @@
|
||||
import * as stream from 'stream';
|
||||
|
||||
declare namespace csvtojson {
|
||||
|
||||
/**
|
||||
* Stream options
|
||||
*/
|
||||
@@ -18,7 +17,6 @@ declare namespace csvtojson {
|
||||
* Converter options
|
||||
*/
|
||||
interface ConverterOptions {
|
||||
|
||||
/**
|
||||
* Delimiter used for seperating columns. Use "auto" if delimiter is unknown in advance,
|
||||
* in this case, delimiter will be auto-detected (by best attempt). Use an array to give
|
||||
@@ -173,7 +171,6 @@ declare namespace csvtojson {
|
||||
* Converts provided CSV input to a JSON object.
|
||||
*/
|
||||
class Converter extends stream.Transform {
|
||||
|
||||
/**
|
||||
* Initializes a new instance of a Converter
|
||||
* @param {ConverterOptions} options converter options
|
||||
|
||||
@@ -26,7 +26,6 @@ class NumCoercible {
|
||||
}
|
||||
|
||||
class MixedObject {
|
||||
|
||||
num: number;
|
||||
str: string;
|
||||
numeric: NumCoercible;
|
||||
@@ -289,7 +288,6 @@ num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14
|
||||
num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 1);
|
||||
num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 3, 4);
|
||||
|
||||
|
||||
// ascending() -----------------------------------------------------------------
|
||||
|
||||
num = d3Array.ascending(undefined, 20);
|
||||
@@ -339,12 +337,11 @@ crossed = d3Array.cross<string, number>(['x', 'y'], [1, 2]);
|
||||
|
||||
let strArray: string[] = d3Array.cross<number, number, string>([2, 3], [5, 6], (a, b) => (a + b) + 'px');
|
||||
strArray = d3Array.cross([2, 3], [5, 6], (a, b) => {
|
||||
let aa: number = a;
|
||||
let bb: number = b;
|
||||
const aa: number = a;
|
||||
const bb: number = b;
|
||||
return (aa + bb) + 'px';
|
||||
});
|
||||
|
||||
|
||||
// pairs() ---------------------------------------------------------------------
|
||||
|
||||
let pairs: Array<[MixedObject, MixedObject]>;
|
||||
@@ -353,8 +350,8 @@ pairs = d3Array.pairs(mergedArray);
|
||||
|
||||
numbersArray = d3Array.pairs<MixedObject, number>(mergedArray, (a, b) => b.num - a.num);
|
||||
numbersArray = d3Array.pairs(mergedArray, (a, b) => {
|
||||
let aa: MixedObject = a;
|
||||
let bb: MixedObject = b;
|
||||
const aa: MixedObject = a;
|
||||
const bb: MixedObject = b;
|
||||
return bb.num - aa.num;
|
||||
});
|
||||
|
||||
@@ -374,7 +371,6 @@ const testObject = {
|
||||
|
||||
const x: Array<number | string | Date | number[]> = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);
|
||||
|
||||
|
||||
// range() ---------------------------------------------------------------------
|
||||
|
||||
numbersArray = d3Array.range(10);
|
||||
@@ -389,7 +385,6 @@ mergedArray = d3Array.shuffle(mergedArray, 1);
|
||||
|
||||
mergedArray = d3Array.shuffle(mergedArray, 1, 3);
|
||||
|
||||
|
||||
// ticks() ---------------------------------------------------------------------
|
||||
|
||||
numbersArray = d3Array.ticks(1, 10, 5);
|
||||
@@ -519,8 +514,6 @@ const mixedObject: MixedObject = testBin[0]; // with element type MixedObject
|
||||
date = testBin.x0; // bin lower bound is Date
|
||||
date = testBin.x1; // bin upper bound is Date
|
||||
|
||||
|
||||
|
||||
// Histogram Tresholds =========================================================
|
||||
|
||||
num = d3Array.thresholdFreedmanDiaconis([-1, 0, 1, 1, 3, 20, 234], -1, 234);
|
||||
|
||||
Vendored
+1
-11
@@ -9,7 +9,6 @@
|
||||
// Shared Types and Interfaces
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Administrivia: JavaScript primitive types and Date
|
||||
*/
|
||||
@@ -26,7 +25,6 @@ interface Numeric {
|
||||
// Descriptive Statistics
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array of strings using natural order.
|
||||
*/
|
||||
@@ -67,8 +65,6 @@ export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[
|
||||
*/
|
||||
export function min<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
@@ -139,7 +135,6 @@ export function variance<T extends Numeric>(array: Array<T | undefined | null>):
|
||||
*/
|
||||
export function variance<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Searching Arrays
|
||||
// --------------------------------------------------------------------------------------
|
||||
@@ -155,7 +150,7 @@ export function bisectRight(array: number[], x: number, lo?: number, hi?: number
|
||||
export function bisectRight(array: string[], x: string, lo?: number, hi?: number): number;
|
||||
export function bisectRight(array: Date[], x: Date, lo?: number, hi?: number): number;
|
||||
|
||||
export var bisect: typeof bisectRight;
|
||||
export const bisect: typeof bisectRight;
|
||||
|
||||
export interface Bisector<T, U> {
|
||||
left: (array: T[], x: U, lo?: number, hi?: number) => number;
|
||||
@@ -244,7 +239,6 @@ export function range(stop: number): number[];
|
||||
*/
|
||||
export function range(start: number, stop: number, step?: number): number[];
|
||||
|
||||
|
||||
/**
|
||||
* Randomizes the order of the specified array using the Fisher–Yates shuffle.
|
||||
*/
|
||||
@@ -261,13 +255,11 @@ export function ticks(start: number, stop: number, count: number): number[];
|
||||
*/
|
||||
export function tickStep(start: number, stop: number, count: number): number[];
|
||||
|
||||
|
||||
/**
|
||||
* Transpose a matrix provided in Array of Arrays format.
|
||||
*/
|
||||
export function transpose<T>(matrix: T[][]): T[][];
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays.
|
||||
* The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array, the returned array
|
||||
@@ -294,8 +286,6 @@ export type ThresholdCountGenerator = (values: number[], min?: number, max?: num
|
||||
*/
|
||||
export type ThresholdArrayGenerator<Value extends number | Date> = (values: Value[], min?: Value, max?: Value) => Value[];
|
||||
|
||||
|
||||
|
||||
export interface HistogramGenerator<Datum, Value extends number | Date> {
|
||||
(data: Datum[]): Array<Bin<Datum, Value>>;
|
||||
value(): (d: Datum, i: number, data: Datum[]) => Value;
|
||||
|
||||
@@ -26,8 +26,6 @@ import { Transition } from 'd3-transition';
|
||||
import { timeMinute } from 'd3-time';
|
||||
import { format } from 'd3-format';
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Preparatory Steps
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -81,8 +79,6 @@ leftAxis = leftAxis.scale(scalePow());
|
||||
const powerScale: ScalePower<number, number> = leftAxis.scale<ScalePower<number, number>>();
|
||||
// powerScale = leftAxis.scale(); // fails, without casting as AxisScale is purposely generic
|
||||
|
||||
|
||||
|
||||
bottomAxis = bottomAxis.scale(scaleOrdinal<number>());
|
||||
// bottomAxis = bottomAxis.scale(scalePow()) // fails, domain of scale incompatible with domain of axis
|
||||
|
||||
|
||||
Vendored
-3
@@ -11,7 +11,6 @@ import { Selection, TransitionLike } from 'd3-selection';
|
||||
// Shared Types and Interfaces
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* A helper interface to describe the minimal contract to be met by a time interval
|
||||
* which can be passed into the Axis.ticks(...) or Axis.tickArguments(...) methods when
|
||||
@@ -171,7 +170,6 @@ export interface Axis<Domain> {
|
||||
*/
|
||||
tickValues(values: null): this;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the currently set tick format function, which defaults to null.
|
||||
*/
|
||||
@@ -258,7 +256,6 @@ export interface Axis<Domain> {
|
||||
* @param padding Padding in pixels (Default is 3).
|
||||
*/
|
||||
tickPadding(padding: number): this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,6 @@ interface BrushDatum {
|
||||
filterZoomEvent: boolean;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Define BrushBehavior
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -48,7 +47,6 @@ brush = brush.extent(function(d, i, group) {
|
||||
|
||||
// chainable
|
||||
brush = brush.filter(function(d, i, group) {
|
||||
|
||||
// Cast d3 event to D3ZoomEvent to be used in filter logic
|
||||
const e = <d3Brush.D3BrushEvent<BrushDatum>> event;
|
||||
|
||||
@@ -80,7 +78,6 @@ brush = brush.on('end', brushed);
|
||||
// brush = brush.on('end', wrongHandler1); // fails, wrongHandler event handler has wrong this
|
||||
// brush = brush.on('end', wrongHandler2); // fails, wrongHandler event handler has wrong datum type
|
||||
|
||||
|
||||
brushed = brush.on('end');
|
||||
|
||||
// chainable remove handler
|
||||
@@ -97,8 +94,6 @@ brush.on('end', function(d, i, g) {
|
||||
// do anything
|
||||
});
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Attach Brush Behavior
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -121,10 +116,8 @@ const gX = select<SVGSVGElement, any>('svg')
|
||||
filterZoomEvent: true
|
||||
});
|
||||
|
||||
|
||||
gX.call(brushX);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Use Brush Behavior
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -155,7 +148,6 @@ brush.move(gTransition, function(d, i, group) {
|
||||
return selection;
|
||||
});
|
||||
|
||||
|
||||
const gXTransition = gX.transition();
|
||||
|
||||
// 1d brush move with Selection
|
||||
@@ -178,15 +170,12 @@ brush.move(gXTransition, function(d, i, group) {
|
||||
return selection;
|
||||
});
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Brush Event Interface
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
const e: d3Brush.D3BrushEvent<BrushDatum> = event;
|
||||
|
||||
|
||||
const target: d3Brush.BrushBehavior<BrushDatum> = e.target;
|
||||
const type: 'start' | 'brush' | 'end' | string = e.type;
|
||||
const brushSelection: d3Brush.BrushSelection = e.selection;
|
||||
|
||||
Vendored
-1
@@ -189,7 +189,6 @@ export interface BrushBehavior<Datum> {
|
||||
* with this as the current DOM element.
|
||||
*/
|
||||
on(typenames: string, listener: ValueFn<SVGGElement, Datum, void>): this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@ import * as d3Chord from 'd3-chord';
|
||||
import { select, Selection } from 'd3-selection';
|
||||
import { ascending } from 'd3-array';
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Preparatory Steps
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -39,7 +38,6 @@ let numAccessor: (this: SVGPathElement, d: d3Chord.ChordSubgroup, ...args: any[]
|
||||
// Test Chord
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
// chord() create ChordLayout generator ===============================
|
||||
|
||||
let chordLayout: d3Chord.ChordLayout;
|
||||
@@ -64,7 +62,6 @@ chordLayout = chordLayout.sortSubgroups(ascending);
|
||||
chordLayout = chordLayout.sortSubgroups(null);
|
||||
comparatorFn = chordLayout.sortSubgroups();
|
||||
|
||||
|
||||
// sortChords() --------------------------------------------------------
|
||||
|
||||
chordLayout = chordLayout.sortChords(ascending);
|
||||
@@ -75,10 +72,8 @@ comparatorFn = chordLayout.sortChords();
|
||||
|
||||
chords = chordLayout(matrix);
|
||||
|
||||
|
||||
// Test supporting interfaces ==========================================
|
||||
|
||||
|
||||
const length: number = chords.length;
|
||||
|
||||
chordGroups = chords.groups;
|
||||
@@ -98,7 +93,6 @@ num = chordSubgroup.endAngle;
|
||||
num = chordSubgroup.value;
|
||||
num = chordSubgroup.index;
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Test Ribbon
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -140,7 +134,6 @@ svgRibbon = svgRibbon.target(d => {
|
||||
|
||||
subgroupAccessor = svgRibbon.target();
|
||||
|
||||
|
||||
// radius() -----------------------------------------------------------
|
||||
|
||||
canvasRibbon = canvasRibbon.radius(30);
|
||||
|
||||
+82
-95
@@ -144,7 +144,7 @@ contained = d3Geo.geoContains(sampleExtendedFeatureCollection, [0, 0]);
|
||||
|
||||
// geoDistance(...) =======================================================
|
||||
|
||||
let distance: number = d3Geo.geoDistance([54, 2], [53, 1]);
|
||||
const distance: number = d3Geo.geoDistance([54, 2], [53, 1]);
|
||||
|
||||
// geoLength(...) =========================================================
|
||||
|
||||
@@ -160,19 +160,19 @@ length = d3Geo.geoLength(sampleExtendedFeatureCollection);
|
||||
|
||||
// geoInterpolate(...) ====================================================
|
||||
|
||||
let interpolateFct: (t: number) => [number, number] = d3Geo.geoInterpolate([54, 2], [53, 1]);
|
||||
const interpolateFct: (t: number) => [number, number] = d3Geo.geoInterpolate([54, 2], [53, 1]);
|
||||
|
||||
// geoRotation(...) =======================================================
|
||||
|
||||
// create rotation -----------------------------------------------------
|
||||
|
||||
let rotation: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45]);
|
||||
let rotation2: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45, 27.5]);
|
||||
const rotation: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45]);
|
||||
const rotation2: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45, 27.5]);
|
||||
|
||||
// use rotation --------------------------------------------------------
|
||||
|
||||
let point: [number, number] = rotation([54, 2]);
|
||||
let inverted: [number, number] = rotation.invert([54, 2]);
|
||||
const point: [number, number] = rotation([54, 2]);
|
||||
const inverted: [number, number] = rotation.invert([54, 2]);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Spherical Shapes - geoCircle
|
||||
@@ -185,24 +185,23 @@ let circleGeneratorSimple: d3Geo.GeoCircleGenerator<any, any> = d3Geo.geoCircle(
|
||||
|
||||
// complex use as part of object
|
||||
class Circulator {
|
||||
|
||||
constructor(radius: number, precision: number) {
|
||||
this.r = radius;
|
||||
this.p = precision;
|
||||
this.circleGenerator = d3Geo.geoCircle<Circulator, [number, number] | undefined>()
|
||||
.radius(function (datum) {
|
||||
let t: Circulator = this;
|
||||
let d: [number, number] | undefined = datum;
|
||||
.radius(function(datum) {
|
||||
const t: Circulator = this;
|
||||
const d: [number, number] | undefined = datum;
|
||||
return this.r;
|
||||
})
|
||||
.precision(function (datum) {
|
||||
let t: Circulator = this;
|
||||
let d: [number, number] | undefined = datum;
|
||||
.precision(function(datum) {
|
||||
const t: Circulator = this;
|
||||
const d: [number, number] | undefined = datum;
|
||||
return this.p;
|
||||
})
|
||||
.center(function (datum) {
|
||||
let t: Circulator = this;
|
||||
let d: [number, number] | undefined = datum;
|
||||
.center(function(datum) {
|
||||
const t: Circulator = this;
|
||||
const d: [number, number] | undefined = datum;
|
||||
return d ? d : [0, 0];
|
||||
});
|
||||
}
|
||||
@@ -219,28 +218,28 @@ class Circulator {
|
||||
}
|
||||
}
|
||||
|
||||
let circulator = new Circulator(50, 2);
|
||||
const circulator = new Circulator(50, 2);
|
||||
|
||||
// Configure CircleGenerator ============================================
|
||||
|
||||
// center(...) ----------------------------------------------------------
|
||||
|
||||
let centerFctSimple: ((this: any, d: any, ...args: any[]) => [number, number]) = circleGeneratorSimple.center();
|
||||
const centerFctSimple: ((this: any, d: any, ...args: any[]) => [number, number]) = circleGeneratorSimple.center();
|
||||
|
||||
let c: [number, number] = [54, 2];
|
||||
const c: [number, number] = [54, 2];
|
||||
|
||||
circleGeneratorSimple = circleGeneratorSimple.center(() => c);
|
||||
circleGeneratorSimple = circleGeneratorSimple.center(c);
|
||||
|
||||
// radius(...) -----------------------------------------------------------
|
||||
|
||||
let radius: ((...args: any[]) => number) = circleGeneratorSimple.radius();
|
||||
const radius: ((...args: any[]) => number) = circleGeneratorSimple.radius();
|
||||
circleGeneratorSimple = circleGeneratorSimple.radius(() => 5);
|
||||
circleGeneratorSimple = circleGeneratorSimple.radius(2);
|
||||
|
||||
// precision(...) --------------------------------------------------------
|
||||
|
||||
let precision: ((...args: any[]) => number) = circleGeneratorSimple.precision();
|
||||
const precision: ((...args: any[]) => number) = circleGeneratorSimple.precision();
|
||||
circleGeneratorSimple = circleGeneratorSimple.precision(() => 5);
|
||||
circleGeneratorSimple = circleGeneratorSimple.precision(2);
|
||||
|
||||
@@ -253,7 +252,6 @@ let circlePolygon: GeoJSON.Polygon = circleGeneratorSimple();
|
||||
circlePolygon = circulator.getCirclePolygon([5, 5]);
|
||||
circlePolygon = circulator.getCirclePolygon();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Spherical Shapes - geoGraticule
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -266,44 +264,44 @@ let graticuleGenerator: d3Geo.GeoGraticuleGenerator = d3Geo.geoGraticule();
|
||||
|
||||
// extent(...) -----------------------------------------------------------
|
||||
|
||||
let extent: [[number, number], [number, number]] = graticuleGenerator.extent();
|
||||
const extent: [[number, number], [number, number]] = graticuleGenerator.extent();
|
||||
graticuleGenerator = graticuleGenerator.extent([[-180, -80], [180, 80]]);
|
||||
|
||||
// extentMajor(...) ---------------------------------------------------------
|
||||
|
||||
let extentMajor: [[number, number], [number, number]] = graticuleGenerator.extentMajor();
|
||||
const extentMajor: [[number, number], [number, number]] = graticuleGenerator.extentMajor();
|
||||
graticuleGenerator = graticuleGenerator.extentMajor([[-180, -80], [180, 80]]);
|
||||
|
||||
// extentMinor(...) ---------------------------------------------------------
|
||||
|
||||
let extentMinor: [[number, number], [number, number]] = graticuleGenerator.extentMinor();
|
||||
const extentMinor: [[number, number], [number, number]] = graticuleGenerator.extentMinor();
|
||||
graticuleGenerator = graticuleGenerator.extentMinor([[-180, -80], [180, 80]]);
|
||||
|
||||
// step(...) ----------------------------------------------------------------
|
||||
|
||||
let step: [number, number] = graticuleGenerator.step();
|
||||
const step: [number, number] = graticuleGenerator.step();
|
||||
graticuleGenerator = graticuleGenerator.step([10, 10]);
|
||||
|
||||
// stepMajor(...) -----------------------------------------------------------
|
||||
|
||||
let stepMajor: [number, number] = graticuleGenerator.stepMajor();
|
||||
const stepMajor: [number, number] = graticuleGenerator.stepMajor();
|
||||
graticuleGenerator = graticuleGenerator.stepMajor([10, 10]);
|
||||
|
||||
// stepMinor(...) ------------------------------------------------------------
|
||||
|
||||
let stepMinor: [number, number] = graticuleGenerator.stepMinor();
|
||||
const stepMinor: [number, number] = graticuleGenerator.stepMinor();
|
||||
graticuleGenerator = graticuleGenerator.stepMinor([10, 10]);
|
||||
|
||||
// precision(...) -------------------------------------------------------------
|
||||
|
||||
let precision1: number = graticuleGenerator.precision();
|
||||
const precision1: number = graticuleGenerator.precision();
|
||||
graticuleGenerator = graticuleGenerator.precision(5);
|
||||
|
||||
// Use GeoGraticuleGenerator ============================================
|
||||
|
||||
let multiString: GeoJSON.MultiLineString = graticuleGenerator();
|
||||
let lines: GeoJSON.LineString[] = graticuleGenerator.lines();
|
||||
let polygon2: GeoJSON.Polygon = graticuleGenerator.outline();
|
||||
const lines: GeoJSON.LineString[] = graticuleGenerator.lines();
|
||||
const polygon2: GeoJSON.Polygon = graticuleGenerator.outline();
|
||||
|
||||
// geoGraticule10() =====================================================
|
||||
|
||||
@@ -317,24 +315,22 @@ multiString = d3Geo.geoGraticule10();
|
||||
|
||||
// Pre-Defined Raw Projection Factories =================================
|
||||
|
||||
let azimuthalEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEqualAreaRaw();
|
||||
let azimuthalEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEquidistantRaw();
|
||||
let conicConformalRaw: d3Geo.GeoRawProjection = d3Geo.geoConicConformalRaw(0, 0);
|
||||
let conicEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEqualAreaRaw(0, 0);
|
||||
let conicEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEquidistantRaw(0, 0);
|
||||
let equirectangularRaw: d3Geo.GeoRawProjection = d3Geo.geoEquirectangularRaw();
|
||||
let gnomonicRaw: d3Geo.GeoRawProjection = d3Geo.geoGnomonicRaw();
|
||||
let mercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoMercatorRaw();
|
||||
let orthographicRaw: d3Geo.GeoRawProjection = d3Geo.geoOrthographicRaw();
|
||||
let stereographicRaw: d3Geo.GeoRawProjection = d3Geo.geoStereographicRaw();
|
||||
let transverseMercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoTransverseMercatorRaw();
|
||||
const azimuthalEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEqualAreaRaw();
|
||||
const azimuthalEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEquidistantRaw();
|
||||
const conicConformalRaw: d3Geo.GeoRawProjection = d3Geo.geoConicConformalRaw(0, 0);
|
||||
const conicEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEqualAreaRaw(0, 0);
|
||||
const conicEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEquidistantRaw(0, 0);
|
||||
const equirectangularRaw: d3Geo.GeoRawProjection = d3Geo.geoEquirectangularRaw();
|
||||
const gnomonicRaw: d3Geo.GeoRawProjection = d3Geo.geoGnomonicRaw();
|
||||
const mercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoMercatorRaw();
|
||||
const orthographicRaw: d3Geo.GeoRawProjection = d3Geo.geoOrthographicRaw();
|
||||
const stereographicRaw: d3Geo.GeoRawProjection = d3Geo.geoStereographicRaw();
|
||||
const transverseMercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoTransverseMercatorRaw();
|
||||
|
||||
// Use Raw Projection =====================================================
|
||||
|
||||
let rawProjectionPoint: [number, number] = azimuthalEqualAreaRaw(54, 2);
|
||||
let rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert(180, 6);
|
||||
|
||||
|
||||
const rawProjectionPoint: [number, number] = azimuthalEqualAreaRaw(54, 2);
|
||||
const rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert(180, 6);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Pre-Defined Projections
|
||||
@@ -342,39 +338,38 @@ let rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert(
|
||||
|
||||
// Create predefined Projection from factory =============================
|
||||
|
||||
let albers: d3Geo.GeoConicProjection = d3Geo.geoAlbers();
|
||||
let albersUsa: d3Geo.GeoProjection = d3Geo.geoAlbersUsa();
|
||||
let azimuthalEqualArea: d3Geo.GeoProjection = d3Geo.geoAzimuthalEqualArea();
|
||||
let azimuthalEquidistant: d3Geo.GeoProjection = d3Geo.geoAzimuthalEquidistant();
|
||||
const albers: d3Geo.GeoConicProjection = d3Geo.geoAlbers();
|
||||
const albersUsa: d3Geo.GeoProjection = d3Geo.geoAlbersUsa();
|
||||
const azimuthalEqualArea: d3Geo.GeoProjection = d3Geo.geoAzimuthalEqualArea();
|
||||
const azimuthalEquidistant: d3Geo.GeoProjection = d3Geo.geoAzimuthalEquidistant();
|
||||
let conicConformal: d3Geo.GeoConicProjection = d3Geo.geoConicConformal();
|
||||
let conicEqualArea: d3Geo.GeoConicProjection = d3Geo.geoConicEqualArea();
|
||||
let conicEquidistant: d3Geo.GeoConicProjection = d3Geo.geoConicEquidistant();
|
||||
let cquirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular();
|
||||
let gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic();
|
||||
let mercator: d3Geo.GeoProjection = d3Geo.geoMercator();
|
||||
let orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic();
|
||||
let stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic();
|
||||
let transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator();
|
||||
const conicEqualArea: d3Geo.GeoConicProjection = d3Geo.geoConicEqualArea();
|
||||
const conicEquidistant: d3Geo.GeoConicProjection = d3Geo.geoConicEquidistant();
|
||||
const cquirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular();
|
||||
const gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic();
|
||||
const mercator: d3Geo.GeoProjection = d3Geo.geoMercator();
|
||||
const orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic();
|
||||
const stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic();
|
||||
const transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Create New Projections
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const geoProjection: d3Geo.GeoProjection = d3Geo.geoProjection(azimuthalEqualAreaRaw);
|
||||
|
||||
let geoProjection: d3Geo.GeoProjection = d3Geo.geoProjection(azimuthalEqualAreaRaw);
|
||||
|
||||
let mutate: () => d3Geo.GeoProjection = d3Geo.geoProjectionMutator(() => azimuthalEqualAreaRaw);
|
||||
const mutate: () => d3Geo.GeoProjection = d3Geo.geoProjectionMutator(() => azimuthalEqualAreaRaw);
|
||||
let constructedProjection: d3Geo.GeoProjection = mutate();
|
||||
|
||||
// Use Projection ==========================================================
|
||||
|
||||
let projected: [number, number] = constructedProjection([54, 2]);
|
||||
let inverted2: [number, number] = constructedProjection.invert([54, 2]);
|
||||
const projected: [number, number] = constructedProjection([54, 2]);
|
||||
const inverted2: [number, number] = constructedProjection.invert([54, 2]);
|
||||
|
||||
// TODO ?????
|
||||
// let stream: d3Geo.Stream = constructedProjection.stream([54, 2]);
|
||||
|
||||
let clipAngle: number = constructedProjection.clipAngle();
|
||||
const clipAngle: number = constructedProjection.clipAngle();
|
||||
constructedProjection = constructedProjection.clipAngle(null);
|
||||
constructedProjection = constructedProjection.clipAngle(45);
|
||||
|
||||
@@ -388,14 +383,14 @@ constructedProjection = constructedProjection.scale(45);
|
||||
let translate: [number, number] = constructedProjection.translate();
|
||||
constructedProjection = constructedProjection.translate([480, 250]);
|
||||
|
||||
let center: [number, number] = constructedProjection.center();
|
||||
const center: [number, number] = constructedProjection.center();
|
||||
constructedProjection = constructedProjection.center([0, 0]);
|
||||
|
||||
let rotate: [number, number, number] = constructedProjection.rotate();
|
||||
const rotate: [number, number, number] = constructedProjection.rotate();
|
||||
constructedProjection = constructedProjection.rotate([0, 0]);
|
||||
constructedProjection = constructedProjection.rotate([0, 0, 0]);
|
||||
|
||||
let precision2: number = constructedProjection.precision();
|
||||
const precision2: number = constructedProjection.precision();
|
||||
constructedProjection = constructedProjection.precision(0.707);
|
||||
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], samplePolygon);
|
||||
@@ -423,7 +418,7 @@ constructedProjection = constructedProjection.fitSize([960, 500], sampleExtended
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// parallels(...) ------------------------------------------------------
|
||||
let parallels: [number, number] = conicConformal.parallels();
|
||||
const parallels: [number, number] = conicConformal.parallels();
|
||||
conicConformal = conicConformal.parallels([20, 20]);
|
||||
|
||||
// test method inheritance from GeoProjection ---------------------------
|
||||
@@ -434,7 +429,7 @@ conicConformal = conicConformal.fitSize([960, 500], samplePolygon); // inherited
|
||||
// GeoPath Generator
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
let minimalRenderingContextMockUp: d3Geo.GeoContext = {
|
||||
const minimalRenderingContextMockUp: d3Geo.GeoContext = {
|
||||
beginPath: () => { return; },
|
||||
moveTo: (x: number, y: number) => { return; },
|
||||
lineTo: (x: number, y: number) => { return; },
|
||||
@@ -460,12 +455,12 @@ geoPathSVG = d3Geo.geoPath<SVGPathElement, d3Geo.ExtendedFeature<GeoJSON.Polygon
|
||||
// projection(...) ------------------------------------------------------
|
||||
|
||||
geoPathCanvas = geoPathCanvas.projection(azimuthalEqualArea);
|
||||
let geoPathProjectionMinimal: d3Geo.GeoStreamWrapper = geoPathCanvas.projection();
|
||||
let geoPathProjectionUnion: d3Geo.GeoProjection | d3Geo.GeoConicProjection | d3Geo.GeoStreamWrapper = geoPathCanvas.projection();
|
||||
let geoPathProjection: d3Geo.GeoProjection = geoPathCanvas.projection<d3Geo.GeoProjection>();
|
||||
const geoPathProjectionMinimal: d3Geo.GeoStreamWrapper = geoPathCanvas.projection();
|
||||
const geoPathProjectionUnion: d3Geo.GeoProjection | d3Geo.GeoConicProjection | d3Geo.GeoStreamWrapper = geoPathCanvas.projection();
|
||||
const geoPathProjection: d3Geo.GeoProjection = geoPathCanvas.projection<d3Geo.GeoProjection>();
|
||||
|
||||
geoPathSVG = geoPathSVG.projection(conicConformal);
|
||||
let geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection<d3Geo.GeoConicProjection>();
|
||||
const geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection<d3Geo.GeoConicProjection>();
|
||||
// geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom typeguard
|
||||
// geoPathConicProjection = geoPathSVG.projection<SampleProperties1>(); // fails as SampleProperties does not extend minimal interface
|
||||
|
||||
@@ -474,8 +469,7 @@ let geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection<d3G
|
||||
// minimal context interface (mockup)
|
||||
geoPathCanvas = geoPathCanvas.context(minimalRenderingContextMockUp);
|
||||
|
||||
|
||||
let geoPathContext: d3Geo.GeoContext = geoPathCanvas.context();
|
||||
const geoPathContext: d3Geo.GeoContext = geoPathCanvas.context();
|
||||
|
||||
// reset
|
||||
geoPathCanvas = geoPathCanvas.context(null);
|
||||
@@ -492,15 +486,15 @@ canvasContext = geoPathCanvas.context<CanvasRenderingContext2D>();
|
||||
// pointRadius(...) ------------------------------------------------------
|
||||
|
||||
geoPathCanvas = geoPathCanvas.pointRadius(5);
|
||||
let geoPathCanvasPointRadiusAccessor: ((this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number) | number = geoPathCanvas.pointRadius();
|
||||
const geoPathCanvasPointRadiusAccessor: ((this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number) | number = geoPathCanvas.pointRadius();
|
||||
|
||||
geoPathSVG = geoPathSVG.pointRadius(function (datum) {
|
||||
let that: SVGPathElement = this;
|
||||
let d: d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1> = datum;
|
||||
geoPathSVG = geoPathSVG.pointRadius(function(datum) {
|
||||
const that: SVGPathElement = this;
|
||||
const d: d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1> = datum;
|
||||
return datum.properties.name === 'Alabama' ? 10 : 15;
|
||||
});
|
||||
|
||||
let geoPathSVGPointRadiusAccessor: number | ((this: SVGPathElement, d: d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1>, ...args: any[]) => number) = geoPathSVG.pointRadius();
|
||||
const geoPathSVGPointRadiusAccessor: number | ((this: SVGPathElement, d: d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1>, ...args: any[]) => number) = geoPathSVG.pointRadius();
|
||||
// let geoPathSVGPointRadiusAccessorWrong1: number | ((this: SVGCircleElement, d: d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1>, ...args: any[]) => number)
|
||||
// = geoPathSVG.pointRadius(); // fails, mismatch in this context
|
||||
// let geoPathSVGPointRadiusAccessorWrong2: number | ((this: SVGPathElement, d: d3Geo.GeoGeometryObjects, ...args: any[]) => number) = geoPathSVG.pointRadius(); // fails, mismatch in object datum type
|
||||
@@ -521,7 +515,6 @@ geoPathArea = geoPathCanvas.area(sampleExtendedFeatureCollection);
|
||||
|
||||
// geoPathArea = geoPathSVG.area(sampleExtendedFeatureCollection); // fails, wrong data object type
|
||||
|
||||
|
||||
// bounds(...) ------------------------------------------------------
|
||||
|
||||
let geoPathBounds: [[number, number], [number, number]] = geoPathCanvas.bounds(samplePolygon);
|
||||
@@ -550,7 +543,6 @@ geoPathCentroid = geoPathCanvas.centroid(sampleExtendedFeatureCollection);
|
||||
|
||||
// geoPathCentroid = geoPathSVG.centroid(sampleExtendedFeatureCollection); // fails, wrong data object type
|
||||
|
||||
|
||||
// measure(...) ------------------------------------------------------
|
||||
|
||||
let geoPathMeasure: number = geoPathCanvas.measure(samplePolygon);
|
||||
@@ -579,22 +571,19 @@ geoPathCanvas(sampleExtendedFeatureCollection);
|
||||
|
||||
// Use path string generator for SVGPathElement
|
||||
|
||||
let svgPath: Selection<SVGPathElement, d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1>, any, any>;
|
||||
declare const svgPath: Selection<SVGPathElement, d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1>, any, any>;
|
||||
svgPath.attr('d', geoPathSVG);
|
||||
|
||||
let svgCircleWrong: Selection<SVGCircleElement, d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1>, any, any>;
|
||||
declare const svgCircleWrong: Selection<SVGCircleElement, d3Geo.ExtendedFeature<GeoJSON.Polygon, SampleProperties1>, any, any>;
|
||||
// svgCircleWrong.attr('d', geoPathSVG); // fails, mismatch in `this` context
|
||||
|
||||
let svgPathWrong: Selection<SVGPathElement, GeoJSON.Polygon, any, any>;
|
||||
declare const svgPathWrong: Selection<SVGPathElement, GeoJSON.Polygon, any, any>;
|
||||
// svgPathWrong.attr('d', geoPathSVG); // fails, mismatch in datum type
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Context interface
|
||||
// ----------------------------------------------------------------------
|
||||
let context: d3Geo.GeoContext = {
|
||||
const context: d3Geo.GeoContext = {
|
||||
beginPath: () => { return; },
|
||||
moveTo: (x: number, y: number) => { return; },
|
||||
lineTo: (x: number, y: number) => { return; },
|
||||
@@ -608,7 +597,7 @@ let context: d3Geo.GeoContext = {
|
||||
|
||||
// geoTransform(...) ====================================================
|
||||
|
||||
let transformFunction: { stream: (s: d3Geo.GeoStream) => {} } = d3Geo.geoTransform({});
|
||||
const transformFunction: { stream: (s: d3Geo.GeoStream) => {} } = d3Geo.geoTransform({});
|
||||
|
||||
interface CustomTranformProto extends d3Geo.GeoTransformPrototype {
|
||||
a: number;
|
||||
@@ -617,14 +606,13 @@ interface CustomTranformProto extends d3Geo.GeoTransformPrototype {
|
||||
let customTransformProto: CustomTranformProto;
|
||||
|
||||
customTransformProto = {
|
||||
point: function (x, y) {
|
||||
point(x, y) {
|
||||
return this.stream.point(x + this.a, -y);
|
||||
},
|
||||
a: 10
|
||||
};
|
||||
|
||||
let t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto);
|
||||
|
||||
const t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto);
|
||||
|
||||
// geoIdentity() ========================================================
|
||||
|
||||
@@ -675,7 +663,7 @@ reflecting = identityTransform.reflectY();
|
||||
// ----------------------------------------------------------------------
|
||||
// Stream interface
|
||||
// ----------------------------------------------------------------------
|
||||
let stream: d3Geo.GeoStream;
|
||||
declare const stream: d3Geo.GeoStream;
|
||||
|
||||
stream.point(0, 0);
|
||||
stream.point(0, 0, 0);
|
||||
@@ -696,4 +684,3 @@ d3Geo.geoStream(sampleExtendedFeature1, stream);
|
||||
d3Geo.geoStream(sampleExtendedFeature2, stream);
|
||||
d3Geo.geoStream(sampleFeatureCollection, stream);
|
||||
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
|
||||
|
||||
|
||||
Vendored
-20
@@ -274,7 +274,6 @@ export interface GeoRotation {
|
||||
*/
|
||||
export function geoRotation(angles: [number, number] | [number, number, number]): GeoRotation;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Spherical Shapes
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -535,8 +534,6 @@ export interface GeoStream {
|
||||
sphere?(): void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// geoStream(...) =======================================================
|
||||
|
||||
/**
|
||||
@@ -575,15 +572,10 @@ export function geoStream(object: GeoGeometryObjects, stream: GeoStream): void;
|
||||
*/
|
||||
export function geoStream(object: ExtendedGeometryCollection<GeoGeometryObjects>, stream: GeoStream): void;
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Projections
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Raw projections are point transformation functions that are used to implement custom projections; they typically passed to d3.geoProjection or d3.geoProjectionMutator.
|
||||
* They are exposed here to facilitate the derivation of related projections.
|
||||
@@ -737,7 +729,6 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
* Returns the projection.
|
||||
@@ -845,7 +836,6 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* A Conic Projection
|
||||
*/
|
||||
export interface GeoConicProjection extends GeoProjection {
|
||||
|
||||
/**
|
||||
* Return the standard parallels for the conic projection in degrees.
|
||||
*/
|
||||
@@ -856,10 +846,8 @@ export interface GeoConicProjection extends GeoProjection {
|
||||
* @param value A two-dimensional array representing the standard parallels in degrees.
|
||||
*/
|
||||
parallels(value: [number, number]): this;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// geoPath ==============================================================
|
||||
|
||||
/**
|
||||
@@ -869,7 +857,6 @@ export interface GeoConicProjection extends GeoProjection {
|
||||
* For reference to the CanvasRenderingContext2D see https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D
|
||||
*/
|
||||
export interface GeoContext {
|
||||
|
||||
/**
|
||||
* Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle.
|
||||
* The arc is drawn in clockwise directio by default.
|
||||
@@ -921,7 +908,6 @@ export interface GeoContext {
|
||||
* The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering.
|
||||
*/
|
||||
export interface GeoPath<This, DatumObject extends GeoPermissibleObjects> {
|
||||
|
||||
/**
|
||||
* Renders the given object, which may be any GeoJSON feature or geometry object:
|
||||
*
|
||||
@@ -1084,7 +1070,6 @@ export interface GeoPath<This, DatumObject extends GeoPermissibleObjects> {
|
||||
* It is passed the object to be rendered, and any additional arguments which have been passed into the call to the render function of the path generator.
|
||||
*/
|
||||
pointRadius(value: (this: This, object: DatumObject, ...args: any[]) => number): this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1143,9 +1128,6 @@ export function geoPath<DatumObject extends GeoPermissibleObjects>(projection?:
|
||||
*/
|
||||
export function geoPath<This, DatumObject extends GeoPermissibleObjects>(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath<This, DatumObject>;
|
||||
|
||||
|
||||
|
||||
|
||||
// geoProjection ==========================================================
|
||||
|
||||
/**
|
||||
@@ -1366,7 +1348,6 @@ export function geoTransform<T extends GeoTransformPrototype>(methods: T): { str
|
||||
* Geo Identity Transform
|
||||
*/
|
||||
export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
|
||||
/**
|
||||
* Returns the current viewport clip extent which defaults to null.
|
||||
*/
|
||||
@@ -1431,7 +1412,6 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
* Returns the projection.
|
||||
|
||||
Vendored
+2
-3
@@ -8,7 +8,6 @@
|
||||
import {Selection, BaseType, ArrayLike, ValueFn} from 'd3-selection';
|
||||
import {Transition} from 'd3-transition';
|
||||
|
||||
|
||||
/**
|
||||
* An object mapping attribute (or style or property) names to value accessors
|
||||
*
|
||||
@@ -29,7 +28,7 @@ declare module 'd3-selection' {
|
||||
* The third generic "PElement" refers to the type of the parent element(s) in the D3 selection.
|
||||
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s).
|
||||
*/
|
||||
export interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
||||
interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
||||
/**
|
||||
* Set multiple attributes on the given selection. Attribute values may be constant or derived from each node and its bound data.
|
||||
*
|
||||
@@ -85,7 +84,7 @@ declare module 'd3-transition' {
|
||||
* The third generic "PElement" refers to the type of the parent element(s) in the D3 selection in the Transition.
|
||||
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s) in the Transition.
|
||||
*/
|
||||
export interface Transition<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
||||
interface Transition<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
||||
/**
|
||||
* Set multiple attribute values. The transition will animate from the present value to the new value. Attribute values may be constant or derived from each node and its bound data.
|
||||
*
|
||||
|
||||
@@ -147,7 +147,6 @@ svgArc = svgArc.padRadius(null);
|
||||
|
||||
accessorArcDatumNumberOrNull = svgArc.padRadius();
|
||||
|
||||
|
||||
// use Arc(...) generator ============================================================
|
||||
|
||||
// centroid(...) ---------------------------------------------------------------------
|
||||
@@ -160,7 +159,6 @@ const centroid: [number, number] = svgArc.centroid(arcDatum);
|
||||
// use with canvas
|
||||
canvasArc(arcDefaultDatum);
|
||||
|
||||
|
||||
// use with svg
|
||||
|
||||
const pArc: Selection<SVGPathElement, ArcDatum, any, any> = select<SVGPathElement, ArcDatum>('.arc-paths'); // mock
|
||||
@@ -171,7 +169,6 @@ pArc.attr('d', svgArc);
|
||||
// wrongArc1.attr('d', svgArc); // fails, incompatible this contexts
|
||||
// wrongArc2.attr('d', svgArc); // fails, incompatible datum types
|
||||
|
||||
|
||||
// pathStringMaybe = svgArc(arcDatum); // fails, wrong this type for invocation
|
||||
|
||||
// Use with custom object
|
||||
@@ -230,12 +227,10 @@ interface PieDatum {
|
||||
name: string;
|
||||
}
|
||||
|
||||
|
||||
let accessorPieDatumNumber: (this: any, data: PieDatum[], ...args: any[]) => number;
|
||||
|
||||
// PieArcDatum interface =============================================================
|
||||
|
||||
|
||||
const pieArcObject: d3Shape.PieArcDatum<PieDatum> = {
|
||||
data: {
|
||||
val: 10,
|
||||
@@ -280,7 +275,6 @@ pie = pie.value((d, i, data) => {
|
||||
|
||||
pieValueAccessor = pie.value();
|
||||
|
||||
|
||||
// sort(...) ---------------------------------------------------------------------------
|
||||
|
||||
let pieSorter: ((a: PieDatum, b: PieDatum) => number) | null;
|
||||
@@ -332,7 +326,6 @@ defaultPie = defaultPie.padAngle(0.03);
|
||||
pie = pie.padAngle(d => {
|
||||
console.log(d.length > 0 ? d[0].val : 'no data'); // data type is Array<PieDatum>
|
||||
return 0.03;
|
||||
|
||||
});
|
||||
accessorPieDatumNumber = pie.padAngle();
|
||||
|
||||
@@ -351,7 +344,6 @@ let pieChart: Array<d3Shape.PieArcDatum<PieDatum>>;
|
||||
|
||||
pieChart = pie(pieData);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Test Line Generators
|
||||
// -----------------------------------------------------------------------------------
|
||||
@@ -519,7 +511,6 @@ const radialLineData: RadialLineDatum[] = [
|
||||
|
||||
const radialLinePathStringMaybe: string | null = radialLine(radialLineData);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Test Area Generators
|
||||
// -----------------------------------------------------------------------------------
|
||||
@@ -808,7 +799,6 @@ areaRadialLineGenerator = radialArea.lineInnerRadius();
|
||||
areaRadialLineGenerator = radialArea.lineEndAngle();
|
||||
areaRadialLineGenerator = radialArea.lineOuterRadius();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Test Curve Factories
|
||||
// -----------------------------------------------------------------------------------
|
||||
@@ -1002,7 +992,6 @@ pSymbol.attr('d', svgSymbol);
|
||||
// wrongSymbol1.attr('d', svgSymbol); // fails, incompatible this contexts
|
||||
// wrongSymbol2.attr('d', svgSymbol); // fails, incompatible datum types
|
||||
|
||||
|
||||
// pathStringMaybe = svgSymbol(symbolDatum); // fails, wrong this type for invocation
|
||||
|
||||
// Use with custom object
|
||||
@@ -1056,7 +1045,6 @@ const sym = new Symbolizer(100, 'square');
|
||||
pathStringMaybe = sym.getPathString();
|
||||
pathStringMaybe = sym.getPathString({ size: 10, type: 'circle' });
|
||||
|
||||
|
||||
// Test pre-fab symbols ===============================================================
|
||||
|
||||
const symbolArray: d3Shape.SymbolType[] = d3Shape.symbols;
|
||||
@@ -1099,7 +1087,6 @@ const stackData: StackDatum[] = [
|
||||
{ values: { bananas: 12, apples: 10, oranges: 50 } }
|
||||
];
|
||||
|
||||
|
||||
// Create stack generator ==========================================================
|
||||
|
||||
let defaultStack: d3Shape.Stack<any, { [key: string]: number }, string>;
|
||||
@@ -1110,7 +1097,6 @@ let overlyComplicatedStack: d3Shape.Stack<any, StackDatum, StackKey>;
|
||||
|
||||
overlyComplicatedStack = d3Shape.stack<StackDatum, StackKey>();
|
||||
|
||||
|
||||
// Configure stack generator =======================================================
|
||||
|
||||
// keys(...) ----------------------------------------------------------------------
|
||||
@@ -1181,8 +1167,6 @@ num = seriesPoint[0];
|
||||
num = seriesPoint[1];
|
||||
seriesDatum = seriesPoint.data;
|
||||
|
||||
|
||||
|
||||
// Test stack orders ===============================================================
|
||||
|
||||
let order: number[];
|
||||
|
||||
Vendored
+26
-34
@@ -790,7 +790,6 @@ export function line(): Line<[number, number]>;
|
||||
*/
|
||||
export function line<Datum>(): Line<Datum>;
|
||||
|
||||
|
||||
/**
|
||||
* The radial line generator produces a spline or polyline, as in a line chart.
|
||||
*
|
||||
@@ -1285,7 +1284,6 @@ export function area<Datum>(): Area<Datum>;
|
||||
* The generic refers to the data type of an element in the input array passed into the area generator.
|
||||
*/
|
||||
export interface RadialArea<Datum> {
|
||||
|
||||
/**
|
||||
* Generates a radial area for the given array of data.
|
||||
*
|
||||
@@ -1670,7 +1668,7 @@ export interface CurveFactory {
|
||||
* The first and last points are triplicated such that the spline starts at the first point and ends at the last point,
|
||||
* and is tangent to the line between the first and second points, and to the line between the penultimate and last points.
|
||||
*/
|
||||
export var curveBasis: CurveFactory;
|
||||
export const curveBasis: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for closed cubic basis spline generators.
|
||||
@@ -1678,7 +1676,7 @@ export var curveBasis: CurveFactory;
|
||||
* The curve generators produce a closed cubic basis spline using the specified control points.
|
||||
* When a line segment ends, the first three control points are repeated, producing a closed loop with C2 continuity.
|
||||
*/
|
||||
export var curveBasisClosed: CurveFactory;
|
||||
export const curveBasisClosed: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for open cubic basis spline generators.
|
||||
@@ -1686,7 +1684,7 @@ export var curveBasisClosed: CurveFactory;
|
||||
* The curve generators produce a cubic basis spline using the specified control points.
|
||||
* Unlike basis, the first and last points are not repeated, and thus the curve typically does not intersect these points.
|
||||
*/
|
||||
export var curveBasisOpen: CurveFactory;
|
||||
export const curveBasisOpen: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for straightened cubic basis spline generators.
|
||||
@@ -1719,8 +1717,7 @@ export interface CurveBundleFactory extends CurveFactoryLineOnly {
|
||||
*
|
||||
* This curve does not implement curve.areaStart and curve.areaEnd; it is intended to work with d3.line, not d3.area.
|
||||
*/
|
||||
export var curveBundle: CurveBundleFactory;
|
||||
|
||||
export const curveBundle: CurveBundleFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for cubic cardinal spline generators.
|
||||
@@ -1741,7 +1738,7 @@ export interface CurveCardinalFactory extends CurveFactory {
|
||||
* The curve generators produce a cubic cardinal spline using the specified control points, with one-sided differences used for the first and last piece.
|
||||
* The default tension is 0.
|
||||
*/
|
||||
export var curveCardinal: CurveCardinalFactory;
|
||||
export const curveCardinal: CurveCardinalFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for closed cubic cardinal spline generators.
|
||||
@@ -1750,7 +1747,7 @@ export var curveCardinal: CurveCardinalFactory;
|
||||
* When a line segment ends, the first three control points are repeated, producing a closed loop.
|
||||
* The default tension is 0.
|
||||
*/
|
||||
export var curveCardinalClosed: CurveCardinalFactory;
|
||||
export const curveCardinalClosed: CurveCardinalFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for open cubic cardinal spline generators.
|
||||
@@ -1760,7 +1757,7 @@ export var curveCardinalClosed: CurveCardinalFactory;
|
||||
* and thus the curve starts at the second point and ends at the penultimate point.
|
||||
* The default tension is 0.
|
||||
*/
|
||||
export var curveCardinalOpen: CurveCardinalFactory;
|
||||
export const curveCardinalOpen: CurveCardinalFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for cubic Catmull–Rom spline generators.
|
||||
@@ -1784,7 +1781,7 @@ export interface CurveCatmullRomFactory extends CurveFactory {
|
||||
* which defaults to 0.5, as proposed by Yuksel et al. in On the Parameterization of Catmull–Rom Curves,
|
||||
* with one-sided differences used for the first and last piece.
|
||||
*/
|
||||
export var curveCatmullRom: CurveCatmullRomFactory;
|
||||
export const curveCatmullRom: CurveCatmullRomFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for cubic Catmull–Rom spline generators.
|
||||
@@ -1793,7 +1790,7 @@ export var curveCatmullRom: CurveCatmullRomFactory;
|
||||
* which defaults to 0.5, as proposed by Yuksel et al. When a line segment ends,
|
||||
* the first three control points are repeated, producing a closed loop.
|
||||
*/
|
||||
export var curveCatmullRomClosed: CurveCatmullRomFactory;
|
||||
export const curveCatmullRomClosed: CurveCatmullRomFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for cubic Catmull–Rom spline generators.
|
||||
@@ -1802,22 +1799,21 @@ export var curveCatmullRomClosed: CurveCatmullRomFactory;
|
||||
* which defaults to 0.5, as proposed by Yuksel et al. Unlike curveCatmullRom, one-sided differences are not used for the first and last piece,
|
||||
* and thus the curve starts at the second point and ends at the penultimate point.
|
||||
*/
|
||||
export var curveCatmullRomOpen: CurveCatmullRomFactory;
|
||||
|
||||
export const curveCatmullRomOpen: CurveCatmullRomFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for polyline generators.
|
||||
*
|
||||
* The curve generators produce a polyline through the specified points.
|
||||
*/
|
||||
export var curveLinear: CurveFactory;
|
||||
export const curveLinear: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for closed polyline generators.
|
||||
*
|
||||
* The curve generators produce a closed polyline through the specified points by repeating the first point when the line segment ends.
|
||||
*/
|
||||
export var curveLinearClosed: CurveFactory;
|
||||
export const curveLinearClosed: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for cubic spline generators preserving monotonicity in y.
|
||||
@@ -1826,7 +1822,7 @@ export var curveLinearClosed: CurveFactory;
|
||||
* “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
|
||||
* Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.”
|
||||
*/
|
||||
export var curveMonotoneX: CurveFactory;
|
||||
export const curveMonotoneX: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for cubic spline generators preserving monotonicity in x.
|
||||
@@ -1835,14 +1831,14 @@ export var curveMonotoneX: CurveFactory;
|
||||
* “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations.
|
||||
* Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.”
|
||||
*/
|
||||
export var curveMonotoneY: CurveFactory;
|
||||
export const curveMonotoneY: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for natural cubic spline generators.
|
||||
*
|
||||
* The curve generators produce a natural cubic spline with the second derivative of the spline set to zero at the endpoints.
|
||||
*/
|
||||
export var curveNatural: CurveFactory;
|
||||
export const curveNatural: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for step function (midpoint) generators.
|
||||
@@ -1850,7 +1846,7 @@ export var curveNatural: CurveFactory;
|
||||
* The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
|
||||
* The y-value changes at the midpoint of each pair of adjacent x-values.
|
||||
*/
|
||||
export var curveStep: CurveFactory;
|
||||
export const curveStep: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for step function (after) generators.
|
||||
@@ -1858,7 +1854,7 @@ export var curveStep: CurveFactory;
|
||||
* The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
|
||||
* The y-value changes after the x-value.
|
||||
*/
|
||||
export var curveStepAfter: CurveFactory;
|
||||
export const curveStepAfter: CurveFactory;
|
||||
|
||||
/**
|
||||
* A curve factory for step function (before) generators.
|
||||
@@ -1866,8 +1862,7 @@ export var curveStepAfter: CurveFactory;
|
||||
* The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines.
|
||||
* The y-value changes before the x-value.
|
||||
*/
|
||||
export var curveStepBefore: CurveFactory;
|
||||
|
||||
export const curveStepBefore: CurveFactory;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// SYMBOLS
|
||||
@@ -1990,7 +1985,6 @@ export interface Symbol<This, Datum> {
|
||||
* @param context null, to remove rendering context.
|
||||
*/
|
||||
context(context: null): this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2017,43 +2011,42 @@ export function symbol<This, Datum>(): Symbol<This, Datum>;
|
||||
* An array containing the set of all built-in symbol types: circle, cross, diamond, square, star, triangle, and wye.
|
||||
* Useful for constructing the range of an ordinal scale should you wish to use a shape encoding for categorical data.
|
||||
*/
|
||||
export var symbols: SymbolType[];
|
||||
export const symbols: SymbolType[];
|
||||
|
||||
/**
|
||||
* The circle symbol type.
|
||||
*/
|
||||
export var symbolCircle: SymbolType;
|
||||
export const symbolCircle: SymbolType;
|
||||
|
||||
/**
|
||||
* The Greek cross symbol type, with arms of equal length.
|
||||
*/
|
||||
export var symbolCross: SymbolType;
|
||||
export const symbolCross: SymbolType;
|
||||
|
||||
/**
|
||||
* The rhombus symbol type.
|
||||
*/
|
||||
export var symbolDiamond: SymbolType;
|
||||
export const symbolDiamond: SymbolType;
|
||||
|
||||
/**
|
||||
* The square symbol type.
|
||||
*/
|
||||
export var symbolSquare: SymbolType;
|
||||
export const symbolSquare: SymbolType;
|
||||
|
||||
/**
|
||||
* The pentagonal star (pentagram) symbol type.
|
||||
*/
|
||||
export var symbolStar: SymbolType;
|
||||
export const symbolStar: SymbolType;
|
||||
|
||||
/**
|
||||
* he up-pointing triangle symbol type.
|
||||
*/
|
||||
export var symbolTriangle: SymbolType;
|
||||
export const symbolTriangle: SymbolType;
|
||||
|
||||
/**
|
||||
* The Y-shape symbol type.
|
||||
*/
|
||||
export var symbolWye: SymbolType;
|
||||
|
||||
export const symbolWye: SymbolType;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// STACKS
|
||||
@@ -2221,7 +2214,6 @@ export interface Stack<This, Datum, Key> {
|
||||
* The offset function is then responsible for updating the lower and upper values in the series array to layout the stack.
|
||||
*/
|
||||
offset(offset: (series: Series<Datum, Key>, order: number[]) => void): this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,7 +122,6 @@ const enterCircles = circles
|
||||
.style('stroke', d => d.color)
|
||||
.style('fill', d => d.color);
|
||||
|
||||
|
||||
const exitCircles = circles.exit<CircleDatum>(); // Note: need to re-type datum type, as the exit selection elements have the 'old data'
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -166,7 +165,6 @@ const duration: number = enterTransition.duration();
|
||||
enterTransition = enterTransition.delay(500); // settable and chainable
|
||||
const delay: number = enterTransition.delay();
|
||||
|
||||
|
||||
// ease() ---------------------------------------------------------------
|
||||
|
||||
let easingFn: (normalizedTime: number) => number;
|
||||
@@ -207,8 +205,6 @@ firstDivTransition = bodyTransition.select(function(d, i, g) {
|
||||
return this.querySelector('div')!; // 'this' type is HTMLElement, return type is HTMLDivElement
|
||||
});
|
||||
|
||||
|
||||
|
||||
// selectAll() ---------------------------------------------------------------
|
||||
|
||||
// assume paragraphs were previously selected and their data were set to ParagraphDatum type
|
||||
@@ -323,7 +319,6 @@ select<HTMLBodyElement, { test: string }>('body')
|
||||
.transition().duration(100)
|
||||
.text(d => d.test); // selection datum type
|
||||
|
||||
|
||||
// test, when it is not certain, whether an element of the type to be selected exists
|
||||
|
||||
let maybeG1: d3Transition.Transition<SVGCircleElement | null, any, SVGSVGElement, undefined>;
|
||||
@@ -343,7 +338,6 @@ maybeG1 = selectAll<SVGSVGElement, any>('svg')
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Tweening Function Use =====================================================
|
||||
@@ -366,7 +360,6 @@ exitTransition = exitTransition.styleTween('fill', function(d, i, group) {
|
||||
|
||||
let tweenFnAccessor: undefined | ((this: SVGCircleElement, datum?: CircleDatum, i?: number, group?: SVGCircleElement[] | ArrayLike<SVGCircleElement>) => ((t: number) => void));
|
||||
|
||||
|
||||
// chainable
|
||||
updateTransition = updateTransition.tween('fillColor', null); // remove named tween
|
||||
|
||||
@@ -407,7 +400,6 @@ exitTransition.remove();
|
||||
|
||||
let listener: undefined | ((this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | ArrayLike<SVGCircleElement>) => void);
|
||||
|
||||
|
||||
enterTransition = enterTransition.on('end', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
@@ -433,7 +425,6 @@ enterTransition = enterTransition.on('end', null); // check chaining return type
|
||||
// Test Control Flow
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
// each() -------------------------------------------------------------------------------
|
||||
|
||||
// each(valueFn: (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => void): Transition<GElement, Datum, PElement, PDatum>;
|
||||
@@ -524,7 +515,3 @@ updateTransitionActive = d3Transition.active<SVGCircleElement, CircleDatum, SVGS
|
||||
|
||||
d3Transition.interrupt(topTransition.selection().node());
|
||||
d3Transition.interrupt(topTransition.selection().node(), 'top');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-2
@@ -19,7 +19,7 @@ declare module 'd3-selection' {
|
||||
* The third generic "PElement" refers to the type of the parent element(s) in the D3 selection.
|
||||
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s).
|
||||
*/
|
||||
export interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
||||
interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
||||
/**
|
||||
* Interrupts the active transition of the specified name on the selected elements, and cancels any pending transitions with the specified name, if any.
|
||||
* If a name is not specified, null is used.
|
||||
@@ -88,7 +88,6 @@ export function interrupt(node: BaseType, name?: string): void;
|
||||
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s) in the Transition.
|
||||
*/
|
||||
export interface Transition<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
||||
|
||||
// Sub-selection -------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,7 +52,6 @@ function drawPointOnCanvas(radius: number) {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// SVG Prep -------------------------------------------------------------------
|
||||
|
||||
interface SVGDatum {
|
||||
@@ -66,7 +65,6 @@ const svg = select<SVGSVGElement, undefined>('svg')
|
||||
.attr('width', d => d.width)
|
||||
.attr('height', d => d.height);
|
||||
|
||||
|
||||
const g = svg.append<SVGGElement>('g');
|
||||
|
||||
g.selectAll()
|
||||
@@ -85,7 +83,6 @@ interface GroupDatum {
|
||||
toK: number;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Test Define ZoomBehaviour
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -93,7 +90,6 @@ interface GroupDatum {
|
||||
// Canvas Example -----------------------------------------------------------
|
||||
|
||||
function zoomedCanvas(this: HTMLCanvasElement, d: CanvasDatum) {
|
||||
|
||||
// Cast d3 event to D3ZoomEvent to be used in zoom event handler
|
||||
const e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
|
||||
if (context) {
|
||||
@@ -115,7 +111,6 @@ canvasZoom = d3Zoom.zoom()
|
||||
// SVG Example --------------------------------------------------------------
|
||||
|
||||
function zoomedSVGOverlay(this: SVGRectElement) {
|
||||
|
||||
// Cast d3 event to D3ZoomEvent to be used in zoom event handler
|
||||
const e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
|
||||
|
||||
@@ -126,7 +121,6 @@ let svgZoom: d3Zoom.ZoomBehavior<SVGRectElement, SVGDatum>;
|
||||
|
||||
svgZoom = d3Zoom.zoom<SVGRectElement, SVGDatum>();
|
||||
|
||||
|
||||
// filter() ----------------------------------------------------------------
|
||||
|
||||
// chainable
|
||||
@@ -141,7 +135,6 @@ svgZoom = svgZoom.filter(function(d, i, group) {
|
||||
let filterFn: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => boolean;
|
||||
filterFn = svgZoom.filter();
|
||||
|
||||
|
||||
// extent() ---------------------------------------------------------------
|
||||
|
||||
let extentAccessor: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => [[number, number], [number, number]];
|
||||
@@ -172,7 +165,6 @@ svgZoom = svgZoom.translateExtent([[-500, -500], [500, 500]]);
|
||||
let translateExtent: [[number, number], [number, number]];
|
||||
translateExtent = svgZoom.translateExtent();
|
||||
|
||||
|
||||
// duration() --------------------------------------------------------------
|
||||
|
||||
// chainable
|
||||
@@ -187,7 +179,6 @@ svgZoom = svgZoom.interpolate(interpolateZoom);
|
||||
svgZoom = svgZoom.interpolate(interpolate);
|
||||
svgZoom = svgZoom.interpolate(interpolateArray);
|
||||
|
||||
|
||||
// getter
|
||||
|
||||
let basicInterpolatorFactory: (a: ZoomView, b: ZoomView) => ((t: number) => ZoomView);
|
||||
@@ -220,7 +211,6 @@ if (zoomHandler) {
|
||||
// Test Attach ZoomBehaviour
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Canvas Example -----------------------------------------------------------
|
||||
|
||||
// attach the zoom behavior to the canvas element
|
||||
|
||||
Vendored
-1
@@ -8,7 +8,6 @@
|
||||
import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection';
|
||||
import { ZoomView, ZoomInterpolator } from 'd3-interpolate';
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Shared Type Definitions and Interfaces
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as d3 from 'd3';
|
||||
|
||||
|
||||
// TODO: complete tests. Note the tests here should be limited to
|
||||
// testing existence of re-exported members of the
|
||||
// constituent modules comprising the D3 version 4 standard bundle
|
||||
@@ -8,5 +7,3 @@ import * as d3 from 'd3';
|
||||
// Ability to access d3-select related properties
|
||||
|
||||
const d: d3.Selection<HTMLElement, any, null, undefined> = d3.selection();
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$(document).ready(() => {
|
||||
var config: DataTables.Settings = {
|
||||
const config: DataTables.Settings = {
|
||||
// FixedHeader extension options
|
||||
fixedHeader: {
|
||||
footer: true,
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
/// <reference types="datatables.net"/>
|
||||
|
||||
declare namespace DataTables {
|
||||
export interface Settings {
|
||||
interface Settings {
|
||||
/*
|
||||
* FixedHeader extension options
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$(document).ready(() => {
|
||||
var config: DataTables.Settings = {
|
||||
const config: DataTables.Settings = {
|
||||
// Select extension options
|
||||
select: {
|
||||
blurable: true,
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
/// <reference types="datatables.net"/>
|
||||
|
||||
declare namespace DataTables {
|
||||
export interface Settings {
|
||||
interface Settings {
|
||||
/*
|
||||
* Select extension options
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
|
||||
import {push, pull} from './index';
|
||||
import {push, pull} from 'dookie';
|
||||
|
||||
(async () => {
|
||||
|
||||
await push('mongodb://localhost:27017/test', {test: [{ok: 1}, {ok: 2}]});
|
||||
|
||||
})();
|
||||
|
||||
Vendored
+1
-1
@@ -65198,4 +65198,4 @@ data(key: "ejTreeMap"): ej.datavisualization.TreeMap;
|
||||
data(key: "ejTreeView"): ej.TreeView;
|
||||
data(key: "ejUploadbox"): ej.Uploadbox;
|
||||
data(key: "ejWaitingPopup"): ej.WaitingPopup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,9 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"comment-format": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-modifiers": false
|
||||
}
|
||||
}
|
||||
|
||||
+17
-18
@@ -1,4 +1,4 @@
|
||||
var App: any;
|
||||
let App: any;
|
||||
|
||||
App = Em.Application.create<Em.Application>();
|
||||
|
||||
@@ -22,7 +22,7 @@ declare class MyPerson extends Em.Object {
|
||||
static createMan(): MyPerson;
|
||||
}
|
||||
|
||||
var Person1 = Em.Object.extend<typeof MyPerson>({
|
||||
const Person1 = Em.Object.extend<typeof MyPerson>({
|
||||
say: (thing: string) => {
|
||||
alert(thing);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ var Person1 = Em.Object.extend<typeof MyPerson>({
|
||||
declare class MyPerson2 extends Em.Object {
|
||||
helloWorld(): void;
|
||||
}
|
||||
var tom = Person1.create<MyPerson2>({
|
||||
const tom = Person1.create<MyPerson2>({
|
||||
name: 'Tom Dale',
|
||||
helloWorld() {
|
||||
this.say('Hi my name is ' + this.get('name'));
|
||||
@@ -48,10 +48,9 @@ Person1.reopenClass({
|
||||
}
|
||||
});
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
declare var Person1: typeof MyPerson;
|
||||
Person1.createMan().get('isMan');
|
||||
|
||||
var person = Person1.create<Em.Object>({
|
||||
const person = Person1.create<Em.Object>({
|
||||
firstName: 'Yehuda',
|
||||
lastName: 'Katz'
|
||||
});
|
||||
@@ -63,13 +62,13 @@ App.todosController = Em.Object.create({
|
||||
Em.Object.create({ isDone: false })
|
||||
],
|
||||
remaining: (function() {
|
||||
var todos = this.get('todos');
|
||||
const todos = this.get('todos');
|
||||
return todos.filterProperty('isDone', false).get('length');
|
||||
}).property('todos.@each.isDone')
|
||||
});
|
||||
|
||||
var todos = App.todosController.get('todos');
|
||||
var todo = todos.objectAt(0);
|
||||
const todos = App.todosController.get('todos');
|
||||
let todo = todos.objectAt(0);
|
||||
todo.set('isDone', true);
|
||||
App.todosController.get('remaining');
|
||||
todo = Em.Object.create({ isDone: false });
|
||||
@@ -109,29 +108,29 @@ App.userController = Em.Object.create({
|
||||
Handlebars.registerHelper('highlight', (property: string, options: any) =>
|
||||
new Handlebars.SafeString('<span class="highlight">' + "some value" + '</span>'));
|
||||
|
||||
var coolView = App.CoolView.create();
|
||||
const coolView = App.CoolView.create();
|
||||
|
||||
var Person2 = Em.Object.extend<typeof Em.Object>({
|
||||
const Person2 = Em.Object.extend<typeof Em.Object>({
|
||||
sayHello() {
|
||||
console.log('Hello from ' + this.get('name'));
|
||||
}
|
||||
});
|
||||
var people = [
|
||||
const people = [
|
||||
Person2.create({ name: 'Juan' }),
|
||||
Person2.create({ name: 'Charles' }),
|
||||
Person2.create({ name: 'Majd' })
|
||||
];
|
||||
people.invoke('sayHello');
|
||||
|
||||
var arr = [Em.Object.create(), Em.Object.create()];
|
||||
const arr = [Em.Object.create(), Em.Object.create()];
|
||||
arr.setEach('name', 'unknown');
|
||||
arr.getEach('name');
|
||||
|
||||
var Person3 = Em.Object.extend<typeof Em.Object>({
|
||||
const Person3 = Em.Object.extend<typeof Em.Object>({
|
||||
name: null,
|
||||
isHappy: false
|
||||
});
|
||||
var people2 = [
|
||||
const people2 = [
|
||||
Person3.create({ name: 'Yehuda', isHappy: true }),
|
||||
Person3.create({ name: 'Majd', isHappy: false })
|
||||
];
|
||||
@@ -145,7 +144,7 @@ people2.everyProperty('isHappy', true);
|
||||
people2.someProperty('isHappy', true);
|
||||
|
||||
// Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html
|
||||
var promise = new Em.RSVP.Promise<string, string>((resolve: Function, reject: Function) => {
|
||||
const promise = new Em.RSVP.Promise<string, string>((resolve: Function, reject: Function) => {
|
||||
// on success
|
||||
resolve('ok!');
|
||||
|
||||
@@ -159,15 +158,15 @@ promise.then((value: any) => {
|
||||
// on rejection
|
||||
});
|
||||
|
||||
var mix1 = Ember.Mixin.create({
|
||||
const mix1 = Ember.Mixin.create({
|
||||
foo: 1
|
||||
});
|
||||
|
||||
var mix2 = Ember.Mixin.create({
|
||||
const mix2 = Ember.Mixin.create({
|
||||
bar: 2
|
||||
});
|
||||
|
||||
var component1 = Ember.Component.extend( mix1, mix2, {
|
||||
const component1 = Ember.Component.extend( mix1, mix2, {
|
||||
lyft: Ember.inject.service(),
|
||||
cars: Ember.computed.readOnly('lyft.cars')
|
||||
});
|
||||
|
||||
Vendored
+49
-62
@@ -7,7 +7,6 @@
|
||||
/// <reference types="handlebars" />
|
||||
|
||||
declare namespace EmberStates {
|
||||
|
||||
interface Transition {
|
||||
targetName: string;
|
||||
urlMethod: string;
|
||||
@@ -151,16 +150,13 @@ declare namespace EmberStates {
|
||||
*/
|
||||
followRedirects(): Ember.RSVP.Promise<any, any>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Get an alias to the global Array type to use in inner scope below.
|
||||
type GlobalArray<T> = T[];
|
||||
|
||||
declare namespace EmberTesting {
|
||||
|
||||
namespace Test {
|
||||
|
||||
class Adapter {
|
||||
asyncEnd(): void;
|
||||
asyncStart(): void;
|
||||
@@ -168,9 +164,7 @@ declare namespace EmberTesting {
|
||||
}
|
||||
|
||||
class QUnitAdapter extends Adapter { }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface Function {
|
||||
@@ -349,13 +343,10 @@ interface EnumerableConfigurationOptions {
|
||||
|
||||
type ItemIndexEnumerableCallbackTarget = (callback: ItemIndexEnumerableCallback, target?: any) => any[];
|
||||
|
||||
|
||||
type ItemIndexEnumerableCallback = (item: any, index: number, enumerable: Ember.Enumerable) => void;
|
||||
|
||||
|
||||
type ReduceCallback = (previousValue: any, item: any, index: number, enumerable: Ember.Enumerable) => void;
|
||||
|
||||
|
||||
interface TransitionsHash {
|
||||
contexts: any[];
|
||||
exitStates: Ember.State[];
|
||||
@@ -388,7 +379,7 @@ declare namespace Ember {
|
||||
Alias for jQuery.
|
||||
**/
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var $: JQueryStatic;
|
||||
const $: JQueryStatic;
|
||||
/**
|
||||
Creates an Ember.NativeArray from an Array like object. Does not modify the original object.
|
||||
Ember.A is not needed if Ember.EXTEND_PROTOTYPES is true (the default value). However, it is
|
||||
@@ -651,7 +642,7 @@ declare namespace Ember {
|
||||
removeObject(object: any): any;
|
||||
removeObjects(objects: Enumerable): MutableEnumberable;
|
||||
}
|
||||
var BOOTED: boolean;
|
||||
const BOOTED: boolean;
|
||||
/**
|
||||
Connects the properties of two objects so that whenever the value of one property changes,
|
||||
the other property will be changed also.
|
||||
@@ -967,17 +958,17 @@ declare namespace Ember {
|
||||
**/
|
||||
class Descriptor { }
|
||||
namespace ENV {
|
||||
export var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
|
||||
export var LOG_BINDINGS: boolean;
|
||||
export var LOG_STACKTRACE_ON_DEPRECATION: boolean;
|
||||
export var LOG_VERSION: boolean;
|
||||
export var MODEL_FACTORY_INJECTIONS: boolean;
|
||||
export var RAISE_ON_DEPRECATION: boolean;
|
||||
const EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
|
||||
const LOG_BINDINGS: boolean;
|
||||
const LOG_STACKTRACE_ON_DEPRECATION: boolean;
|
||||
const LOG_VERSION: boolean;
|
||||
const MODEL_FACTORY_INJECTIONS: boolean;
|
||||
const RAISE_ON_DEPRECATION: boolean;
|
||||
}
|
||||
namespace EXTEND_PROTOTYPES {
|
||||
export var Array: boolean;
|
||||
export var Function: boolean;
|
||||
export var String: boolean;
|
||||
const Array: boolean;
|
||||
const Function: boolean;
|
||||
const String: boolean;
|
||||
}
|
||||
/**
|
||||
This is the object instance returned when you get the @each property on an array. It uses
|
||||
@@ -1049,7 +1040,7 @@ declare namespace Ember {
|
||||
**/
|
||||
// Restore this to 'typeof Error' when https://github.com/Microsoft/TypeScript/issues/983 is resolved
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var Error: any; // typeof Error;
|
||||
const Error: any; // typeof Error;
|
||||
/**
|
||||
Handles delegating browser events to their corresponding Ember.Views. For example, when you click on
|
||||
a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called.
|
||||
@@ -1082,12 +1073,12 @@ declare namespace Ember {
|
||||
one(name: string, target: any, method: Function): Evented;
|
||||
trigger(name: string, ...args: string[]): void;
|
||||
}
|
||||
var FROZEN_ERROR: string;
|
||||
const FROZEN_ERROR: string;
|
||||
class Freezable {
|
||||
freeze(): Freezable;
|
||||
isFrozen: boolean;
|
||||
}
|
||||
var GUID_KEY: string;
|
||||
const GUID_KEY: string;
|
||||
namespace Handlebars {
|
||||
function compile(string: string): Function;
|
||||
function compile(environment: any, options?: any, context?: any, asObject?: any): any;
|
||||
@@ -1104,7 +1095,7 @@ declare namespace Ember {
|
||||
}
|
||||
function parse(string: string): any;
|
||||
function print(ast: any): void;
|
||||
var logger: typeof Ember.Logger;
|
||||
const logger: typeof Ember.Logger;
|
||||
function log(level: string, str: string): void;
|
||||
}
|
||||
class HashLocation extends Object {
|
||||
@@ -1140,8 +1131,8 @@ declare namespace Ember {
|
||||
static isMethod: boolean;
|
||||
rootURL: string;
|
||||
}
|
||||
var IS_BINDING: RegExp;
|
||||
var inject: {
|
||||
const IS_BINDING: RegExp;
|
||||
const inject: {
|
||||
controller(name?: string): Controller;
|
||||
service(name?: string): Service;
|
||||
};
|
||||
@@ -1158,15 +1149,15 @@ declare namespace Ember {
|
||||
subscribe(pattern: string, object: any): void;
|
||||
unsubscribe(subscriber: any): void;
|
||||
}
|
||||
var K: Function;
|
||||
var LOG_BINDINGS: boolean;
|
||||
var LOG_STACKTRACE_ON_DEPRECATION: boolean;
|
||||
var LOG_VERSION: boolean;
|
||||
const K: Function;
|
||||
const LOG_BINDINGS: boolean;
|
||||
const LOG_STACKTRACE_ON_DEPRECATION: boolean;
|
||||
const LOG_VERSION: boolean;
|
||||
class Location {
|
||||
create(options?: {}): any;
|
||||
registerImplementation(name: string, implementation: any): void;
|
||||
}
|
||||
var Logger: {
|
||||
const Logger: {
|
||||
assert(param: any): void;
|
||||
debug(...args: any[]): void;
|
||||
error(...args: any[]): void;
|
||||
@@ -1175,7 +1166,7 @@ declare namespace Ember {
|
||||
warn(...args: any[]): void;
|
||||
};
|
||||
function MANDATORY_SETTER_FUNCTION(value: string): void;
|
||||
var META_KEY: string;
|
||||
const META_KEY: string;
|
||||
class Map {
|
||||
copy(): Map;
|
||||
static create(): Map;
|
||||
@@ -1305,7 +1296,7 @@ declare namespace Ember {
|
||||
hasEnumerableObservers: boolean;
|
||||
lastObject: any;
|
||||
}
|
||||
var NAME_KEY: string;
|
||||
const NAME_KEY: string;
|
||||
class Namespace extends Object {
|
||||
static detect(obj: any): boolean;
|
||||
static detectInstance(obj: any): boolean;
|
||||
@@ -1425,7 +1416,7 @@ declare namespace Ember {
|
||||
static isClass: boolean;
|
||||
static isMethod: boolean;
|
||||
}
|
||||
var ORDER_DEFINITION: string[];
|
||||
const ORDER_DEFINITION: string[];
|
||||
class Object extends CoreObject implements Observable {
|
||||
addObserver: ModifyObserver;
|
||||
beginPropertyChanges(): Observable;
|
||||
@@ -1530,7 +1521,6 @@ declare namespace Ember {
|
||||
}
|
||||
|
||||
class Promise<T, U> implements Thenable<T, U> {
|
||||
|
||||
/**
|
||||
Promise objects represent the eventual result of an asynchronous operation. The
|
||||
primary way of interacting with a promise is through its `then` method, which
|
||||
@@ -1591,7 +1581,6 @@ declare namespace Ember {
|
||||
the [routing guide](http://emberjs.com/guides/routing/) for documentation.
|
||||
*/
|
||||
class Route extends Object implements ActionHandlerMixin, Evented {
|
||||
|
||||
static isClass: boolean;
|
||||
static isMethod: boolean;
|
||||
|
||||
@@ -1817,7 +1806,6 @@ declare namespace Ember {
|
||||
*/
|
||||
redirect(): EmberStates.Transition;
|
||||
|
||||
|
||||
/**
|
||||
Refresh the model on this route and any child routes, firing the
|
||||
`beforeModel`, `model`, and `afterModel` hooks in a similar fashion
|
||||
@@ -2157,7 +2145,7 @@ declare namespace Ember {
|
||||
toggleProperty(keyName: string): boolean;
|
||||
/* /Observable */
|
||||
}
|
||||
var STRINGS: boolean;
|
||||
const STRINGS: boolean;
|
||||
class State extends Object implements Evented {
|
||||
static detect(obj: any): boolean;
|
||||
static detectInstance(obj: any): boolean;
|
||||
@@ -2236,7 +2224,7 @@ declare namespace Ember {
|
||||
function underscore(str: string): string;
|
||||
function w(str: string): string[];
|
||||
}
|
||||
var TEMPLATES: {};
|
||||
const TEMPLATES: {};
|
||||
class TargetActionSupport {
|
||||
triggerAction(opts: {}): boolean;
|
||||
}
|
||||
@@ -2253,8 +2241,8 @@ declare namespace Ember {
|
||||
function registerHelper(name: string, helperMethod: Function): void;
|
||||
function registerAsyncHelper(name: string, helperMethod: Function): void;
|
||||
|
||||
var adapter: Object;
|
||||
var QUnitAdapter: Object;
|
||||
const adapter: Object;
|
||||
const QUnitAdapter: Object;
|
||||
|
||||
function registerWaiter(callback: Function): void;
|
||||
function registerWaiter(context: any, callback: Function): void;
|
||||
@@ -2325,18 +2313,18 @@ declare namespace Ember {
|
||||
bubbles: boolean;
|
||||
onEvent: string;
|
||||
}
|
||||
var VERSION: string;
|
||||
const VERSION: string;
|
||||
class ViewTargetActionSupport extends Mixin {
|
||||
target: any;
|
||||
actionContext: any;
|
||||
}
|
||||
var ViewUtils: {}; // TODO: define interface
|
||||
const ViewUtils: {}; // TODO: define interface
|
||||
function addListener(obj: any, eventName: string, target: Function | any, method: Function | string, once?: boolean): void;
|
||||
var addObserver: ModifyObserver;
|
||||
const addObserver: ModifyObserver;
|
||||
/**
|
||||
Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead.
|
||||
**/
|
||||
var alias: typeof deprecateFunc;
|
||||
const alias: typeof deprecateFunc;
|
||||
function aliasMethod(methodName: string): Descriptor;
|
||||
function assert(desc: string, test: boolean): void;
|
||||
function beginPropertyChanges(): void;
|
||||
@@ -2346,7 +2334,7 @@ declare namespace Ember {
|
||||
function changeProperties(callback: Function, binding?: any): void;
|
||||
function compare(v: any, w: any): number;
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var computed: {
|
||||
const computed: {
|
||||
(...args: any[]): ComputedProperty;
|
||||
alias(dependentKey: string): ComputedProperty;
|
||||
and(...args: string[]): ComputedProperty;
|
||||
@@ -2385,7 +2373,7 @@ declare namespace Ember {
|
||||
Ember.empty is deprecated. Please use Ember.isEmpty instead.
|
||||
**/
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var empty: typeof deprecateFunc;
|
||||
const empty: typeof deprecateFunc;
|
||||
function endPropertyChanges(): void;
|
||||
function finishChains(obj: any): void;
|
||||
function generateController(container: Container, controllerName: string, context: any): Controller;
|
||||
@@ -2394,7 +2382,7 @@ declare namespace Ember {
|
||||
/**
|
||||
getPath is deprecated since get now supports paths.
|
||||
**/
|
||||
var getPath: typeof deprecateFunc;
|
||||
const getPath: typeof deprecateFunc;
|
||||
function getWithDefault(root: string, key: string, defaultValue: any): any;
|
||||
function guidFor(obj: any): string;
|
||||
function handleErrors(func: Function, context: any): any;
|
||||
@@ -2407,7 +2395,7 @@ declare namespace Ember {
|
||||
function isEmpty(obj: any): boolean;
|
||||
function isEqual(a: any, b: any): boolean;
|
||||
function isGlobalPath(path: string): boolean;
|
||||
var isNamespace: boolean;
|
||||
const isNamespace: boolean;
|
||||
function isNone(obj: any): boolean;
|
||||
function isPrototypeOf(obj: {}): boolean;
|
||||
function isWatching(obj: any, key: string): boolean;
|
||||
@@ -2416,7 +2404,7 @@ declare namespace Ember {
|
||||
function listenersFor(obj: any, eventName: string): any[];
|
||||
function listenersUnion(obj: any, eventName: string, otherActions: any[]): void;
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var lookup: {}; // TODO: define interface
|
||||
const lookup: {}; // TODO: define interface
|
||||
function makeArray(obj: any): any[];
|
||||
function merge(original: any, updates: any): any;
|
||||
function meta(obj: any): {};
|
||||
@@ -2424,14 +2412,14 @@ declare namespace Ember {
|
||||
/**
|
||||
Ember.none is deprecated. Please use Ember.isNone instead.
|
||||
**/
|
||||
var none: typeof deprecateFunc;
|
||||
const none: typeof deprecateFunc;
|
||||
function observer(...args: any[]): Function;
|
||||
function observersFor(obj: any, path: string): any[];
|
||||
function onLoad(name: string, callback: Function): void;
|
||||
var onError: Error;
|
||||
const onError: Error;
|
||||
function overrideChains(obj: any, keyName: string, m: any): boolean;
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var platform: {
|
||||
const platform: {
|
||||
defineProperty: boolean;
|
||||
hasPropertyAccessors: boolean;
|
||||
};
|
||||
@@ -2443,7 +2431,7 @@ declare namespace Ember {
|
||||
function removeObserver(obj: any, path: string, target: any, method: Function): any;
|
||||
function required(): Descriptor;
|
||||
function rewatch(obj: any): void;
|
||||
var run: {
|
||||
const run: {
|
||||
(method: Function): void;
|
||||
(target: any, method: Function): void;
|
||||
begin(): void;
|
||||
@@ -2466,7 +2454,7 @@ declare namespace Ember {
|
||||
/**
|
||||
setPath is deprecated since set now supports paths.
|
||||
**/
|
||||
var setPath: typeof deprecateFunc;
|
||||
const setPath: typeof deprecateFunc;
|
||||
function setProperties(self: any, hash: {}): any;
|
||||
function subscribe(pattern: string, object: any): void;
|
||||
function toLocaleString(): string;
|
||||
@@ -2477,13 +2465,13 @@ declare namespace Ember {
|
||||
/**
|
||||
trySetPath has been renamed to trySet.
|
||||
**/
|
||||
var trySetPath: typeof deprecateFunc;
|
||||
const trySetPath: typeof deprecateFunc;
|
||||
function typeOf(item: any): string;
|
||||
function unwatch(obj: any, keyPath: string): void;
|
||||
function unwatchKey(obj: any, keyName: string): void;
|
||||
function unwatchPath(obj: any, keyPath: string): void;
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var uuid: number;
|
||||
const uuid: number;
|
||||
function valueOf(): {};
|
||||
function warn(message: string, test?: boolean): void;
|
||||
function watch(obj: any, keyPath: string): void;
|
||||
@@ -2491,18 +2479,17 @@ declare namespace Ember {
|
||||
function watchPath(obj: any, keyPath: string): void;
|
||||
function watchedEvents(obj: {}): any[];
|
||||
function wrap(func: Function, superFunc: Function): Function;
|
||||
var _ContainerProxyMixin: Mixin;
|
||||
var _RegistryProxyMixin: Mixin;
|
||||
const _ContainerProxyMixin: Mixin;
|
||||
const _RegistryProxyMixin: Mixin;
|
||||
function getOwner(object: any): any;
|
||||
function setOwner(object: any, owner: any): void;
|
||||
var testing: boolean;
|
||||
var MODEL_FACTORY_INJECTIONS: boolean;
|
||||
const testing: boolean;
|
||||
const MODEL_FACTORY_INJECTIONS: boolean;
|
||||
function assign(original: any, ...sources: any[]): any;
|
||||
}
|
||||
|
||||
import Em = Ember;
|
||||
|
||||
|
||||
/**
|
||||
* External ambient module - to allow "import Ember from 'ember';" to work correctly
|
||||
*/
|
||||
|
||||
Vendored
+5
-5
@@ -4,11 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace env {
|
||||
export interface Mappings {
|
||||
interface Mappings {
|
||||
[enviromentVariableName: string]: Mapping;
|
||||
}
|
||||
|
||||
export type Mapping = IntegerMapping | BooleanMapping | GenericMapping;
|
||||
type Mapping = IntegerMapping | BooleanMapping | GenericMapping;
|
||||
|
||||
interface GenericMapping {
|
||||
keypath: string;
|
||||
@@ -26,14 +26,14 @@ declare namespace env {
|
||||
strict: boolean;
|
||||
}
|
||||
|
||||
export interface Parsers {
|
||||
interface Parsers {
|
||||
[parserName: string]: (str: string, opts: any) => any;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
interface Options {
|
||||
parsers: Parsers;
|
||||
}
|
||||
}
|
||||
|
||||
declare function env(map: env.Mappings, options?: env.Options): any;
|
||||
declare function env(map: env.Mappings, options?: env.Options): any;
|
||||
export = env;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/// <reference types="mocha"" />
|
||||
|
||||
import {Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies} from 'expect';
|
||||
|
||||
Vendored
+13
-15
@@ -4,11 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace expect {
|
||||
export type CompareValues<T> = (a: T, b: T) => boolean;
|
||||
export type Comparator = (target: {}, key: string) => boolean;
|
||||
export type KeyType = string | number;
|
||||
type CompareValues<T> = (a: T, b: T) => boolean;
|
||||
type Comparator = (target: {}, key: string) => boolean;
|
||||
type KeyType = string | number;
|
||||
|
||||
export class Expectation<T> {
|
||||
class Expectation<T> {
|
||||
constructor(actual: any);
|
||||
toExist(message?: string): Expectation<T>;
|
||||
toBeTruthy(message?: string): Expectation<T>;
|
||||
@@ -61,16 +61,16 @@ declare namespace expect {
|
||||
withArgs(...args: any[]): Expectation<T>;
|
||||
}
|
||||
|
||||
export interface Extension {
|
||||
interface Extension {
|
||||
[name: string]: (args?: any[]) => void;
|
||||
}
|
||||
|
||||
export interface Call<T> {
|
||||
interface Call<T> {
|
||||
context: T;
|
||||
arguments: any[];
|
||||
}
|
||||
|
||||
export interface Spy<T> {
|
||||
interface Spy<T> {
|
||||
(...args: any[]): void;
|
||||
__isSpy: boolean;
|
||||
calls: Array<Call<T>>;
|
||||
@@ -84,14 +84,12 @@ declare namespace expect {
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
|
||||
export function createSpy(fn?: (...args: any[]) => any, restore?: (...args: any[]) => any): Spy<any>;
|
||||
export function spyOn<T>(object: T, methodName: string): Spy<T>;
|
||||
export function isSpy(object: {}): boolean;
|
||||
export function restoreSpies(): void;
|
||||
export function assert(condition: boolean, messageFormat: string, ...extraArgs: any[]): void;
|
||||
export function extend(extension: Extension): void;
|
||||
|
||||
function createSpy(fn?: (...args: any[]) => any, restore?: (...args: any[]) => any): Spy<any>;
|
||||
function spyOn<T>(object: T, methodName: string): Spy<T>;
|
||||
function isSpy(object: {}): boolean;
|
||||
function restoreSpies(): void;
|
||||
function assert(condition: boolean, messageFormat: string, ...extraArgs: any[]): void;
|
||||
function extend(extension: Extension): void;
|
||||
}
|
||||
|
||||
declare function expect<T>(actual: T): expect.Expectation<T>;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import RateLimit = require("express-rate-limit");
|
||||
|
||||
var apiLimiter = new RateLimit({
|
||||
const apiLimiter = new RateLimit({
|
||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
max: 100,
|
||||
delayMs: 0 // disabled
|
||||
});
|
||||
|
||||
var createAccountLimiter = new RateLimit({
|
||||
const createAccountLimiter = new RateLimit({
|
||||
windowMs: 60 * 60 * 1000, // 1 hour window
|
||||
delayAfter: 1, // begin slowing down responses after the first request
|
||||
delayMs: 3 * 1000, // slow down subsequent responses by 3 seconds per request
|
||||
@@ -20,6 +20,6 @@ class SomeStore implements RateLimit.Store {
|
||||
resetKey(key: string) { };
|
||||
};
|
||||
|
||||
var limiterWithStore = new RateLimit({
|
||||
const limiterWithStore = new RateLimit({
|
||||
store: new SomeStore()
|
||||
});
|
||||
|
||||
Vendored
+3
-7
@@ -8,13 +8,13 @@ import express = require("express");
|
||||
declare namespace RateLimit {
|
||||
type StoreIncrementCallback = (err?: {}, hits?: number) => void;
|
||||
|
||||
export interface Store {
|
||||
interface Store {
|
||||
incr: (key: string, cb: StoreIncrementCallback) => void;
|
||||
resetAll: () => void;
|
||||
resetKey: (key: string) => void;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
interface Options {
|
||||
delayAfter?: number;
|
||||
delayMs?: number;
|
||||
handlers?: () => any;
|
||||
@@ -29,9 +29,5 @@ declare namespace RateLimit {
|
||||
}
|
||||
}
|
||||
|
||||
interface RateLimitStatic {
|
||||
new(options: RateLimit.Options): express.RequestHandler;
|
||||
}
|
||||
|
||||
declare var RateLimit: RateLimitStatic;
|
||||
declare var RateLimit: new (options: RateLimit.Options) => express.RequestHandler;
|
||||
export = RateLimit;
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace extract {
|
||||
export interface Options {
|
||||
interface Options {
|
||||
dir?: string;
|
||||
defaultDirMode?: number;
|
||||
defaultFileMode?: number;
|
||||
|
||||
+121
-136
@@ -1,7 +1,7 @@
|
||||
import * as fabric from "fabric";
|
||||
|
||||
function sample1() {
|
||||
var canvas = new fabric.Canvas('c', {
|
||||
const canvas = new fabric.Canvas('c', {
|
||||
hoverCursor: 'pointer',
|
||||
selection: false,
|
||||
});
|
||||
@@ -13,7 +13,7 @@ function sample1() {
|
||||
e.target.opacity = 1;
|
||||
});
|
||||
|
||||
for (var i = 0, len = 15; i < len; i++) {
|
||||
for (let i = 0; i < 15; i++) {
|
||||
fabric.Image.fromURL('../assets/ladybug.png', img => {
|
||||
img.set({
|
||||
left: fabric.util.getRandomInt(0, 600),
|
||||
@@ -33,17 +33,16 @@ function sample1() {
|
||||
}
|
||||
|
||||
function sample2() {
|
||||
|
||||
var dot: fabric.Circle, i: number,
|
||||
t1: number, t2: number,
|
||||
startTimer = () => {
|
||||
t1 = new Date().getTime();
|
||||
return t1;
|
||||
},
|
||||
stopTimer = () => {
|
||||
t2 = new Date().getTime();
|
||||
return t2 - t1;
|
||||
},
|
||||
let dot: fabric.Circle, i: number;
|
||||
let t1: number, t2: number;
|
||||
const startTimer = () => {
|
||||
t1 = new Date().getTime();
|
||||
return t1;
|
||||
};
|
||||
const stopTimer = () => {
|
||||
t2 = new Date().getTime();
|
||||
return t2 - t1;
|
||||
},
|
||||
getRandomInt = fabric.util.getRandomInt,
|
||||
rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"],
|
||||
rainbowEnd = rainbow.length - 1;
|
||||
@@ -51,7 +50,7 @@ function sample2() {
|
||||
//
|
||||
// Rendering canvas #1
|
||||
//
|
||||
var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }),
|
||||
const canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }),
|
||||
results1 = document.getElementById('results-c1');
|
||||
|
||||
startTimer();
|
||||
@@ -66,11 +65,10 @@ function sample2() {
|
||||
}
|
||||
results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms';
|
||||
|
||||
|
||||
//
|
||||
// Rendering canvas #2
|
||||
//
|
||||
var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddRemove: false }),
|
||||
const canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddRemove: false }),
|
||||
results2 = document.getElementById('results-c2');
|
||||
|
||||
startTimer();
|
||||
@@ -88,35 +86,34 @@ function sample2() {
|
||||
}
|
||||
|
||||
function sample3() {
|
||||
|
||||
var $: (id: string) => HTMLElement = (id: string) => document.getElementById(id);
|
||||
const $: (id: string) => HTMLElement = (id: string) => document.getElementById(id);
|
||||
|
||||
function applyFilter(index: number, filter: any) {
|
||||
var obj: fabric.Image = <fabric.Image> canvas.getActiveObject();
|
||||
const obj: fabric.Image = <fabric.Image> canvas.getActiveObject();
|
||||
obj.filters[index] = filter;
|
||||
obj.applyFilters(canvas.renderAll.bind(canvas));
|
||||
}
|
||||
|
||||
function applyFilterValue(index: number, prop: string, value: any) {
|
||||
var obj: fabric.Image = <fabric.Image> canvas.getActiveObject();
|
||||
const obj: fabric.Image = <fabric.Image> canvas.getActiveObject();
|
||||
if (obj.filters[index]) {
|
||||
obj.applyFilters(canvas.renderAll.bind(canvas));
|
||||
}
|
||||
}
|
||||
|
||||
var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }),
|
||||
const canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }),
|
||||
f = fabric.Image.filters;
|
||||
|
||||
canvas.on({
|
||||
'object:selected': () => {
|
||||
fabric.util.toArray(document.getElementsByTagName('input')).forEach(el => { el.disabled = false; });
|
||||
|
||||
var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness',
|
||||
const filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness',
|
||||
'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen'];
|
||||
|
||||
for (var i = 0; i < filters.length; i++) {
|
||||
var checkBox = <HTMLInputElement> $(filters[i]);
|
||||
var image = <fabric.Image> canvas.getActiveObject();
|
||||
for (let i = 0; i < filters.length; i++) {
|
||||
const checkBox = <HTMLInputElement> $(filters[i]);
|
||||
const image = <fabric.Image> canvas.getActiveObject();
|
||||
checkBox.checked = !!image.filters[i];
|
||||
}
|
||||
},
|
||||
@@ -126,7 +123,7 @@ function sample3() {
|
||||
});
|
||||
|
||||
fabric.Image.fromURL('../assets/printio.png', img => {
|
||||
var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9);
|
||||
const oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9);
|
||||
canvas.add(oImg).renderAll();
|
||||
canvas.setActiveObject(oImg);
|
||||
});
|
||||
@@ -211,11 +208,10 @@ function sample3() {
|
||||
}
|
||||
|
||||
function sample4() {
|
||||
const canvas = new fabric.Canvas('c');
|
||||
const $: (id: string) => HTMLElement = id => document.getElementById(id);
|
||||
|
||||
var canvas = new fabric.Canvas('c');
|
||||
var $: (id: string) => HTMLElement = id => document.getElementById(id);
|
||||
|
||||
var rect = new fabric.Rect({
|
||||
const rect = new fabric.Rect({
|
||||
width: 100,
|
||||
height: 100,
|
||||
top: 150,
|
||||
@@ -225,32 +221,31 @@ function sample4() {
|
||||
|
||||
canvas.add(rect);
|
||||
|
||||
var angleControl = <HTMLInputElement> $('angle-control');
|
||||
const angleControl = <HTMLInputElement> $('angle-control');
|
||||
angleControl.onchange = function(this: HTMLInputElement) {
|
||||
rect.setAngle(+this.value).setCoords();
|
||||
canvas.renderAll();
|
||||
};
|
||||
|
||||
var scaleControl = <HTMLInputElement> $('scale-control');
|
||||
const scaleControl = <HTMLInputElement> $('scale-control');
|
||||
scaleControl.onchange = function(this: HTMLInputElement) {
|
||||
rect.scale(+this.value).setCoords();
|
||||
canvas.renderAll();
|
||||
};
|
||||
|
||||
var topControl = <HTMLInputElement> $('top-control');
|
||||
const topControl = <HTMLInputElement> $('top-control');
|
||||
topControl.onchange = function(this: HTMLInputElement) {
|
||||
rect.setTop(+this.value).setCoords();
|
||||
canvas.renderAll();
|
||||
};
|
||||
|
||||
var leftControl = <HTMLInputElement> $('left-control');
|
||||
const leftControl = <HTMLInputElement> $('left-control');
|
||||
leftControl.onchange = function(this: HTMLInputElement) {
|
||||
rect.setLeft(+this.value).setCoords();
|
||||
canvas.renderAll();
|
||||
};
|
||||
|
||||
function updateControls() {
|
||||
|
||||
scaleControl.value = rect.getScaleX().toString();
|
||||
angleControl.value = rect.getAngle().toString();
|
||||
leftControl.value = rect.getLeft().toString();
|
||||
@@ -263,7 +258,6 @@ function sample4() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
declare module "fabric" {
|
||||
export interface CircleWithLineInfos extends Circle {
|
||||
line1?: Line;
|
||||
@@ -274,8 +268,8 @@ declare module "fabric" {
|
||||
}
|
||||
|
||||
function sample5() {
|
||||
var makeCircle = (left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle => {
|
||||
var c = <fabric.CircleWithLineInfos> new fabric.Circle({
|
||||
const makeCircle = (left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle => {
|
||||
const c = <fabric.CircleWithLineInfos> new fabric.Circle({
|
||||
left,
|
||||
top,
|
||||
strokeWidth: 5,
|
||||
@@ -300,9 +294,9 @@ function sample5() {
|
||||
});
|
||||
}
|
||||
|
||||
var canvas = new fabric.Canvas('c', { selection: false });
|
||||
const canvas = new fabric.Canvas('c', { selection: false });
|
||||
|
||||
var line = makeLine([250, 125, 250, 175]),
|
||||
const line = makeLine([250, 125, 250, 175]),
|
||||
line2 = makeLine([250, 175, 250, 250]),
|
||||
line3 = makeLine([250, 250, 300, 350]),
|
||||
line4 = makeLine([250, 250, 200, 350]),
|
||||
@@ -322,7 +316,7 @@ function sample5() {
|
||||
);
|
||||
|
||||
canvas.on('object:moving', e => {
|
||||
var p = <fabric.CircleWithLineInfos> e.target;
|
||||
const p = <fabric.CircleWithLineInfos> e.target;
|
||||
p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top });
|
||||
p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top });
|
||||
p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top });
|
||||
@@ -332,9 +326,9 @@ function sample5() {
|
||||
}
|
||||
|
||||
function sample6() {
|
||||
var canvas = new fabric.Canvas('c');
|
||||
const canvas = new fabric.Canvas('c');
|
||||
fabric.loadSVGFromURL('../assets/135.svg', objects => {
|
||||
var obj = objects[0].scale(0.25);
|
||||
const obj = objects[0].scale(0.25);
|
||||
canvas.centerObject(obj);
|
||||
canvas.add(obj);
|
||||
|
||||
@@ -344,17 +338,15 @@ function sample6() {
|
||||
canvas.add(obj.clone(() => { }).set({ left: 480, top: 400, angle: 15 }));
|
||||
|
||||
canvas.on('mouse:move', options => {
|
||||
var p = canvas.getPointer(options.e);
|
||||
const p = canvas.getPointer(options.e);
|
||||
|
||||
canvas.forEachObject(obj => {
|
||||
var distX = Math.abs(p.x - obj.left),
|
||||
const distX = Math.abs(p.x - obj.left),
|
||||
distY = Math.abs(p.y - obj.top),
|
||||
dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2)));
|
||||
obj.setOpacity(1 / (dist / 20));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -365,22 +357,20 @@ declare module "fabric" {
|
||||
}
|
||||
|
||||
function sample7() {
|
||||
|
||||
var canvas = new fabric.Canvas('c', { selection: false });
|
||||
const canvas = new fabric.Canvas('c', { selection: false });
|
||||
|
||||
setInterval(() => {
|
||||
fabric.Image.fromURL('../assets/ladybug.png', obj => {
|
||||
var img = <fabric.ImageWithInfo> obj;
|
||||
const img = <fabric.ImageWithInfo> obj;
|
||||
img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50);
|
||||
img.movingLeft = !!Math.round(Math.random());
|
||||
canvas.add(img);
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
|
||||
var animate = (function animate() {
|
||||
const animate = (function animate() {
|
||||
canvas.forEachObject(obj => {
|
||||
var img = <fabric.ImageWithInfo> obj;
|
||||
const img = <fabric.ImageWithInfo> obj;
|
||||
img.left += (img.movingLeft ? -1 : 1);
|
||||
img.top += 1;
|
||||
if (img.left > 900 || img.top > 500) {
|
||||
@@ -397,7 +387,6 @@ function sample7() {
|
||||
}
|
||||
|
||||
function sample8() {
|
||||
|
||||
function pad(str: string, length: number): string {
|
||||
while (str.length < length) {
|
||||
str = '0' + str;
|
||||
@@ -405,7 +394,7 @@ function sample8() {
|
||||
return str;
|
||||
}
|
||||
|
||||
var getRandomInt = fabric.util.getRandomInt;
|
||||
const getRandomInt = fabric.util.getRandomInt;
|
||||
|
||||
function getRandomColor() {
|
||||
return (
|
||||
@@ -423,18 +412,18 @@ function sample8() {
|
||||
(fabric.Object.prototype as any).cornersize = 30;
|
||||
}
|
||||
|
||||
var canvas = new fabric.Canvas('canvas');
|
||||
const canvas = new fabric.Canvas('canvas');
|
||||
// canvas.controlsAboveOverlay = true;
|
||||
|
||||
function updateComplexity() {
|
||||
setTimeout(() => {
|
||||
var element = <HTMLElement> document.getElementById('complexity').childNodes[1];
|
||||
const element = <HTMLElement> document.getElementById('complexity').childNodes[1];
|
||||
element.innerHTML = ' ' + canvas.complexity();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
document.getElementById('commands').onclick = (ev: any) => {
|
||||
var ev: any = ev || window.event;
|
||||
ev = ev || window.event;
|
||||
|
||||
if (ev.preventDefault) {
|
||||
ev.preventDefault();
|
||||
@@ -442,12 +431,12 @@ function sample8() {
|
||||
ev.returnValue = false;
|
||||
}
|
||||
|
||||
var element: any = ev.target || ev.srcElement;
|
||||
let element: any = ev.target || ev.srcElement;
|
||||
if (element.nodeName.toLowerCase() === 'strong') {
|
||||
element = element.parentNode;
|
||||
}
|
||||
|
||||
var className = element.className,
|
||||
const className = element.className,
|
||||
offset = 50,
|
||||
left = fabric.util.getRandomInt(0 + offset, 700 - offset),
|
||||
top = fabric.util.getRandomInt(0 + offset, 500 - offset),
|
||||
@@ -455,7 +444,6 @@ function sample8() {
|
||||
width = fabric.util.getRandomInt(30, 50),
|
||||
opacity = ((min: number, max: number) => Math.random() * (max - min) + min)(0.5, 1);
|
||||
|
||||
|
||||
switch (className) {
|
||||
case 'rect':
|
||||
canvas.add(new fabric.Rect({
|
||||
@@ -519,11 +507,11 @@ function sample8() {
|
||||
break;
|
||||
|
||||
case 'shape':
|
||||
var id: any = element.id;
|
||||
const id: any = element.id;
|
||||
const match = /\d+$/.exec(id);
|
||||
if (match) {
|
||||
fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', (objects, options) => {
|
||||
var loadedObject = fabric.util.groupSVGElements(objects, options);
|
||||
const loadedObject = fabric.util.groupSVGElements(objects, options);
|
||||
|
||||
loadedObject.set({
|
||||
left,
|
||||
@@ -552,13 +540,12 @@ function sample8() {
|
||||
};
|
||||
|
||||
document.getElementById('execute').onclick = () => {
|
||||
var code = (<HTMLInputElement> document.getElementById('canvas-console')).value;
|
||||
const code = (<HTMLInputElement> document.getElementById('canvas-console')).value;
|
||||
if (!(/^\s+$/).test(code)) {
|
||||
eval(code); // tslint:disable-line:no-eval
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
document.getElementById('rasterize').onclick = () => {
|
||||
if (!fabric.Canvas.supports('toDataURL')) {
|
||||
alert('This browser doesn\'t provide means to serialize canvas to an image');
|
||||
@@ -567,14 +554,14 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var removeSelectedEl = document.getElementById('remove-selected');
|
||||
const removeSelectedEl = document.getElementById('remove-selected');
|
||||
removeSelectedEl.onclick = () => {
|
||||
var activeObject = canvas.getActiveObject(),
|
||||
const activeObject = canvas.getActiveObject(),
|
||||
activeGroup = canvas.getActiveGroup();
|
||||
if (activeObject) {
|
||||
canvas.remove(activeObject);
|
||||
} else if (activeGroup) {
|
||||
var objectsInGroup = activeGroup.getObjects();
|
||||
const objectsInGroup = activeGroup.getObjects();
|
||||
canvas.discardActiveGroup();
|
||||
objectsInGroup.forEach(object => {
|
||||
canvas.remove(object);
|
||||
@@ -582,9 +569,9 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var supportsInputOfType = (type: string) => {
|
||||
const supportsInputOfType = (type: string) => {
|
||||
return () => {
|
||||
var el = document.createElement('input');
|
||||
const el = document.createElement('input');
|
||||
try {
|
||||
el.type = type;
|
||||
} catch (err) { }
|
||||
@@ -592,18 +579,18 @@ function sample8() {
|
||||
};
|
||||
};
|
||||
|
||||
var supportsSlider = supportsInputOfType('range'),
|
||||
const supportsSlider = supportsInputOfType('range'),
|
||||
supportsColorpicker = supportsInputOfType('color');
|
||||
|
||||
if (supportsSlider()) {
|
||||
(() => {
|
||||
var controls = document.getElementById('controls');
|
||||
const controls = document.getElementById('controls');
|
||||
|
||||
var sliderLabel = document.createElement('label');
|
||||
const sliderLabel = document.createElement('label');
|
||||
sliderLabel.htmlFor = 'opacity';
|
||||
sliderLabel.innerHTML = 'Opacity: ';
|
||||
|
||||
var slider = document.createElement('input');
|
||||
const slider = document.createElement('input');
|
||||
|
||||
try { slider.type = 'range'; } catch (err) { }
|
||||
|
||||
@@ -616,7 +603,7 @@ function sample8() {
|
||||
canvas.calcOffset();
|
||||
|
||||
slider.onchange = function() {
|
||||
var activeObject = canvas.getActiveObject(),
|
||||
const activeObject = canvas.getActiveObject(),
|
||||
activeGroup = canvas.getActiveGroup();
|
||||
|
||||
if (activeObject || activeGroup) {
|
||||
@@ -629,14 +616,14 @@ function sample8() {
|
||||
|
||||
if (supportsColorpicker()) {
|
||||
(() => {
|
||||
var controls = document.getElementById('controls');
|
||||
const controls = document.getElementById('controls');
|
||||
|
||||
var label = document.createElement('label');
|
||||
const label = document.createElement('label');
|
||||
label.htmlFor = 'color';
|
||||
label.innerHTML = 'Color: ';
|
||||
label.style.marginLeft = '10px';
|
||||
|
||||
var colorpicker = document.createElement('input');
|
||||
const colorpicker = document.createElement('input');
|
||||
colorpicker.type = 'color';
|
||||
colorpicker.id = 'color';
|
||||
colorpicker.style.width = '40px';
|
||||
@@ -647,7 +634,7 @@ function sample8() {
|
||||
canvas.calcOffset();
|
||||
|
||||
colorpicker.onchange = function() {
|
||||
var activeObject = canvas.getActiveObject(),
|
||||
const activeObject = canvas.getActiveObject(),
|
||||
activeGroup = canvas.getActiveGroup();
|
||||
|
||||
if (activeObject || activeGroup) {
|
||||
@@ -658,9 +645,9 @@ function sample8() {
|
||||
})();
|
||||
}
|
||||
|
||||
var lockHorizontallyEl = document.getElementById('lock-horizontally');
|
||||
const lockHorizontallyEl = document.getElementById('lock-horizontally');
|
||||
lockHorizontallyEl.onclick = () => {
|
||||
var activeObject: any = canvas.getActiveObject();
|
||||
const activeObject: any = canvas.getActiveObject();
|
||||
if (activeObject) {
|
||||
activeObject.lockMovementX = !activeObject.lockMovementX;
|
||||
lockHorizontallyEl.innerHTML = activeObject.lockMovementX
|
||||
@@ -669,9 +656,9 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var lockVerticallyEl = document.getElementById('lock-vertically');
|
||||
const lockVerticallyEl = document.getElementById('lock-vertically');
|
||||
lockVerticallyEl.onclick = () => {
|
||||
var activeObject: any = canvas.getActiveObject();
|
||||
const activeObject: any = canvas.getActiveObject();
|
||||
if (activeObject) {
|
||||
activeObject.lockMovementY = !activeObject.lockMovementY;
|
||||
lockVerticallyEl.innerHTML = activeObject.lockMovementY
|
||||
@@ -680,9 +667,9 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var lockScalingXEl = document.getElementById('lock-scaling-x');
|
||||
const lockScalingXEl = document.getElementById('lock-scaling-x');
|
||||
lockScalingXEl.onclick = () => {
|
||||
var activeObject: any = canvas.getActiveObject();
|
||||
const activeObject: any = canvas.getActiveObject();
|
||||
if (activeObject) {
|
||||
activeObject.lockScalingX = !activeObject.lockScalingX;
|
||||
lockScalingXEl.innerHTML = activeObject.lockScalingX
|
||||
@@ -691,9 +678,9 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var lockScalingYEl = document.getElementById('lock-scaling-y');
|
||||
const lockScalingYEl = document.getElementById('lock-scaling-y');
|
||||
lockScalingYEl.onclick = () => {
|
||||
var activeObject: any = canvas.getActiveObject();
|
||||
const activeObject: any = canvas.getActiveObject();
|
||||
if (activeObject) {
|
||||
activeObject.lockScalingY = !activeObject.lockScalingY;
|
||||
lockScalingYEl.innerHTML = activeObject.lockScalingY
|
||||
@@ -702,9 +689,9 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var lockRotationEl = document.getElementById('lock-rotation');
|
||||
const lockRotationEl = document.getElementById('lock-rotation');
|
||||
lockRotationEl.onclick = () => {
|
||||
var activeObject: any = canvas.getActiveObject();
|
||||
const activeObject: any = canvas.getActiveObject();
|
||||
if (activeObject) {
|
||||
activeObject.lockRotation = !activeObject.lockRotation;
|
||||
lockRotationEl.innerHTML = activeObject.lockRotation
|
||||
@@ -713,9 +700,9 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var gradientifyBtn = document.getElementById('gradientify');
|
||||
const gradientifyBtn = document.getElementById('gradientify');
|
||||
|
||||
var activeObjectButtons = [
|
||||
const activeObjectButtons = [
|
||||
lockHorizontallyEl,
|
||||
lockVerticallyEl,
|
||||
lockScalingXEl,
|
||||
@@ -725,16 +712,16 @@ function sample8() {
|
||||
gradientifyBtn
|
||||
];
|
||||
|
||||
var opacityEl = document.getElementById('opacity');
|
||||
const opacityEl = document.getElementById('opacity');
|
||||
if (opacityEl) {
|
||||
activeObjectButtons.push(opacityEl);
|
||||
}
|
||||
var colorEl = document.getElementById('color');
|
||||
const colorEl = document.getElementById('color');
|
||||
if (colorEl) {
|
||||
activeObjectButtons.push(colorEl);
|
||||
}
|
||||
|
||||
for (var i = activeObjectButtons.length; i--; ) {
|
||||
for (let i = activeObjectButtons.length; i--; ) {
|
||||
activeObjectButtons[i];
|
||||
}
|
||||
|
||||
@@ -742,9 +729,9 @@ function sample8() {
|
||||
canvas.on('group:selected', onObjectSelected);
|
||||
|
||||
function onObjectSelected(e: fabric.IEvent) {
|
||||
var selectedObject = e.target;
|
||||
const selectedObject = e.target;
|
||||
|
||||
for (var i = activeObjectButtons.length; i--; ) {
|
||||
for (let i = activeObjectButtons.length; i--; ) {
|
||||
activeObjectButtons[i];
|
||||
}
|
||||
|
||||
@@ -756,18 +743,18 @@ function sample8() {
|
||||
}
|
||||
|
||||
canvas.on('selection:cleared', e => {
|
||||
for (var i = activeObjectButtons.length; i--; ) {
|
||||
for (let i = activeObjectButtons.length; i--; ) {
|
||||
activeObjectButtons[i];
|
||||
}
|
||||
});
|
||||
|
||||
var drawingModeEl = document.getElementById('drawing-mode'),
|
||||
const drawingModeEl = document.getElementById('drawing-mode'),
|
||||
drawingOptionsEl = document.getElementById('drawing-mode-options'),
|
||||
drawingColorEl = <HTMLInputElement> document.getElementById('drawing-color'),
|
||||
drawingLineWidthEl = <HTMLInputElement> document.getElementById('drawing-line-width');
|
||||
|
||||
drawingModeEl.onclick = () => {
|
||||
var canvasWithDrawingMode: any = canvas;
|
||||
const canvasWithDrawingMode: any = canvas;
|
||||
canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode;
|
||||
if (canvasWithDrawingMode.isDrawingMode) {
|
||||
drawingModeEl.innerHTML = 'Cancel drawing mode';
|
||||
@@ -794,12 +781,11 @@ function sample8() {
|
||||
canvas.freeDrawingColor = drawingColorEl.value;
|
||||
canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1;
|
||||
|
||||
|
||||
var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' +
|
||||
const text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' +
|
||||
'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.';
|
||||
|
||||
document.getElementById('add-text').onclick = () => {
|
||||
var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), {
|
||||
const textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), {
|
||||
left: getRandomInt(350, 400),
|
||||
top: getRandomInt(350, 400),
|
||||
fontFamily: 'helvetica',
|
||||
@@ -813,13 +799,12 @@ function sample8() {
|
||||
updateComplexity();
|
||||
};
|
||||
|
||||
|
||||
document.onkeydown = e => {
|
||||
var obj = canvas.getActiveObject() || canvas.getActiveGroup();
|
||||
const obj = canvas.getActiveObject() || canvas.getActiveGroup();
|
||||
if (obj && e.keyCode === 8) {
|
||||
// this is horrible. need to fix, so that unified interface can be used
|
||||
if (obj.type === 'group') {
|
||||
// var groupObjects = obj.getObjects();
|
||||
// const groupObjects = obj.getObjects();
|
||||
// canvas.discardActiveGroup();
|
||||
// groupObjects.forEach(function(obj) {
|
||||
// canvas.remove(obj);
|
||||
@@ -842,7 +827,7 @@ function sample8() {
|
||||
}
|
||||
|
||||
gradientifyBtn.onclick = () => {
|
||||
var obj = canvas.getActiveObject();
|
||||
const obj = canvas.getActiveObject();
|
||||
if (obj) {
|
||||
obj.setGradient("fill", {
|
||||
x2: (getRandomInt(0, 1) ? 0 : obj.width),
|
||||
@@ -856,17 +841,17 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var textEl = <HTMLInputElement> document.getElementById('text');
|
||||
const textEl = <HTMLInputElement> document.getElementById('text');
|
||||
if (textEl) {
|
||||
textEl.onfocus = function() {
|
||||
var activeObject = canvas.getActiveObject();
|
||||
const activeObject = canvas.getActiveObject();
|
||||
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
this.value = (<fabric.Text> activeObject).text;
|
||||
}
|
||||
};
|
||||
textEl.onkeyup = function(e) {
|
||||
var activeObject = canvas.getActiveObject();
|
||||
const activeObject = canvas.getActiveObject();
|
||||
if (activeObject) {
|
||||
if (!this.value) {
|
||||
canvas.discardActiveObject();
|
||||
@@ -878,11 +863,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var cmdUnderlineBtn = document.getElementById('text-cmd-underline');
|
||||
const cmdUnderlineBtn = document.getElementById('text-cmd-underline');
|
||||
if (cmdUnderlineBtn) {
|
||||
activeObjectButtons.push(cmdUnderlineBtn);
|
||||
cmdUnderlineBtn.onclick = function() {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.textDecoration = (activeObject.textDecoration === 'underline' ? '' : 'underline');
|
||||
this.className = activeObject.textDecoration ? 'selected' : '';
|
||||
@@ -891,11 +876,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough');
|
||||
const cmdLinethroughBtn = document.getElementById('text-cmd-linethrough');
|
||||
if (cmdLinethroughBtn) {
|
||||
activeObjectButtons.push(cmdLinethroughBtn);
|
||||
cmdLinethroughBtn.onclick = function() {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.textDecoration = (activeObject.textDecoration === 'line-through' ? '' : 'line-through');
|
||||
this.className = activeObject.textDecoration ? 'selected' : '';
|
||||
@@ -904,11 +889,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var cmdOverlineBtn = document.getElementById('text-cmd-overline');
|
||||
const cmdOverlineBtn = document.getElementById('text-cmd-overline');
|
||||
if (cmdOverlineBtn) {
|
||||
activeObjectButtons.push(cmdOverlineBtn);
|
||||
cmdOverlineBtn.onclick = function() {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.textDecoration = (activeObject.textDecoration === 'overline' ? '' : 'overline');
|
||||
this.className = activeObject.textDecoration ? 'selected' : '';
|
||||
@@ -917,11 +902,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var cmdBoldBtn = document.getElementById('text-cmd-bold');
|
||||
const cmdBoldBtn = document.getElementById('text-cmd-bold');
|
||||
if (cmdBoldBtn) {
|
||||
activeObjectButtons.push(cmdBoldBtn);
|
||||
cmdBoldBtn.onclick = function() {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.fontWeight = (activeObject.fontWeight === 'bold' ? '' : 'bold');
|
||||
this.className = activeObject.fontWeight ? 'selected' : '';
|
||||
@@ -930,11 +915,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var cmdItalicBtn = document.getElementById('text-cmd-italic');
|
||||
const cmdItalicBtn = document.getElementById('text-cmd-italic');
|
||||
if (cmdItalicBtn) {
|
||||
activeObjectButtons.push(cmdItalicBtn);
|
||||
cmdItalicBtn.onclick = function() {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.fontStyle = (activeObject.fontStyle === 'italic' ? '' : 'italic');
|
||||
this.className = activeObject.fontStyle ? 'selected' : '';
|
||||
@@ -943,11 +928,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var cmdShadowBtn = document.getElementById('text-cmd-shadow');
|
||||
const cmdShadowBtn = document.getElementById('text-cmd-shadow');
|
||||
if (cmdShadowBtn) {
|
||||
activeObjectButtons.push(cmdShadowBtn);
|
||||
cmdShadowBtn.onclick = function() {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.shadow = !activeObject.shadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : '';
|
||||
this.className = activeObject.shadow ? 'selected' : '';
|
||||
@@ -956,11 +941,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var textAlignSwitch = document.getElementById('text-align');
|
||||
const textAlignSwitch = document.getElementById('text-align');
|
||||
if (textAlignSwitch) {
|
||||
activeObjectButtons.push(textAlignSwitch);
|
||||
textAlignSwitch.onchange = function(this: HTMLInputElement) {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.textAlign = this.value.toLowerCase();
|
||||
canvas.renderAll();
|
||||
@@ -968,11 +953,11 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var fontFamilySwitch = document.getElementById('font-family');
|
||||
const fontFamilySwitch = document.getElementById('font-family');
|
||||
if (fontFamilySwitch) {
|
||||
activeObjectButtons.push(fontFamilySwitch);
|
||||
fontFamilySwitch.onchange = function(this: HTMLInputElement) {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.fontFamily = this.value;
|
||||
canvas.renderAll();
|
||||
@@ -980,10 +965,10 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var bgColorField = document.getElementById('text-bg-color');
|
||||
const bgColorField = document.getElementById('text-bg-color');
|
||||
if (bgColorField) {
|
||||
bgColorField.onchange = function(this: HTMLInputElement) {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.backgroundColor = this.value;
|
||||
canvas.renderAll();
|
||||
@@ -991,10 +976,10 @@ function sample8() {
|
||||
};
|
||||
}
|
||||
|
||||
var strokeColorField = document.getElementById('text-stroke-color');
|
||||
const strokeColorField = document.getElementById('text-stroke-color');
|
||||
if (strokeColorField) {
|
||||
strokeColorField.onchange = function(this: HTMLInputElement) {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.stroke = this.value;
|
||||
canvas.renderAll();
|
||||
@@ -1004,9 +989,9 @@ function sample8() {
|
||||
|
||||
if (supportsSlider) {
|
||||
(() => {
|
||||
var container = document.getElementById('text-controls');
|
||||
var slider = document.createElement('input');
|
||||
var label = document.createElement('label');
|
||||
const container = document.getElementById('text-controls');
|
||||
const slider = document.createElement('input');
|
||||
const label = document.createElement('label');
|
||||
label.innerHTML = 'Line height: ';
|
||||
try { slider.type = 'range'; } catch (err) { }
|
||||
slider.min = "0";
|
||||
@@ -1017,7 +1002,7 @@ function sample8() {
|
||||
label.appendChild(slider);
|
||||
slider.title = "Line height";
|
||||
slider.onchange = function() {
|
||||
var activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.lineHeight = +this.value;
|
||||
canvas.renderAll();
|
||||
@@ -1031,9 +1016,9 @@ function sample8() {
|
||||
}
|
||||
|
||||
document.getElementById('load-svg').onclick = () => {
|
||||
var svg = (<HTMLInputElement> document.getElementById('svg-console')).value;
|
||||
const svg = (<HTMLInputElement> document.getElementById('svg-console')).value;
|
||||
fabric.loadSVGFromString(svg, (objects, options) => {
|
||||
var obj = fabric.util.groupSVGElements(objects, options);
|
||||
const obj = fabric.util.groupSVGElements(objects, options);
|
||||
canvas.add(obj).centerObject(obj).renderAll();
|
||||
obj.setCoords();
|
||||
});
|
||||
@@ -1041,7 +1026,7 @@ function sample8() {
|
||||
}
|
||||
|
||||
function sample9() {
|
||||
var canvas = new fabric.Canvas('c');
|
||||
const canvas = new fabric.Canvas('c');
|
||||
canvas.setBackgroundImage('yolo.jpg', () => { "a"; }, { opacity: 45 });
|
||||
canvas.setBackgroundImage('yolo.jpg', () => { "a"; });
|
||||
}
|
||||
|
||||
Vendored
+6
-8
@@ -5,8 +5,8 @@
|
||||
|
||||
export as namespace fabric;
|
||||
|
||||
export var isLikelyNode: boolean;
|
||||
export var isTouchSupported: boolean;
|
||||
export const isLikelyNode: boolean;
|
||||
export const isTouchSupported: boolean;
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// farbic Functions
|
||||
@@ -1289,7 +1289,6 @@ export class StaticCanvas {
|
||||
*/
|
||||
fxStraightenObject(object: Object): StaticCanvas
|
||||
|
||||
|
||||
static EMPTY_JSON: string;
|
||||
/**
|
||||
* Provides a way to check support of some of the canvas methods
|
||||
@@ -2997,8 +2996,8 @@ interface IRectOptions extends IObjectOptions {
|
||||
* Vertical border radius
|
||||
*/
|
||||
ry?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface Rect extends IRectOptions {}
|
||||
export class Rect extends Object {
|
||||
/**
|
||||
@@ -3950,8 +3949,8 @@ export class BaseBrush {
|
||||
* @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)")
|
||||
*/
|
||||
setShadow(options: string|any): BaseBrush;
|
||||
|
||||
}
|
||||
|
||||
export class CircleBrush extends BaseBrush {
|
||||
/**
|
||||
* Width of a brush
|
||||
@@ -3969,6 +3968,7 @@ export class CircleBrush extends BaseBrush {
|
||||
*/
|
||||
addPoint(pointer: any): Point
|
||||
}
|
||||
|
||||
export class SprayBrush extends BaseBrush {
|
||||
/**
|
||||
* Width of a brush
|
||||
@@ -4147,7 +4147,6 @@ interface IUtilArc {
|
||||
* @param {Number} y3
|
||||
*/
|
||||
getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): Point[];
|
||||
|
||||
}
|
||||
|
||||
interface IUtilDomEvent {
|
||||
@@ -4298,7 +4297,6 @@ interface IUtilClass {
|
||||
* (be careful modifying objects defined here as this would affect all instances)
|
||||
*/
|
||||
createClass(properties?: any): void;
|
||||
|
||||
}
|
||||
|
||||
interface IUtilObject {
|
||||
@@ -4517,7 +4515,7 @@ interface IUtilMisc {
|
||||
isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean;
|
||||
}
|
||||
|
||||
export var util: IUtil;
|
||||
export const util: IUtil;
|
||||
interface IUtil extends IUtilAnimation, IUtilArc, IObservable<IUtil>, IUtilDomEvent, IUtilDomMisc,
|
||||
IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc {
|
||||
ease: IUtilAnimEase;
|
||||
|
||||
+15
-16
@@ -1,60 +1,59 @@
|
||||
import Fetch from 'fetch.io';
|
||||
|
||||
import Fetch from 'fetch.io'
|
||||
|
||||
const request = new Fetch()
|
||||
const request = new Fetch();
|
||||
|
||||
request
|
||||
.get('')
|
||||
.query({})
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.delete('')
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.head('')
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.options('')
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.put('')
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.config('key', 'value')
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.config({key: 'value'})
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.config('set', 'value')
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.set({key: 'value'})
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.type('json')
|
||||
.json()
|
||||
.json();
|
||||
|
||||
request
|
||||
.get('')
|
||||
.query({})
|
||||
.text()
|
||||
.text();
|
||||
|
||||
request
|
||||
.get('')
|
||||
.query({})
|
||||
.then(() => {})
|
||||
.then(() => {});
|
||||
|
||||
request
|
||||
.post('')
|
||||
.send({})
|
||||
.json()
|
||||
.json();
|
||||
|
||||
@@ -33,7 +33,6 @@ $('#calendar').fullCalendar({
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventSources: [
|
||||
|
||||
// source with no options
|
||||
"http://www.google.com/your_feed_url1/",
|
||||
|
||||
@@ -84,15 +83,14 @@ $('#calendar').fullCalendar({
|
||||
dragOpacity: .5
|
||||
});
|
||||
|
||||
var view = $('#calendar').fullCalendar('getView');
|
||||
const view = $('#calendar').fullCalendar('getView');
|
||||
alert("The view's title is " + view.title);
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -148,15 +146,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -213,15 +209,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -267,15 +261,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
editable: true,
|
||||
@@ -332,15 +324,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -386,7 +376,6 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#my-prev-button').click(() => {
|
||||
@@ -404,7 +393,7 @@ $('#my-today-button').click(() => {
|
||||
$('#calendar').fullCalendar('gotoDate', 1, 0, 1);
|
||||
|
||||
$('#my-button').click(() => {
|
||||
var d = $('#calendar').fullCalendar('getDate');
|
||||
const d = $('#calendar').fullCalendar('getDate');
|
||||
alert("The current date of the calendar is " + d);
|
||||
});
|
||||
|
||||
@@ -429,7 +418,6 @@ $('#calendar').fullCalendar({
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
dayClick(date, allDay, jsEvent, view) {
|
||||
|
||||
if (allDay) {
|
||||
alert('Clicked on the entire day: ' + date);
|
||||
} else {
|
||||
@@ -442,20 +430,17 @@ $('#calendar').fullCalendar({
|
||||
|
||||
// change the day's background color just for fun
|
||||
$(this).css('background-color', 'red');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventClick(calEvent, jsEvent, view) {
|
||||
|
||||
alert('Event: ' + calEvent.title);
|
||||
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
|
||||
alert('View: ' + view.name);
|
||||
|
||||
// change the border color just for fun
|
||||
$(this).css('border-color', 'red');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -477,9 +462,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
url: '/myfeed.php',
|
||||
@@ -496,13 +479,10 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
|
||||
// any other sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
events: {
|
||||
url: '/myfeed.php',
|
||||
type: 'POST',
|
||||
@@ -516,22 +496,17 @@ $('#calendar').fullCalendar({
|
||||
color: 'yellow', // a non-ajax option
|
||||
textColor: 'black' // a non-ajax option
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
events: {
|
||||
url: '/myfeed.php',
|
||||
cache: true
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
url: '/myfeed.php', // use the `url` property
|
||||
@@ -540,9 +515,7 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
|
||||
// any other sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
@@ -569,9 +542,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
events: [ // put the array in the `events` property
|
||||
@@ -594,9 +565,7 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
|
||||
// any other event sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
@@ -610,7 +579,7 @@ $('#calendar').fullCalendar({
|
||||
end: Math.round(end.toDate().getTime() / 1000)
|
||||
},
|
||||
success(doc) {
|
||||
var events: any[] = [];
|
||||
const events: any[] = [];
|
||||
$(doc).find('event').each(() => {
|
||||
events.push({
|
||||
title: $(this).attr('title'),
|
||||
@@ -624,9 +593,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
events(start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: (events: FullCalendar.EventObject[]) => void) {
|
||||
@@ -635,11 +602,8 @@ $('#calendar').fullCalendar({
|
||||
color: 'yellow', // an option!
|
||||
textColor: 'black' // an option!
|
||||
}
|
||||
|
||||
// any other sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
@@ -651,11 +615,9 @@ $('#calendar').fullCalendar({
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventClick(event, element) {
|
||||
|
||||
event.title = "CLICKED!";
|
||||
|
||||
$('#calendar').fullCalendar('updateEvent', event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -712,11 +674,10 @@ $('#draggable1').draggable();
|
||||
$('#draggable2').draggable();
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
theme: true,
|
||||
@@ -773,17 +734,15 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
/* initialize the external events
|
||||
-----------------------------------------------------------------*/
|
||||
$('#external-events div.external-event').each(() => {
|
||||
|
||||
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
|
||||
// it doesn't need to have a start or end
|
||||
var eventObject = {
|
||||
const eventObject = {
|
||||
title: $.trim($(this).text()) // use the element's text as the event title
|
||||
};
|
||||
|
||||
@@ -796,7 +755,6 @@ $(document).ready(() => {
|
||||
revert: true, // will cause the event to go back to its
|
||||
revertDuration: 0 // original position after the drag
|
||||
});
|
||||
|
||||
});
|
||||
/* initialize the calendar
|
||||
-----------------------------------------------------------------*/
|
||||
@@ -812,10 +770,10 @@ $(document).ready(() => {
|
||||
drop(date, allDay) { // this function is called when something is dropped
|
||||
|
||||
// retrieve the dropped element's stored Event Object
|
||||
var originalEventObject = $(this).data('eventObject');
|
||||
const originalEventObject = $(this).data('eventObject');
|
||||
|
||||
// we need to copy it, so that multiple events don't have a reference to the same object
|
||||
var copiedEventObject: any = $.extend({}, originalEventObject);
|
||||
const copiedEventObject: any = $.extend({}, originalEventObject);
|
||||
|
||||
// assign it the date that was reported
|
||||
copiedEventObject.start = date;
|
||||
@@ -835,10 +793,10 @@ $(document).ready(() => {
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
theme: true,
|
||||
|
||||
@@ -30,7 +30,6 @@ $('#calendar').fullCalendar({
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventSources: [
|
||||
|
||||
// source with no options
|
||||
"http://www.google.com/your_feed_url1/",
|
||||
|
||||
@@ -81,15 +80,14 @@ $('#calendar').fullCalendar({
|
||||
dragOpacity: .5
|
||||
});
|
||||
|
||||
var view = $('#calendar').fullCalendar('getView');
|
||||
const view = $('#calendar').fullCalendar('getView');
|
||||
alert("The view's title is " + view.title);
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -145,15 +143,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -210,15 +206,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -264,15 +258,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
editable: true,
|
||||
@@ -329,15 +321,13 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
@@ -383,7 +373,6 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#my-prev-button').click(() => {
|
||||
@@ -401,7 +390,7 @@ $('#my-today-button').click(() => {
|
||||
$('#calendar').fullCalendar('gotoDate', 1, 0, 1);
|
||||
|
||||
$('#my-button').click(() => {
|
||||
var d = $('#calendar').fullCalendar('getDate');
|
||||
const d = $('#calendar').fullCalendar('getDate');
|
||||
alert("The current date of the calendar is " + d);
|
||||
});
|
||||
|
||||
@@ -426,7 +415,6 @@ $('#calendar').fullCalendar({
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
dayClick(date, allDay, jsEvent, view) {
|
||||
|
||||
if (allDay) {
|
||||
alert('Clicked on the entire day: ' + date);
|
||||
} else {
|
||||
@@ -439,20 +427,17 @@ $('#calendar').fullCalendar({
|
||||
|
||||
// change the day's background color just for fun
|
||||
$(this).css('background-color', 'red');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventClick(calEvent, jsEvent, view) {
|
||||
|
||||
alert('Event: ' + calEvent.title);
|
||||
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
|
||||
alert('View: ' + view.name);
|
||||
|
||||
// change the border color just for fun
|
||||
$(this).css('border-color', 'red');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -474,9 +459,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
url: '/myfeed.php',
|
||||
@@ -493,13 +476,10 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
|
||||
// any other sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
events: {
|
||||
url: '/myfeed.php',
|
||||
type: 'POST',
|
||||
@@ -513,22 +493,17 @@ $('#calendar').fullCalendar({
|
||||
color: 'yellow', // a non-ajax option
|
||||
textColor: 'black' // a non-ajax option
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
events: {
|
||||
url: '/myfeed.php',
|
||||
cache: true
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
url: '/myfeed.php', // use the `url` property
|
||||
@@ -537,9 +512,7 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
|
||||
// any other sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
@@ -566,9 +539,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
events: [ // put the array in the `events` property
|
||||
@@ -591,9 +562,7 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
|
||||
// any other event sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
@@ -607,7 +576,7 @@ $('#calendar').fullCalendar({
|
||||
end: Math.round(end.getTime() / 1000)
|
||||
},
|
||||
success(doc) {
|
||||
var events: any[] = [];
|
||||
const events: any[] = [];
|
||||
$(doc).find('event').each(() => {
|
||||
events.push({
|
||||
title: $(this).attr('title'),
|
||||
@@ -621,9 +590,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
eventSources: [
|
||||
|
||||
// your event source
|
||||
{
|
||||
events(start: any, end: any, callback: any) {
|
||||
@@ -634,9 +601,7 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
|
||||
// any other sources...
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
@@ -648,11 +613,9 @@ $('#calendar').fullCalendar({
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventClick(event, element) {
|
||||
|
||||
event.title = "CLICKED!";
|
||||
|
||||
$('#calendar').fullCalendar('updateEvent', event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -709,11 +672,10 @@ $('#draggable1').draggable();
|
||||
$('#draggable2').draggable();
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
const date = new Date();
|
||||
const d = date.getDate();
|
||||
const m = date.getMonth();
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
theme: true,
|
||||
@@ -770,17 +732,15 @@ $(document).ready(() => {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(() => {
|
||||
/* initialize the external events
|
||||
-----------------------------------------------------------------*/
|
||||
$('#external-events div.external-event').each(() => {
|
||||
|
||||
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
|
||||
// it doesn't need to have a start or end
|
||||
var eventObject = {
|
||||
const eventObject = {
|
||||
title: $.trim($(this).text()) // use the element's text as the event title
|
||||
};
|
||||
|
||||
@@ -793,7 +753,6 @@ $(document).ready(() => {
|
||||
revert: true, // will cause the event to go back to its
|
||||
revertDuration: 0 // original position after the drag
|
||||
});
|
||||
|
||||
});
|
||||
/* initialize the calendar
|
||||
-----------------------------------------------------------------*/
|
||||
@@ -809,10 +768,10 @@ $(document).ready(() => {
|
||||
drop(date, allDay) { // this function is called when something is dropped
|
||||
|
||||
// retrieve the dropped element's stored Event Object
|
||||
var originalEventObject = $(this).data('eventObject');
|
||||
const originalEventObject = $(this).data('eventObject');
|
||||
|
||||
// we need to copy it, so that multiple events don't have a reference to the same object
|
||||
var copiedEventObject: any = $.extend({}, originalEventObject);
|
||||
const copiedEventObject: any = $.extend({}, originalEventObject);
|
||||
|
||||
// assign it the date that was reported
|
||||
copiedEventObject.start = date;
|
||||
|
||||
Vendored
+14
-21
@@ -8,8 +8,7 @@ import * as moment from "moment";
|
||||
|
||||
declare global {
|
||||
namespace FullCalendar {
|
||||
export interface Calendar {
|
||||
|
||||
interface Calendar {
|
||||
/**
|
||||
* Formats a Date object into a string.
|
||||
*/
|
||||
@@ -36,22 +35,21 @@ declare global {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface BusinessHours {
|
||||
interface BusinessHours {
|
||||
start: moment.Duration;
|
||||
end: moment.Duration;
|
||||
dow: number[];
|
||||
}
|
||||
|
||||
export interface Timespan {
|
||||
interface Timespan {
|
||||
start: moment.Moment;
|
||||
end: moment.Moment;
|
||||
}
|
||||
|
||||
export interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions {
|
||||
|
||||
interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions {
|
||||
// General display - http://arshaw.com/fullcalendar/docs/display/
|
||||
|
||||
header?: {
|
||||
header?: {
|
||||
left: string;
|
||||
center: string;
|
||||
right: string;
|
||||
@@ -152,11 +150,9 @@ declare global {
|
||||
eventAfterRender?: (event: EventObject, element: HTMLDivElement, view: ViewObject) => void;
|
||||
eventAfterAllRender?: (view: ViewObject) => void;
|
||||
eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void;
|
||||
|
||||
|
||||
}
|
||||
|
||||
export interface ViewOptionHash {
|
||||
interface ViewOptionHash {
|
||||
month?: any;
|
||||
week?: any;
|
||||
day?: any;
|
||||
@@ -172,7 +168,7 @@ declare global {
|
||||
/**
|
||||
* Agenda Options - http://arshaw.com/fullcalendar/docs/agenda/
|
||||
*/
|
||||
export interface AgendaOptions {
|
||||
interface AgendaOptions {
|
||||
allDaySlot?: boolean;
|
||||
allDayText?: string;
|
||||
slotDuration?: moment.Duration;
|
||||
@@ -188,7 +184,7 @@ declare global {
|
||||
/*
|
||||
* Event Dragging & Resizing
|
||||
*/
|
||||
export interface EventDraggingResizingOptions {
|
||||
interface EventDraggingResizingOptions {
|
||||
editable?: boolean;
|
||||
eventStartEditable?: boolean;
|
||||
eventDurationEditable?: boolean;
|
||||
@@ -207,7 +203,7 @@ declare global {
|
||||
/*
|
||||
* Selection - http://arshaw.com/fullcalendar/docs/selection/
|
||||
*/
|
||||
export interface SelectionOptions {
|
||||
interface SelectionOptions {
|
||||
selectable?: boolean;
|
||||
selectHelper?: boolean | ((start: moment.Moment, end: moment.Moment) => HTMLElement);
|
||||
unselectAuto?: boolean;
|
||||
@@ -218,14 +214,14 @@ declare global {
|
||||
unselect?: (view: ViewObject, jsEvent: Event) => void;
|
||||
}
|
||||
|
||||
export interface DroppingExternalElementsOptions {
|
||||
interface DroppingExternalElementsOptions {
|
||||
droppable?: boolean;
|
||||
dropAccept?: string | ((draggable: any) => boolean);
|
||||
drop?: (date: moment.Moment, jsEvent: MouseEvent, ui: any) => void;
|
||||
eventReceive?: (event: EventObject) => void;
|
||||
}
|
||||
|
||||
export interface ButtonTextObject {
|
||||
interface ButtonTextObject {
|
||||
prev?: string;
|
||||
next?: string;
|
||||
prevYear?: string;
|
||||
@@ -236,7 +232,7 @@ declare global {
|
||||
day?: string;
|
||||
}
|
||||
|
||||
export interface EventObject extends Timespan {
|
||||
interface EventObject extends Timespan {
|
||||
id?: any; // String/number
|
||||
title: string;
|
||||
allDay?: boolean;
|
||||
@@ -251,15 +247,14 @@ declare global {
|
||||
rendering?: string;
|
||||
}
|
||||
|
||||
export interface ViewObject extends Timespan {
|
||||
interface ViewObject extends Timespan {
|
||||
name: string;
|
||||
title: string;
|
||||
intervalStart: moment.Moment;
|
||||
intervalEnd: moment.Moment;
|
||||
}
|
||||
|
||||
export interface EventSource extends JQueryAjaxSettings {
|
||||
|
||||
interface EventSource extends JQueryAjaxSettings {
|
||||
/**
|
||||
* This has one of the following types:
|
||||
*
|
||||
@@ -281,11 +276,9 @@ declare global {
|
||||
startParam?: string;
|
||||
endParam?: string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
|
||||
/**
|
||||
* Get/Set option value
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ export = gaussian;
|
||||
export as namespace gaussian;
|
||||
|
||||
declare namespace gaussian {
|
||||
export interface Gaussian {
|
||||
interface Gaussian {
|
||||
/**
|
||||
* the mean (μ) of the distribution
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,6 @@ const zoneMgrs = mgrs.zone;
|
||||
mgrs.toString();
|
||||
mgrs.toUtm();
|
||||
|
||||
|
||||
// Static Functions
|
||||
Mgrs.parse('31U DQ 48251 11932');
|
||||
|
||||
|
||||
Vendored
+8
-8
@@ -43,7 +43,7 @@ export interface Ellipsoids {
|
||||
Bessel1841: Ellipsoid;
|
||||
}
|
||||
|
||||
export declare class Mgrs {
|
||||
export class Mgrs {
|
||||
zone: number;
|
||||
band: string;
|
||||
e100k: string;
|
||||
@@ -68,7 +68,7 @@ export declare class Mgrs {
|
||||
toString(digits?: 2 | 4 | 6 | 8 | 10): string;
|
||||
}
|
||||
|
||||
export declare class Utm {
|
||||
export class Utm {
|
||||
zone: number;
|
||||
hemisphere: hemisphere;
|
||||
easting: number;
|
||||
@@ -91,11 +91,11 @@ export declare class Utm {
|
||||
toString(digits?: number): string;
|
||||
}
|
||||
|
||||
export declare namespace Dms {
|
||||
export let separator: string;
|
||||
export namespace Dms {
|
||||
let separator: string;
|
||||
}
|
||||
|
||||
export declare class Dms {
|
||||
export class Dms {
|
||||
static parseDMS(dmsStr: string): number;
|
||||
static toDMS(deg: number, format?: format, dp?: 0 | 2 | 4): string;
|
||||
static toLat(deg: number, format?: format, dp?: 0 | 2 | 4): string;
|
||||
@@ -104,7 +104,7 @@ export declare class Dms {
|
||||
static compassPoint(bearing: number, precision?: 1 | 2 | 3): string;
|
||||
}
|
||||
|
||||
export declare class Vector3d {
|
||||
export class Vector3d {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
@@ -125,7 +125,7 @@ export declare class Vector3d {
|
||||
applyTransform(t: number[]): Vector3d;
|
||||
}
|
||||
|
||||
export declare class OsGridRef {
|
||||
export class OsGridRef {
|
||||
easting: number;
|
||||
northing: number;
|
||||
constructor(easting: number, northing: number);
|
||||
@@ -135,7 +135,7 @@ export declare class OsGridRef {
|
||||
toString(digits?: number): string;
|
||||
}
|
||||
|
||||
export declare class LatLonEllipsoidal {
|
||||
export class LatLonEllipsoidal {
|
||||
lat: number;
|
||||
lon: number;
|
||||
datum: Datum;
|
||||
|
||||
Vendored
+8
-25
@@ -4,25 +4,25 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace geolib {
|
||||
export interface PositionAsDecimal {
|
||||
interface PositionAsDecimal {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}
|
||||
|
||||
export interface PositionAsSexadecimal {
|
||||
interface PositionAsSexadecimal {
|
||||
latitude: string;
|
||||
longitude: string;
|
||||
}
|
||||
|
||||
export interface PositionWithElevation extends PositionAsDecimal {
|
||||
interface PositionWithElevation extends PositionAsDecimal {
|
||||
elevation?: number;
|
||||
}
|
||||
|
||||
export interface PositionInTime extends PositionAsDecimal {
|
||||
interface PositionInTime extends PositionAsDecimal {
|
||||
time: number;
|
||||
}
|
||||
|
||||
export interface Bound {
|
||||
interface Bound {
|
||||
minLat: number;
|
||||
maxLat: number;
|
||||
minLng: number;
|
||||
@@ -31,19 +31,19 @@ declare namespace geolib {
|
||||
maxElev?: number;
|
||||
}
|
||||
|
||||
export interface CompassDirection {
|
||||
interface CompassDirection {
|
||||
rough: string;
|
||||
exact: string;
|
||||
}
|
||||
|
||||
export interface Distance {
|
||||
interface Distance {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
distance: number;
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface SpeedOption {
|
||||
interface SpeedOption {
|
||||
unit: string;
|
||||
}
|
||||
|
||||
@@ -60,13 +60,11 @@ declare namespace geolib {
|
||||
*/
|
||||
function getDistanceSimple(start: PositionAsDecimal|PositionAsSexadecimal, end: PositionAsDecimal|PositionAsSexadecimal, accuracy?: number): number;
|
||||
|
||||
|
||||
/** Calculates the geographical center of all points in a collection of geo coordinates
|
||||
* Takes an object or array of coordinates and calculates the center of it.
|
||||
*/
|
||||
function getCenter(coords: PositionAsDecimal[]): PositionAsDecimal;
|
||||
|
||||
|
||||
/** Calculates the center of the bounds of geo coordinates. Takes an array of coordinates,
|
||||
* calculate the border of those, and gives back the center of that rectangle. On polygons
|
||||
* like political borders (eg. states), this may gives a closer result to human expectation,
|
||||
@@ -76,28 +74,24 @@ declare namespace geolib {
|
||||
*/
|
||||
function getCenterOfBounds(coords: PositionAsDecimal[]): PositionAsDecimal;
|
||||
|
||||
|
||||
/** Calculates the bounds of geo coordinates.
|
||||
*
|
||||
* Returns maximum and minimum, latitude, longitude, and elevation (if provided) in form of an object
|
||||
*/
|
||||
function getBounds(coords: PositionWithElevation[]): Bound;
|
||||
|
||||
|
||||
/** Checks whether a point is inside of a polygon or not. Note: the polygon coords must be in correct order!
|
||||
*
|
||||
* Returns true or false
|
||||
*/
|
||||
function isPointInside(latlng: PositionAsDecimal, polygon: PositionAsDecimal[]): boolean;
|
||||
|
||||
|
||||
/** Similar to is point inside: checks whether a point is inside of a circle or not.
|
||||
*
|
||||
* Returns true or false
|
||||
*/
|
||||
function isPointInCircle(latlng: PositionAsDecimal, center: PositionAsDecimal, radius: number): boolean;
|
||||
|
||||
|
||||
/** Gets rhumb line bearing of two points. Find out about the difference between rhumb line and great circle bearing on Wikipedia.
|
||||
* Rhumb line should be fine in most cases: http://en.wikipedia.org/wiki/Rhumb_line#General_and_mathematical_description Function
|
||||
* is heavily based on Doug Vanderweide's great PHP version (licensed under GPL 3.0)
|
||||
@@ -107,14 +101,12 @@ declare namespace geolib {
|
||||
*/
|
||||
function getRhumbLineBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number;
|
||||
|
||||
|
||||
/** Gets great circle bearing of two points. See description of getRhumbLineBearing for more information.
|
||||
*
|
||||
* Returns calculated bearing as integer
|
||||
*/
|
||||
function getBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number;
|
||||
|
||||
|
||||
/** Gets the compass direction from an origin coordinate (originLL) to a destination coordinate (destLL).
|
||||
* Bearing mode. Can be either circle or rhumbline (default).
|
||||
*
|
||||
@@ -122,15 +114,12 @@ declare namespace geolib {
|
||||
*/
|
||||
function getCompassDirection(originLL: PositionAsDecimal, destLL: PositionAsDecimal, bearingMode?: string): CompassDirection;
|
||||
|
||||
|
||||
/** Sorts an object or array of coords by distance from a reference coordinate */
|
||||
function orderByDistance(latlng: PositionAsDecimal, coords: PositionAsDecimal[]): Distance[];
|
||||
|
||||
|
||||
/** Finds the nearest coordinate to a reference coordinate. */
|
||||
function findNearest(latlng: PositionAsDecimal, coords: PositionAsDecimal[], offset?: number, limit?: number): Distance[];
|
||||
|
||||
|
||||
/** Calculates the length of a collection of coordinates.
|
||||
*
|
||||
* Returns the length of the path in meters */
|
||||
@@ -142,11 +131,9 @@ declare namespace geolib {
|
||||
*/
|
||||
function getSpeed(coords: PositionInTime[], option?: SpeedOption): number;
|
||||
|
||||
|
||||
/** Calculates if given point lies in a line formed by start and end */
|
||||
function isPointInLine(point: PositionAsDecimal, start: PositionAsDecimal, end: PositionAsDecimal): boolean;
|
||||
|
||||
|
||||
/** Converts a given distance (in meters) to another unit.
|
||||
* distance distance to be converted (source must be in meter). unit can be one of:
|
||||
* - m (meter)
|
||||
@@ -161,11 +148,9 @@ declare namespace geolib {
|
||||
*/
|
||||
function convertUnit(unit: string, distance: number, round?: number): number;
|
||||
|
||||
|
||||
/** Converts a sexagesimal coordinate to decimal format */
|
||||
function sexagesimal2decimal(coord: string): number;
|
||||
|
||||
|
||||
/** Converts a decimal coordinate to sexagesimal format */
|
||||
function decimal2sexagesimal(coord: number): string;
|
||||
|
||||
@@ -184,11 +169,9 @@ declare namespace geolib {
|
||||
*/
|
||||
function elevation(latlng: any): number;
|
||||
|
||||
|
||||
/** Checks if a coordinate is already in decimal format and, if not, converts it to */
|
||||
function useDecimal(latlng: string|number): number;
|
||||
|
||||
|
||||
/** Computes the destination point given an initial point, a distance (in meters) and a bearing (in degrees).
|
||||
* If no radius is given it defaults to the mean earth radius of 6371000 meter.
|
||||
*
|
||||
|
||||
+6
-1
@@ -1 +1,6 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"no-useless-files": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
declare function getStdin(): Promise<string>;
|
||||
declare namespace getStdin {
|
||||
export function buffer(): Promise<Buffer>;
|
||||
function buffer(): Promise<Buffer>;
|
||||
}
|
||||
|
||||
export = getStdin;
|
||||
|
||||
@@ -83,7 +83,7 @@ class MySimple extends jspb.Message {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new MySimple;
|
||||
return MySimple.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
}
|
||||
|
||||
static deserializeBinaryFromReader(msg: MySimple, reader: jspb.BinaryReader): MySimple {
|
||||
while (reader.nextField()) {
|
||||
@@ -170,13 +170,13 @@ class MySimple extends jspb.Message {
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
}
|
||||
|
||||
serializeBinary(): Uint8Array {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
MySimple.serializeBinaryToWriter(this, writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
}
|
||||
|
||||
static serializeBinaryToWriter(message: MySimple, writer: jspb.BinaryWriter) {
|
||||
const f1 = message.getMyString();
|
||||
@@ -296,229 +296,229 @@ class MySimple extends jspb.Message {
|
||||
google_protobuf_wrappers_pb.DoubleValue.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getMyString(): string {
|
||||
return jspb.Message.getFieldWithDefault(this, 1, "");
|
||||
};
|
||||
}
|
||||
|
||||
setMyString(value: string) {
|
||||
jspb.Message.setField(this, 1, value);
|
||||
};
|
||||
}
|
||||
|
||||
getMyBool(): boolean {
|
||||
return jspb.Message.getFieldWithDefault(this, 2, false);
|
||||
};
|
||||
}
|
||||
|
||||
setMyBool(value: boolean) {
|
||||
jspb.Message.setField(this, 2, value);
|
||||
};
|
||||
}
|
||||
|
||||
getSomeLabelsList(): Array<string> {
|
||||
return jspb.Message.getField(this, 3);
|
||||
};
|
||||
getSomeLabelsList(): string[] {
|
||||
return jspb.Message.getField(this, 3) as string[];
|
||||
}
|
||||
|
||||
setSomeLabelsList(value: Array<string>) {
|
||||
jspb.Message.setField(this, 3, value || []);
|
||||
};
|
||||
}
|
||||
|
||||
addSomeLabels(value: string, opt_index?: number) {
|
||||
jspb.Message.addToRepeatedField(this, 3, value, opt_index);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeLabelsList() {
|
||||
this.setSomeLabelsList([]);
|
||||
};
|
||||
}
|
||||
|
||||
getSomeCodeGeneratorRequest(): google_protobuf_compiler_plugin_pb.CodeGeneratorRequest {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_compiler_plugin_pb.CodeGeneratorRequest, 4) as google_protobuf_compiler_plugin_pb.CodeGeneratorRequest;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeCodeGeneratorRequest(value?: google_protobuf_compiler_plugin_pb.CodeGeneratorRequest) {
|
||||
jspb.Message.setWrapperField(this, 4, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeCodeGeneratorRequest() {
|
||||
this.setSomeCodeGeneratorRequest(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeCodeGeneratorRequest(): boolean {
|
||||
return jspb.Message.getField(this, 4) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeAny(): google_protobuf_any_pb.Any {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_any_pb.Any, 5) as google_protobuf_any_pb.Any;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeAny(value?: google_protobuf_any_pb.Any) {
|
||||
jspb.Message.setWrapperField(this, 5, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeAny() {
|
||||
this.setSomeAny(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeAny(): boolean {
|
||||
return jspb.Message.getField(this, 5) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeMethod(): google_protobuf_api_pb.Method {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_api_pb.Method, 6) as google_protobuf_api_pb.Method;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeMethod(value?: google_protobuf_api_pb.Method) {
|
||||
jspb.Message.setWrapperField(this, 6, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeMethod() {
|
||||
this.setSomeMethod(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeMethod(): boolean {
|
||||
return jspb.Message.getField(this, 6) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeGeneratedCodeInfo(): google_protobuf_descriptor_pb.GeneratedCodeInfo {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_descriptor_pb.GeneratedCodeInfo, 7) as google_protobuf_descriptor_pb.GeneratedCodeInfo;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeGeneratedCodeInfo(value?: google_protobuf_descriptor_pb.GeneratedCodeInfo) {
|
||||
jspb.Message.setWrapperField(this, 7, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeGeneratedCodeInfo() {
|
||||
this.setSomeGeneratedCodeInfo(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeGeneratedCodeInfo(): boolean {
|
||||
return jspb.Message.getField(this, 7) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeDuration(): google_protobuf_duration_pb.Duration {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 8) as google_protobuf_duration_pb.Duration;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeDuration(value?: google_protobuf_duration_pb.Duration) {
|
||||
jspb.Message.setWrapperField(this, 8, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeDuration() {
|
||||
this.setSomeDuration(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeDuration(): boolean {
|
||||
return jspb.Message.getField(this, 8) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeEmpty(): google_protobuf_empty_pb.Empty {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_empty_pb.Empty, 9) as google_protobuf_empty_pb.Empty;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeEmpty(value?: google_protobuf_empty_pb.Empty) {
|
||||
jspb.Message.setWrapperField(this, 9, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeEmpty() {
|
||||
this.setSomeEmpty(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeEmpty(): boolean {
|
||||
return jspb.Message.getField(this, 9) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeFieldMask(): google_protobuf_field_mask_pb.FieldMask {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_field_mask_pb.FieldMask, 10) as google_protobuf_field_mask_pb.FieldMask;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeFieldMask(value?: google_protobuf_field_mask_pb.FieldMask) {
|
||||
jspb.Message.setWrapperField(this, 10, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeFieldMask() {
|
||||
this.setSomeFieldMask(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeFieldMask(): boolean {
|
||||
return jspb.Message.getField(this, 10) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeSourceContext(): google_protobuf_source_context_pb.SourceContext {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_source_context_pb.SourceContext, 11) as google_protobuf_source_context_pb.SourceContext;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeSourceContext(value?: google_protobuf_source_context_pb.SourceContext) {
|
||||
jspb.Message.setWrapperField(this, 11, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeSourceContext() {
|
||||
this.setSomeSourceContext(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeSourceContext(): boolean {
|
||||
return jspb.Message.getField(this, 11) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeStruct(): google_protobuf_struct_pb.Struct {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 12) as google_protobuf_struct_pb.Struct;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeStruct(value?: google_protobuf_struct_pb.Struct) {
|
||||
jspb.Message.setWrapperField(this, 12, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeStruct() {
|
||||
this.setSomeStruct(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeStruct(): boolean {
|
||||
return jspb.Message.getField(this, 12) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeTimestamp(): google_protobuf_timestamp_pb.Timestamp {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 13) as google_protobuf_timestamp_pb.Timestamp;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeTimestamp(value?: google_protobuf_timestamp_pb.Timestamp) {
|
||||
jspb.Message.setWrapperField(this, 13, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeTimestamp() {
|
||||
this.setSomeTimestamp(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeTimestamp(): boolean {
|
||||
return jspb.Message.getField(this, 13) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeType(): google_protobuf_type_pb.Type {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_type_pb.Type, 14) as google_protobuf_type_pb.Type;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeType(value?: google_protobuf_type_pb.Type) {
|
||||
jspb.Message.setWrapperField(this, 14, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeType() {
|
||||
this.setSomeType(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeType(): boolean {
|
||||
return jspb.Message.getField(this, 14) != null;
|
||||
};
|
||||
}
|
||||
|
||||
getSomeDoubleValue(): google_protobuf_wrappers_pb.DoubleValue {
|
||||
return jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.DoubleValue, 15) as google_protobuf_wrappers_pb.DoubleValue;
|
||||
};
|
||||
}
|
||||
|
||||
setSomeDoubleValue(value?: google_protobuf_wrappers_pb.DoubleValue) {
|
||||
jspb.Message.setWrapperField(this, 15, value);
|
||||
};
|
||||
}
|
||||
|
||||
clearSomeDoubleValue() {
|
||||
this.setSomeDoubleValue(undefined);
|
||||
};
|
||||
}
|
||||
|
||||
hasSomeDoubleValue(): boolean {
|
||||
return jspb.Message.getField(this, 15) != null;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+243
-362
@@ -3,115 +3,118 @@
|
||||
// Definitions by: Marcus Longmuir <https://github.com/marcuslongmuir/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type ByteSource = ArrayBuffer|Uint8Array|number[]|string;
|
||||
type ScalarFieldType = boolean|number|string;
|
||||
type ByteSource = ArrayBuffer | Uint8Array | number[] | string;
|
||||
type ScalarFieldType = boolean | number | string;
|
||||
type RepeatedFieldType = ScalarFieldType[] | Uint8Array[];
|
||||
type AnyFieldType = ScalarFieldType | RepeatedFieldType | Uint8Array;
|
||||
type FieldValue = (string|number|boolean|Uint8Array|any/*This should be Array<FieldValue>, but that isn't allowed*/|undefined)
|
||||
type FieldValue = string | number | boolean | Uint8Array | FieldValueArray | undefined;
|
||||
interface FieldValueArray extends Array<FieldValue> {} // tslint:disable-line no-empty-interface
|
||||
|
||||
export abstract class Message {
|
||||
getJsPbMessageId(): (string | undefined);
|
||||
static initialize(msg: Message,
|
||||
data: Message.MessageArray,
|
||||
messageId: (string | number),
|
||||
suggestedPivot: number,
|
||||
repeatedFields: number[],
|
||||
oneofFields?: number[][] | null): void;
|
||||
static toObjectList<T extends Message>(field: T[],
|
||||
toObjectFn: (includeInstance: boolean,
|
||||
data: T) => {},
|
||||
includeInstance?: boolean): {}[];
|
||||
static toObjectExtension(msg: Message,
|
||||
obj: {},
|
||||
extensions: {[key: number]: ExtensionFieldInfo<Message>},
|
||||
getExtensionFn: (fieldInfo: ExtensionFieldInfo<Message>) => Message,
|
||||
includeInstance?: boolean): void;
|
||||
serializeBinaryExtensions(proto: Message,
|
||||
writer: BinaryWriter,
|
||||
extensions: {[key: number]: ExtensionFieldBinaryInfo<Message>},
|
||||
getExtensionFn: <T>(fieldInfo: ExtensionFieldInfo<T>) => T): void
|
||||
readBinaryExtension(proto: Message,
|
||||
reader: BinaryReader,
|
||||
extensions: {[key: number]: ExtensionFieldBinaryInfo<Message>},
|
||||
setExtensionFn: <T>(fieldInfo: ExtensionFieldInfo<T>,
|
||||
val: T) => void): void
|
||||
static getField(msg: Message,
|
||||
fieldNumber: number): FieldValue|null;
|
||||
static getOptionalFloatingPointField(msg: Message,
|
||||
fieldNumber: number): (number | undefined);
|
||||
static getRepeatedFloatingPointField(msg: Message,
|
||||
fieldNumber: number): number[];
|
||||
static initialize(
|
||||
msg: Message,
|
||||
data: Message.MessageArray,
|
||||
messageId: (string | number),
|
||||
suggestedPivot: number,
|
||||
repeatedFields: number[],
|
||||
oneofFields?: number[][] | null): void;
|
||||
static toObjectList<T extends Message>(
|
||||
field: T[],
|
||||
toObjectFn: (includeInstance: boolean, data: T) => {},
|
||||
includeInstance?: boolean): Array<{}>;
|
||||
static toObjectExtension(
|
||||
msg: Message,
|
||||
obj: {},
|
||||
extensions: {[key: number]: ExtensionFieldInfo<Message>},
|
||||
getExtensionFn: (fieldInfo: ExtensionFieldInfo<Message>) => Message,
|
||||
includeInstance?: boolean): void;
|
||||
serializeBinaryExtensions(
|
||||
proto: Message,
|
||||
writer: BinaryWriter,
|
||||
extensions: { [key: number]: ExtensionFieldBinaryInfo<Message> },
|
||||
getExtensionFn: <T>(fieldInfo: ExtensionFieldInfo<T>) => T): void
|
||||
readBinaryExtension(
|
||||
proto: Message,
|
||||
reader: BinaryReader,
|
||||
extensions: {[key: number]: ExtensionFieldBinaryInfo<Message>},
|
||||
setExtensionFn: <T>(fieldInfo: ExtensionFieldInfo<T>,
|
||||
val: T) => void): void
|
||||
static getField(msg: Message, fieldNumber: number): FieldValue|null;
|
||||
static getOptionalFloatingPointField(msg: Message, fieldNumber: number): number | undefined;
|
||||
static getRepeatedFloatingPointField(msg: Message, fieldNumber: number): number[];
|
||||
static bytesAsB64(bytes: Uint8Array): string;
|
||||
static bytesAsU8(str: string): Uint8Array;
|
||||
static bytesListAsB64(bytesList: Uint8Array[]): string[];
|
||||
static bytesListAsU8(strList: string[]): Uint8Array[];
|
||||
static getFieldWithDefault<T>(msg: Message,
|
||||
fieldNumber: number,
|
||||
defaultValue: T): T;
|
||||
static getMapField(msg: Message,
|
||||
fieldNumber: number,
|
||||
noLazyCreate: boolean,
|
||||
valueCtor: typeof Message): Map<any, any>;
|
||||
static setField(msg: Message,
|
||||
fieldNumber: number,
|
||||
value: FieldValue): void;
|
||||
static addToRepeatedField(msg: Message,
|
||||
fieldNumber: number,
|
||||
value: any,
|
||||
index?: number): void;
|
||||
static setOneofField(msg: Message,
|
||||
fieldNumber: number,
|
||||
oneof: number[],
|
||||
value: FieldValue): void;
|
||||
static computeOneofCase(msg: Message,
|
||||
oneof: number[]): number;
|
||||
static getWrapperField(msg: Message,
|
||||
ctor: typeof Message,
|
||||
fieldNumber: number,
|
||||
required?: number): Message;
|
||||
static getRepeatedWrapperField(msg: Message,
|
||||
ctor: typeof Message,
|
||||
fieldNumber: number): Message[];
|
||||
static setWrapperField(msg: Message,
|
||||
fieldNumber: number,
|
||||
value?: (Message|Map<any, any>)): void;
|
||||
static setOneofWrapperField(msg: Message,
|
||||
fieldNumber: number,
|
||||
oneof: number[],
|
||||
value: any): void;
|
||||
static setRepeatedWrapperField(msg: Message,
|
||||
fieldNumber: number,
|
||||
value: any): void;
|
||||
static addToRepeatedWrapperField(msg: Message,
|
||||
fieldNumber: number,
|
||||
value: any,
|
||||
ctor: typeof Message,
|
||||
index: number): any;
|
||||
static toMap(field: any[],
|
||||
mapKeyGetterFn: (field: any) => string,
|
||||
toObjectFn?: Message.StaticToObject,
|
||||
includeInstance?: boolean): void;
|
||||
static getFieldWithDefault<T>(msg: Message, fieldNumber: number, defaultValue: T): T;
|
||||
static getMapField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
noLazyCreate: boolean,
|
||||
valueCtor: typeof Message): Map<any, any>;
|
||||
static setField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
value: FieldValue): void;
|
||||
static addToRepeatedField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
value: any,
|
||||
index?: number): void;
|
||||
static setOneofField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
oneof: number[],
|
||||
value: FieldValue): void;
|
||||
static computeOneofCase(msg: Message, oneof: number[]): number;
|
||||
static getWrapperField(
|
||||
msg: Message,
|
||||
ctor: typeof Message,
|
||||
fieldNumber: number,
|
||||
required?: number): Message;
|
||||
static getRepeatedWrapperField(
|
||||
msg: Message,
|
||||
ctor: typeof Message,
|
||||
fieldNumber: number): Message[];
|
||||
static setWrapperField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
value?: (Message|Map<any, any>)): void;
|
||||
static setOneofWrapperField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
oneof: number[],
|
||||
value: any): void;
|
||||
static setRepeatedWrapperField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
value: any): void;
|
||||
static addToRepeatedWrapperField(
|
||||
msg: Message,
|
||||
fieldNumber: number,
|
||||
value: any,
|
||||
ctor: typeof Message,
|
||||
index: number): any;
|
||||
static toMap(
|
||||
field: any[],
|
||||
mapKeyGetterFn: (field: any) => string,
|
||||
toObjectFn?: Message.StaticToObject,
|
||||
includeInstance?: boolean): void;
|
||||
toArray(): Message.MessageArray;
|
||||
toString(): string;
|
||||
getExtension<T>(fieldInfo: ExtensionFieldInfo<T>): T;
|
||||
setExtension<T>(fieldInfo: ExtensionFieldInfo<T>,
|
||||
value: T): void;
|
||||
static difference<T extends Message>(m1: T,
|
||||
m2: T): T;
|
||||
static equals(m1: Message,
|
||||
m2: Message): boolean;
|
||||
static compareExtensions(extension1: {},
|
||||
extension2: {}): boolean;
|
||||
static compareFields(field1: any,
|
||||
field2: any): boolean;
|
||||
setExtension<T>(fieldInfo: ExtensionFieldInfo<T>, value: T): void;
|
||||
static difference<T extends Message>(m1: T, m2: T): T;
|
||||
static equals(m1: Message, m2: Message): boolean;
|
||||
static compareExtensions(extension1: {}, extension2: {}): boolean;
|
||||
static compareFields(field1: any, field2: any): boolean;
|
||||
cloneMessage(): Message;
|
||||
clone(): Message;
|
||||
static clone<T extends Message>(msg: T): T;
|
||||
static cloneMessage<T extends Message>(msg: T): T;
|
||||
static copyInto(fromMessage: Message,
|
||||
toMessage: Message): void;
|
||||
static registerMessageType(id: number,
|
||||
constructor: typeof Message): void;
|
||||
static copyInto(fromMessage: Message, toMessage: Message): void;
|
||||
static registerMessageType(id: number, constructor: typeof Message): void;
|
||||
|
||||
abstract serializeBinary(): Uint8Array;
|
||||
abstract toObject(includeInstance?: boolean): {};
|
||||
@@ -122,16 +125,13 @@ export abstract class Message {
|
||||
static deserializeBinaryFromReader(message: Message, reader: BinaryReader): Message;
|
||||
static serializeBinaryToWriter(message: Message, writer: BinaryWriter): void;
|
||||
static toObject(includeInstance: boolean, msg: Message): {};
|
||||
static extensions: {[key: number]: ExtensionFieldInfo<Message>};
|
||||
static extensionsBinary: {[key: number]: ExtensionFieldBinaryInfo<Message>};
|
||||
static extensions: { [key: number]: ExtensionFieldInfo<Message> };
|
||||
static extensionsBinary: { [key: number]: ExtensionFieldBinaryInfo<Message> };
|
||||
}
|
||||
|
||||
export namespace Message {
|
||||
export type MessageArray = any[]; // This type needs to reference itself
|
||||
interface StaticToObject {
|
||||
(includeInstance: boolean,
|
||||
msg: Message): {};
|
||||
}
|
||||
type MessageArray = any[]; // This type needs to reference itself
|
||||
type StaticToObject = (includeInstance: boolean, msg: Message) => {};
|
||||
}
|
||||
|
||||
export class ExtensionFieldInfo<T> {
|
||||
@@ -140,11 +140,12 @@ export class ExtensionFieldInfo<T> {
|
||||
ctor: typeof Message;
|
||||
toObjectFn: Message.StaticToObject;
|
||||
isRepeated: number;
|
||||
constructor(fieldIndex: number,
|
||||
fieldName: {[key: string]: number},
|
||||
ctor: typeof Message,
|
||||
toObjectFn: Message.StaticToObject,
|
||||
isRepeated: number);
|
||||
constructor(
|
||||
fieldIndex: number,
|
||||
fieldName: {[key: string]: number},
|
||||
ctor: typeof Message,
|
||||
toObjectFn: Message.StaticToObject,
|
||||
isRepeated: number);
|
||||
isMessageType(): boolean;
|
||||
}
|
||||
|
||||
@@ -152,41 +153,40 @@ export class ExtensionFieldBinaryInfo<T> {
|
||||
fieldInfo: ExtensionFieldInfo<T>;
|
||||
binaryReaderFn: BinaryRead;
|
||||
binaryWriterFn: BinaryWrite;
|
||||
opt_binaryMessageSerializeFn: (msg: Message,
|
||||
writer: BinaryWriter) => void;
|
||||
opt_binaryMessageDeserializeFn: (msg: Message,
|
||||
reader: BinaryReader) => Message;
|
||||
opt_binaryMessageSerializeFn: (msg: Message, writer: BinaryWriter) => void;
|
||||
opt_binaryMessageDeserializeFn: (msg: Message, reader: BinaryReader) => Message;
|
||||
opt_isPacked: boolean;
|
||||
constructor(fieldInfo: ExtensionFieldInfo<T>,
|
||||
binaryReaderFn: BinaryRead,
|
||||
binaryWriterFn: BinaryWrite,
|
||||
opt_binaryMessageSerializeFn: (msg: Message,
|
||||
writer: BinaryWriter) => void,
|
||||
opt_binaryMessageDeserializeFn: (msg: Message,
|
||||
reader: BinaryReader) => Message,
|
||||
opt_isPacked: boolean);
|
||||
constructor(
|
||||
fieldInfo: ExtensionFieldInfo<T>,
|
||||
binaryReaderFn: BinaryRead,
|
||||
binaryWriterFn: BinaryWrite,
|
||||
opt_binaryMessageSerializeFn: (msg: Message, writer: BinaryWriter) => void,
|
||||
opt_binaryMessageDeserializeFn: (msg: Message, reader: BinaryReader) => Message,
|
||||
opt_isPacked: boolean);
|
||||
}
|
||||
|
||||
export class Map<K, V> {
|
||||
constructor(arr: Array<[K, V]>,
|
||||
valueCtor?: {new(init: any): V});
|
||||
constructor(
|
||||
arr: Array<[K, V]>,
|
||||
valueCtor?: {new(init: any): V});
|
||||
toArray(): Array<[K, V]>;
|
||||
toObject(includeInstance: boolean,
|
||||
valueToObject: (includeInstance: boolean) => any): Array<[K, V]>;
|
||||
static fromObject<K, V>(entries: Array<[K, V]>,
|
||||
valueCtor: any,
|
||||
valueFromObject: any): Map<K, V>;
|
||||
toObject(
|
||||
includeInstance: boolean,
|
||||
valueToObject: (includeInstance: boolean) => any): Array<[K, V]>;
|
||||
static fromObject<K, V>(
|
||||
entries: Array<[K, V]>,
|
||||
valueCtor: any,
|
||||
valueFromObject: any): Map<K, V>;
|
||||
getLength(): number;
|
||||
clear(): void;
|
||||
del(key: K): boolean;
|
||||
getEntryList(): Array<[K, V]>;
|
||||
entries(): Map.Iterator<[K, V]>;
|
||||
keys(): Map.Iterator<K>;
|
||||
forEach(callback: (entry: V,
|
||||
key: K) => void,
|
||||
thisArg?: {}): void;
|
||||
set(key: K,
|
||||
value: V): void;
|
||||
forEach(
|
||||
callback: (entry: V, key: K) => void,
|
||||
thisArg?: {}): void;
|
||||
set(key: K, value: V): void;
|
||||
get(key: K): (V | undefined);
|
||||
has(key: K): boolean;
|
||||
}
|
||||
@@ -196,43 +196,24 @@ export namespace Map {
|
||||
interface Iterator<T> {
|
||||
next(): IteratorResult<T>;
|
||||
}
|
||||
type IteratorResult<T> = {
|
||||
done: boolean,
|
||||
value: T,
|
||||
interface IteratorResult<T> {
|
||||
done: boolean;
|
||||
value: T;
|
||||
}
|
||||
}
|
||||
|
||||
interface BinaryReadReader {
|
||||
(msg: any,
|
||||
binaryReader: BinaryReader): void;
|
||||
}
|
||||
type BinaryReadReader = (msg: any, binaryReader: BinaryReader) => void;
|
||||
|
||||
interface BinaryRead {
|
||||
(msg: any,
|
||||
reader: BinaryReadReader): void;
|
||||
}
|
||||
type BinaryRead = (msg: any, reader: BinaryReadReader) => void;
|
||||
|
||||
interface BinaryWriteCallback {
|
||||
(value: any,
|
||||
binaryWriter: BinaryWriter): void;
|
||||
}
|
||||
type BinaryWriteCallback = (value: any, binaryWriter: BinaryWriter) => void;
|
||||
|
||||
interface BinaryWrite {
|
||||
(fieldNumber: number,
|
||||
value: any,
|
||||
writerCallback: BinaryWriteCallback): void;
|
||||
}
|
||||
type BinaryWrite = (fieldNumber: number, value: any, writerCallback: BinaryWriteCallback) => void;
|
||||
|
||||
export class BinaryReader {
|
||||
constructor(bytes?: ByteSource,
|
||||
start?: number,
|
||||
length?: number);
|
||||
static alloc(bytes?: ByteSource,
|
||||
start?: number,
|
||||
length?: number): BinaryReader;
|
||||
alloc(bytes?: ByteSource,
|
||||
start?: number,
|
||||
length?: number): BinaryReader;
|
||||
constructor(bytes?: ByteSource, start?: number, length?: number);
|
||||
static alloc(bytes?: ByteSource, start?: number, length?: number): BinaryReader;
|
||||
alloc(bytes?: ByteSource, start?: number, length?: number): BinaryReader;
|
||||
free(): void;
|
||||
getFieldCursor(): number;
|
||||
getCursor(): number;
|
||||
@@ -241,9 +222,7 @@ export class BinaryReader {
|
||||
getWireType(): BinaryConstants.WireType;
|
||||
isEndGroup(): boolean;
|
||||
getError(): boolean;
|
||||
setBlock(bytes?: ByteSource,
|
||||
start?: number,
|
||||
length?: number): void;
|
||||
setBlock(bytes?: ByteSource, start?: number, length?: number): void;
|
||||
reset(): void;
|
||||
advance(count: number): void;
|
||||
nextField(): boolean;
|
||||
@@ -255,14 +234,11 @@ export class BinaryReader {
|
||||
skipFixed64Field(): void;
|
||||
skipGroup(): void;
|
||||
skipField(): void;
|
||||
registerReadCallback(callbackName: string,
|
||||
callback: (binaryReader: BinaryReader) => any): void;
|
||||
registerReadCallback(callbackName: string, callback: (binaryReader: BinaryReader) => any): void;
|
||||
runReadCallback(callbackName: string): any;
|
||||
readAny(fieldType: BinaryConstants.FieldType): AnyFieldType;
|
||||
readMessage: BinaryRead;
|
||||
readGroup(field: number,
|
||||
message: Message,
|
||||
reader: BinaryReadReader): void;
|
||||
readGroup(field: number, message: Message, reader: BinaryReadReader): void;
|
||||
getFieldDecoder(): BinaryDecoder;
|
||||
readInt32(): number;
|
||||
readInt32String(): string;
|
||||
@@ -317,186 +293,99 @@ export class BinaryReader {
|
||||
|
||||
export class BinaryWriter {
|
||||
constructor();
|
||||
writeSerializedMessage(bytes: Uint8Array,
|
||||
start: number,
|
||||
end: number): void;
|
||||
maybeWriteSerializedMessage(bytes?: Uint8Array,
|
||||
start?: number,
|
||||
end?: number): void;
|
||||
writeSerializedMessage(bytes: Uint8Array, start: number, end: number): void;
|
||||
maybeWriteSerializedMessage(bytes?: Uint8Array, start?: number, end?: number): void;
|
||||
reset(): void;
|
||||
getResultBuffer(): Uint8Array;
|
||||
getResultBase64String(): string;
|
||||
beginSubMessage(field: number): void;
|
||||
endSubMessage(field: number): void;
|
||||
writeAny(fieldType: BinaryConstants.FieldType,
|
||||
field: number,
|
||||
value: AnyFieldType): void;
|
||||
writeInt32(field: number,
|
||||
value?: number): void;
|
||||
writeInt32String(field: number,
|
||||
value?: string): void;
|
||||
writeInt64(field: number,
|
||||
value?: number): void;
|
||||
writeInt64String(field: number,
|
||||
value?: string): void;
|
||||
writeUint32(field: number,
|
||||
value?: number): void;
|
||||
writeUint32String(field: number,
|
||||
value?: string): void;
|
||||
writeUint64(field: number,
|
||||
value?: number): void;
|
||||
writeUint64String(field: number,
|
||||
value?: string): void;
|
||||
writeSint32(field: number,
|
||||
value?: number): void;
|
||||
writeSint64(field: number,
|
||||
value?: number): void;
|
||||
writeSint64String(field: number,
|
||||
value?: string): void;
|
||||
writeFixed32(field: number,
|
||||
value?: number): void;
|
||||
writeFixed64(field: number,
|
||||
value?: number): void;
|
||||
writeFixed64String(field: number,
|
||||
value?: string): void;
|
||||
writeSfixed32(field: number,
|
||||
value?: number): void;
|
||||
writeSfixed64(field: number,
|
||||
value?: number): void;
|
||||
writeSfixed64String(field: number,
|
||||
value?: string): void;
|
||||
writeFloat(field: number,
|
||||
value?: number): void;
|
||||
writeDouble(field: number,
|
||||
value?: number): void;
|
||||
writeBool(field: number,
|
||||
value?: boolean): void;
|
||||
writeEnum(field: number,
|
||||
value?: number): void;
|
||||
writeString(field: number,
|
||||
value?: string): void;
|
||||
writeBytes(field: number,
|
||||
value?: ByteSource): void;
|
||||
writeAny(fieldType: BinaryConstants.FieldType, field: number, value: AnyFieldType): void;
|
||||
writeInt32(field: number, value?: number): void;
|
||||
writeInt32String(field: number, value?: string): void;
|
||||
writeInt64(field: number, value?: number): void;
|
||||
writeInt64String(field: number, value?: string): void;
|
||||
writeUint32(field: number, value?: number): void;
|
||||
writeUint32String(field: number, value?: string): void;
|
||||
writeUint64(field: number, value?: number): void;
|
||||
writeUint64String(field: number, value?: string): void;
|
||||
writeSint32(field: number, value?: number): void;
|
||||
writeSint64(field: number, value?: number): void;
|
||||
writeSint64String(field: number, value?: string): void;
|
||||
writeFixed32(field: number, value?: number): void;
|
||||
writeFixed64(field: number, value?: number): void;
|
||||
writeFixed64String(field: number, value?: string): void;
|
||||
writeSfixed32(field: number, value?: number): void;
|
||||
writeSfixed64(field: number, value?: number): void;
|
||||
writeSfixed64String(field: number, value?: string): void;
|
||||
writeFloat(field: number, value?: number): void;
|
||||
writeDouble(field: number, value?: number): void;
|
||||
writeBool(field: number, value?: boolean): void;
|
||||
writeEnum(field: number, value?: number): void;
|
||||
writeString(field: number, value?: string): void;
|
||||
writeBytes(field: number, value?: ByteSource): void;
|
||||
writeMessage: BinaryWrite;
|
||||
writeGroup(field: number,
|
||||
value: any,
|
||||
writeCallback: BinaryWriteCallback): void;
|
||||
writeFixedHash64(field: number,
|
||||
value?: string): void;
|
||||
writeVarintHash64(field: number,
|
||||
value?: string): void;
|
||||
writeRepeatedInt32(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedInt32String(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedInt64(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedInt64String(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedUint32(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedUint32String(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedUint64(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedUint64String(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedSint32(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedSint64(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedSint64String(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedFixed32(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedFixed64(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedFixed64String(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedSfixed32(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedSfixed64(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedSfixed64String(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedFloat(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedDouble(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedBool(field: number,
|
||||
value?: boolean[]): void;
|
||||
writeRepeatedEnum(field: number,
|
||||
value?: number[]): void;
|
||||
writeRepeatedString(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedBytes(field: number,
|
||||
value?: ByteSource[]): void;
|
||||
writeRepeatedMessage(field: number,
|
||||
value: Message[],
|
||||
writerCallback: BinaryWriteCallback): void;
|
||||
writeRepeatedGroup(field: number,
|
||||
value: Message[],
|
||||
writerCallback: BinaryWriteCallback): void;
|
||||
writeRepeatedFixedHash64(field: number,
|
||||
value?: string[]): void;
|
||||
writeRepeatedVarintHash64(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedInt32(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedInt32String(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedInt64(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedInt64String(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedUint32(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedUint32String(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedUint64(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedUint64String(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedSint32(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedSint64(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedSint64String(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedFixed32(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedFixed64(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedFixed64String(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedSfixed32(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedSfixed64(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedSfixed64String(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedFloat(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedDouble(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedBool(field: number,
|
||||
value?: boolean[]): void;
|
||||
writePackedEnum(field: number,
|
||||
value?: number[]): void;
|
||||
writePackedFixedHash64(field: number,
|
||||
value?: string[]): void;
|
||||
writePackedVarintHash64(field: number,
|
||||
value?: string[]): void;
|
||||
writeGroup(field: number, value: any, writeCallback: BinaryWriteCallback): void;
|
||||
writeFixedHash64(field: number, value?: string): void;
|
||||
writeVarintHash64(field: number, value?: string): void;
|
||||
writeRepeatedInt32(field: number, value?: number[]): void;
|
||||
writeRepeatedInt32String(field: number, value?: string[]): void;
|
||||
writeRepeatedInt64(field: number, value?: number[]): void;
|
||||
writeRepeatedInt64String(field: number, value?: string[]): void;
|
||||
writeRepeatedUint32(field: number, value?: number[]): void;
|
||||
writeRepeatedUint32String(field: number, value?: string[]): void;
|
||||
writeRepeatedUint64(field: number, value?: number[]): void;
|
||||
writeRepeatedUint64String(field: number, value?: string[]): void;
|
||||
writeRepeatedSint32(field: number, value?: number[]): void;
|
||||
writeRepeatedSint64(field: number, value?: number[]): void;
|
||||
writeRepeatedSint64String(field: number, value?: string[]): void;
|
||||
writeRepeatedFixed32(field: number, value?: number[]): void;
|
||||
writeRepeatedFixed64(field: number, value?: number[]): void;
|
||||
writeRepeatedFixed64String(field: number, value?: string[]): void;
|
||||
writeRepeatedSfixed32(field: number, value?: number[]): void;
|
||||
writeRepeatedSfixed64(field: number, value?: number[]): void;
|
||||
writeRepeatedSfixed64String(field: number, value?: string[]): void;
|
||||
writeRepeatedFloat(field: number, value?: number[]): void;
|
||||
writeRepeatedDouble(field: number, value?: number[]): void;
|
||||
writeRepeatedBool(field: number, value?: boolean[]): void;
|
||||
writeRepeatedEnum(field: number, value?: number[]): void;
|
||||
writeRepeatedString(field: number, value?: string[]): void;
|
||||
writeRepeatedBytes(field: number, value?: ByteSource[]): void;
|
||||
writeRepeatedMessage(field: number, value: Message[], writerCallback: BinaryWriteCallback): void;
|
||||
writeRepeatedGroup(field: number, value: Message[], writerCallback: BinaryWriteCallback): void;
|
||||
writeRepeatedFixedHash64(field: number, value?: string[]): void;
|
||||
writeRepeatedVarintHash64(field: number, value?: string[]): void;
|
||||
writePackedInt32(field: number, value?: number[]): void;
|
||||
writePackedInt32String(field: number, value?: string[]): void;
|
||||
writePackedInt64(field: number, value?: number[]): void;
|
||||
writePackedInt64String(field: number, value?: string[]): void;
|
||||
writePackedUint32(field: number, value?: number[]): void;
|
||||
writePackedUint32String(field: number, value?: string[]): void;
|
||||
writePackedUint64(field: number, value?: number[]): void;
|
||||
writePackedUint64String(field: number, value?: string[]): void;
|
||||
writePackedSint32(field: number, value?: number[]): void;
|
||||
writePackedSint64(field: number, value?: number[]): void;
|
||||
writePackedSint64String(field: number, value?: string[]): void;
|
||||
writePackedFixed32(field: number, value?: number[]): void;
|
||||
writePackedFixed64(field: number, value?: number[]): void;
|
||||
writePackedFixed64String(field: number, value?: string[]): void;
|
||||
writePackedSfixed32(field: number, value?: number[]): void;
|
||||
writePackedSfixed64(field: number, value?: number[]): void;
|
||||
writePackedSfixed64String(field: number, value?: string[]): void;
|
||||
writePackedFloat(field: number, value?: number[]): void;
|
||||
writePackedDouble(field: number, value?: number[]): void;
|
||||
writePackedBool(field: number, value?: boolean[]): void;
|
||||
writePackedEnum(field: number, value?: number[]): void;
|
||||
writePackedFixedHash64(field: number, value?: string[]): void;
|
||||
writePackedVarintHash64(field: number, value?: string[]): void;
|
||||
}
|
||||
|
||||
export class BinaryEncoder {
|
||||
constructor();
|
||||
length(): number;
|
||||
end(): number[];
|
||||
writeSplitVarint64(lowBits: number,
|
||||
highBits: number): void;
|
||||
writeSplitFixed64(lowBits: number,
|
||||
highBits: number): void;
|
||||
writeSplitVarint64(lowBits: number, highBits: number): void;
|
||||
writeSplitFixed64(lowBits: number, highBits: number): void;
|
||||
writeUnsignedVarint32(value: number): void;
|
||||
writeSignedVarint32(value: number): void;
|
||||
writeUnsignedVarint64(value: number): void;
|
||||
@@ -524,19 +413,13 @@ export class BinaryEncoder {
|
||||
}
|
||||
|
||||
export class BinaryDecoder {
|
||||
constructor(bytes?: ByteSource,
|
||||
start?: number,
|
||||
length?: number)
|
||||
static alloc(bytes?: ByteSource,
|
||||
start?: number,
|
||||
length?: number): BinaryDecoder;
|
||||
constructor(bytes?: ByteSource, start?: number, length?: number)
|
||||
static alloc(bytes?: ByteSource, start?: number, length?: number): BinaryDecoder;
|
||||
free(): void;
|
||||
clone(): BinaryDecoder;
|
||||
clear(): void;
|
||||
getBuffer(): Uint8Array;
|
||||
setBlock(data: ByteSource,
|
||||
start?: number,
|
||||
length?: number): void;
|
||||
setBlock(data: ByteSource, start?: number, length?: number): void;
|
||||
getEnd(): number;
|
||||
setEnd(end: number): void;
|
||||
reset(): void;
|
||||
@@ -581,21 +464,22 @@ export class BinaryDecoder {
|
||||
}
|
||||
|
||||
export class BinaryIterator {
|
||||
constructor(decoder?: BinaryDecoder,
|
||||
next?: () => number|boolean|string|null,
|
||||
elements?: Array<number|boolean|string>)
|
||||
static alloc(decoder?: BinaryDecoder,
|
||||
next?: () => number|boolean|string|null,
|
||||
elements?: Array<number|boolean|string>): BinaryIterator;
|
||||
constructor(
|
||||
decoder?: BinaryDecoder, next?: () => number | boolean | string | null,
|
||||
elements?: Array<number | boolean | string>)
|
||||
static alloc(
|
||||
decoder?: BinaryDecoder,
|
||||
next?: () => number | boolean | string | null,
|
||||
elements?: Array<number | boolean | string>): BinaryIterator;
|
||||
free(): void;
|
||||
clear(): void;
|
||||
get(): (ScalarFieldType | null);
|
||||
get(): ScalarFieldType | null;
|
||||
atEnd(): boolean;
|
||||
next(): (ScalarFieldType | null);
|
||||
next(): ScalarFieldType | null;
|
||||
}
|
||||
|
||||
export namespace BinaryConstants {
|
||||
export enum FieldType {
|
||||
enum FieldType {
|
||||
INVALID = -1,
|
||||
DOUBLE = 1,
|
||||
FLOAT = 2,
|
||||
@@ -619,7 +503,7 @@ export namespace BinaryConstants {
|
||||
VHASH64 = 31,
|
||||
}
|
||||
|
||||
export enum WireType {
|
||||
enum WireType {
|
||||
INVALID = -1,
|
||||
VARINT = 0,
|
||||
FIXED64 = 1,
|
||||
@@ -649,11 +533,10 @@ export namespace BinaryConstants {
|
||||
}
|
||||
|
||||
export namespace arith {
|
||||
export class UInt64 {
|
||||
class UInt64 {
|
||||
lo: number;
|
||||
hi: number;
|
||||
constructor(lo: number,
|
||||
hi: number);
|
||||
constructor(lo: number, hi: number);
|
||||
cmp(other: UInt64): number;
|
||||
rightShift(): UInt64;
|
||||
leftShift(): UInt64;
|
||||
@@ -662,8 +545,7 @@ export namespace arith {
|
||||
zero(): boolean;
|
||||
add(other: UInt64): UInt64;
|
||||
sub(other: UInt64): UInt64;
|
||||
static mul32x32(a: number,
|
||||
b: number): UInt64;
|
||||
static mul32x32(a: number, b: number): UInt64;
|
||||
mul(a: number): UInt64;
|
||||
div(divisor: number): [UInt64, UInt64];
|
||||
toString(): string;
|
||||
@@ -671,11 +553,10 @@ export namespace arith {
|
||||
clone(): UInt64;
|
||||
}
|
||||
|
||||
export class Int64 {
|
||||
class Int64 {
|
||||
lo: number;
|
||||
hi: number;
|
||||
constructor(lo: number,
|
||||
hi: number);
|
||||
constructor(lo: number, hi: number);
|
||||
add(other: Int64): Int64;
|
||||
sub(other: Int64): Int64;
|
||||
clone(): Int64;
|
||||
@@ -684,4 +565,4 @@ export namespace arith {
|
||||
}
|
||||
}
|
||||
|
||||
// jspb.utils package excluded as it likely shouldn't be called by user code
|
||||
// jspb.utils package excluded as it likely shouldn't be called by user code
|
||||
|
||||
@@ -40,10 +40,10 @@ describe('UniversalAnalytics', () => {
|
||||
ga.getByName('aNamedTracker');
|
||||
});
|
||||
it('should excercise Tracker APIs', () => {
|
||||
var tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto');
|
||||
var aString: string = tracker.get<string>('aString');
|
||||
var aNumber: number = tracker.get<number>('aNumber');
|
||||
var anObject: {} = tracker.get<{}>('anObject');
|
||||
const tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto');
|
||||
const aString: string = tracker.get<string>('aString');
|
||||
const aNumber: number = tracker.get<number>('aNumber');
|
||||
const anObject: {} = tracker.get<{}>('anObject');
|
||||
tracker.send('pageview');
|
||||
tracker.send('pageview', {some: 'details'});
|
||||
tracker.set('aString', aString);
|
||||
@@ -66,7 +66,6 @@ describe("tester Google Analytics Tracker _gat object", () => {
|
||||
it("can create _anonymizeIp", () => {
|
||||
_gat._anonymizeIp();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("tester Google Analytics Code _gaq object", () => {
|
||||
@@ -76,17 +75,16 @@ describe("tester Google Analytics Code _gaq object", () => {
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
_gaq.push(() => {
|
||||
var tracker = _gat._getTrackerByName('UA-65432-1');
|
||||
const tracker = _gat._getTrackerByName('UA-65432-1');
|
||||
tracker._trackPageview();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("tester Google Analytics Code Tracker object", () => {
|
||||
it("can create Tracker object and call methods", () => {
|
||||
var tracker = _gat._getTrackerByName('UA-65432-1');
|
||||
const tracker = _gat._getTrackerByName('UA-65432-1');
|
||||
tracker._trackPageview();
|
||||
tracker._getName();
|
||||
tracker._getAccount();
|
||||
|
||||
Vendored
+1
-1
@@ -42,7 +42,7 @@ declare namespace UniversalAnalytics {
|
||||
enum HitType {
|
||||
'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'
|
||||
}
|
||||
|
||||
|
||||
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
|
||||
|
||||
interface FieldsObject {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
function test(list: google.fonts.WebfontList) {
|
||||
const f = list.items[0];
|
||||
|
||||
var f = list.items[0];
|
||||
|
||||
var info = [
|
||||
const info = [
|
||||
f.category,
|
||||
f.family,
|
||||
f.kind,
|
||||
@@ -10,7 +9,7 @@ function test(list: google.fonts.WebfontList) {
|
||||
f.version
|
||||
];
|
||||
|
||||
var urls = f.variants.map(
|
||||
const urls = f.variants.map(
|
||||
v => f.files[v]
|
||||
);
|
||||
}
|
||||
|
||||
Vendored
+2
-3
@@ -4,13 +4,12 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace google.fonts {
|
||||
|
||||
export interface WebfontList {
|
||||
interface WebfontList {
|
||||
kind: string;
|
||||
items: WebfontFamily[];
|
||||
}
|
||||
|
||||
export interface WebfontFamily {
|
||||
interface WebfontFamily {
|
||||
category?: string;
|
||||
kind: string;
|
||||
family: string;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import graphite = require('graphite-udp');
|
||||
|
||||
// Test creation of client directly.
|
||||
let client = new graphite.Client();
|
||||
const client = new graphite.Client();
|
||||
client.put('test', 1);
|
||||
client.add('test', 1);
|
||||
client.close();
|
||||
|
||||
// Create client with helper
|
||||
let client2 = graphite.createClient();
|
||||
const client2 = graphite.createClient();
|
||||
client2.put('test2', 1);
|
||||
client2.add('test2', 1);
|
||||
client2.close();
|
||||
@@ -22,9 +22,7 @@ graphite.createClient({
|
||||
suffix: 'suffix',
|
||||
interval: 60 * 1000,
|
||||
verbose: true,
|
||||
callback: (error: Error, metrics: any): void => {
|
||||
|
||||
}
|
||||
callback: (error: Error, metrics: any): void => {}
|
||||
});
|
||||
|
||||
// Test creation options with class directly.
|
||||
@@ -37,7 +35,5 @@ new graphite.Client({
|
||||
suffix: 'suffix',
|
||||
interval: 60 * 1000,
|
||||
verbose: true,
|
||||
callback: (error: Error, metrics: any): void => {
|
||||
|
||||
}
|
||||
callback: (error: Error, metrics: any): void => {}
|
||||
});
|
||||
|
||||
Vendored
-2
@@ -3,7 +3,6 @@
|
||||
// Definitions by: Eric Byers <https://github.com/EricByers/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
interface ClientOptions {
|
||||
/**
|
||||
* graphite server host or ip
|
||||
@@ -65,7 +64,6 @@ interface ClientOptions {
|
||||
}
|
||||
|
||||
export class Client {
|
||||
|
||||
constructor(clientOptions?: ClientOptions);
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+9
-11
@@ -30,7 +30,7 @@ SOFTWARE.
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
type ReactClass<T> = React.ComponentClass<T> | React.StatelessComponent<T>
|
||||
type ReactClass<T> = React.ComponentClass<T> | React.StatelessComponent<T>;
|
||||
|
||||
export interface CustomColumnComponentProps<T> {
|
||||
data: any;
|
||||
@@ -80,9 +80,7 @@ export interface ColumnMetaData<T> {
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
export interface BodyCssClassNameFunction<T> {
|
||||
(rowData: T): string;
|
||||
}
|
||||
export type BodyCssClassNameFunction<T> = (rowData: T) => string;
|
||||
|
||||
export interface RowMetaData<T> {
|
||||
bodyCssClassName?: BodyCssClassNameFunction<T> | string;
|
||||
@@ -90,7 +88,7 @@ export interface RowMetaData<T> {
|
||||
|
||||
export interface GriddleProps<T> {
|
||||
columns?: string[];
|
||||
columnMetadata?: ColumnMetaData<T>[];
|
||||
columnMetadata?: Array<ColumnMetaData<T>>;
|
||||
rowMetadata?: RowMetaData<T>;
|
||||
results?: T[];
|
||||
resultsPerPage?: number;
|
||||
@@ -115,15 +113,15 @@ export interface GriddleProps<T> {
|
||||
useCustomFilterer?: boolean;
|
||||
useCustomFilterComponent?: boolean;
|
||||
useGriddleStyles?: boolean;
|
||||
customRowComponent?: ReactClass<CustomRowComponentProps<T>>
|
||||
customGridComponent?: ReactClass<CustomGridComponentProps<T>>
|
||||
customPagerComponent?: ReactClass<CustomPagerComponentProps>
|
||||
customFilterComponent?: ReactClass<CustomFilterComponentProps>
|
||||
customRowComponent?: ReactClass<CustomRowComponentProps<T>>;
|
||||
customGridComponent?: ReactClass<CustomGridComponentProps<T>>;
|
||||
customPagerComponent?: ReactClass<CustomPagerComponentProps>;
|
||||
customFilterComponent?: ReactClass<CustomFilterComponentProps>;
|
||||
customFilterer?(items: T[], query: any): T[];
|
||||
enableToggleCustom?: boolean;
|
||||
noDataMessage?: string;
|
||||
noDataClassName?: string;
|
||||
customNoDataComponent?: ReactClass<void>
|
||||
customNoDataComponent?: ReactClass<void>;
|
||||
showTableHeading?: boolean;
|
||||
showPager?: boolean;
|
||||
useFixedHeader?: boolean;
|
||||
@@ -136,7 +134,7 @@ export interface GriddleProps<T> {
|
||||
externalCurrentPage?: number;
|
||||
externalSortColumn?: string;
|
||||
externalSortAscending?: boolean;
|
||||
externalLoadingComponent?: ReactClass<void>
|
||||
externalLoadingComponent?: ReactClass<void>;
|
||||
externalIsLoading?: boolean;
|
||||
enableInfiniteScroll?: boolean;
|
||||
bodyHeight?: number;
|
||||
|
||||
@@ -8,23 +8,23 @@ import * as React from 'react';
|
||||
import Griddle, { CustomColumnComponentProps } from 'griddle-react';
|
||||
|
||||
interface MyCustomResult {
|
||||
name: string,
|
||||
test: string
|
||||
name: string;
|
||||
test: string;
|
||||
}
|
||||
|
||||
class LinkComponent extends React.Component<CustomColumnComponentProps<MyCustomResult>, any> {
|
||||
render() {
|
||||
var url = "speakers/" + this.props.rowData.test + "/" + this.props.data;
|
||||
return <a href={url}>{this.props.data}</a>
|
||||
const url = "speakers/" + this.props.rowData.test + "/" + this.props.data;
|
||||
return <a href={url}>{this.props.data}</a>;
|
||||
}
|
||||
}
|
||||
|
||||
const StatelessFunctionComponent = (props: CustomColumnComponentProps<MyCustomResult>) => {
|
||||
var url = "speakers/" + props.rowData.test + "/" + props.data;
|
||||
return <a href={url}>{props.data}</a>
|
||||
const url = "speakers/" + props.rowData.test + "/" + props.data;
|
||||
return <a href={url}>{props.data}</a>;
|
||||
};
|
||||
|
||||
var columnMeta = [
|
||||
const columnMeta = [
|
||||
{
|
||||
columnName: "name",
|
||||
order: 1,
|
||||
@@ -33,7 +33,7 @@ var columnMeta = [
|
||||
customComponent: StatelessFunctionComponent
|
||||
}];
|
||||
|
||||
var results: MyCustomResult[] = [
|
||||
const results: MyCustomResult[] = [
|
||||
{
|
||||
name: 'David Hara',
|
||||
test: 'blah'
|
||||
@@ -44,7 +44,7 @@ var results: MyCustomResult[] = [
|
||||
}
|
||||
];
|
||||
|
||||
var rowMetaData = {
|
||||
const rowMetaData = {
|
||||
bodyCssClassName: (rowData: MyCustomResult) => {
|
||||
return rowData.test;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class CustomColumnComponentGrid extends React.Component<any, any> {
|
||||
render() {
|
||||
type TypedGriddle = new () => Griddle<MyCustomResult>;
|
||||
const TypedGriddle = Griddle as TypedGriddle;
|
||||
|
||||
|
||||
return (
|
||||
<TypedGriddle
|
||||
results={results}
|
||||
@@ -67,4 +67,4 @@ class CustomColumnComponentGrid extends React.Component<any, any> {
|
||||
};
|
||||
}
|
||||
|
||||
export default CustomColumnComponentGrid;
|
||||
export default CustomColumnComponentGrid;
|
||||
|
||||
@@ -10,7 +10,6 @@ import Griddle, { CustomFilterComponentProps } from 'griddle-react';
|
||||
|
||||
const CustomFilterFunction = (items: ResultType[], query: string): ResultType[] => {
|
||||
return _.filter(items, (item) => {
|
||||
|
||||
let match = false;
|
||||
_.forIn(item, (value, key) => {
|
||||
if (String(value).toLowerCase().indexOf(query.toLowerCase()) >= 0) {
|
||||
@@ -53,30 +52,29 @@ interface ResultType {
|
||||
favoriteNumber: number;
|
||||
}
|
||||
|
||||
var someData: ResultType[] = [
|
||||
const someData: ResultType[] = [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Mayer Leonard",
|
||||
"city": "Kapowsin",
|
||||
"state": "Hawaii",
|
||||
"country": "United Kingdom",
|
||||
"company": "Ovolo",
|
||||
"favoriteNumber": 7
|
||||
id: 0,
|
||||
name: "Mayer Leonard",
|
||||
city: "Kapowsin",
|
||||
state: "Hawaii",
|
||||
country: "United Kingdom",
|
||||
company: "Ovolo",
|
||||
favoriteNumber: 7
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Koch Becker",
|
||||
"city": "Johnsonburg",
|
||||
"state": "New Jersey",
|
||||
"country": "Madagascar",
|
||||
"company": "Eventage",
|
||||
"favoriteNumber": 2
|
||||
id: 1,
|
||||
name: "Koch Becker",
|
||||
city: "Johnsonburg",
|
||||
state: "New Jersey",
|
||||
country: "Madagascar",
|
||||
company: "Eventage",
|
||||
favoriteNumber: 2
|
||||
}
|
||||
];
|
||||
|
||||
class CustomFilterComponentGrid extends React.Component<any, any> {
|
||||
render() {
|
||||
|
||||
type TypedGriddle = new () => Griddle<ResultType>;
|
||||
const TypedGriddle = Griddle as TypedGriddle;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class HeaderComponent extends React.Component<MoreCustomHeaderComponentProps, an
|
||||
}
|
||||
|
||||
filterText(e: React.FormEvent<HTMLInputElement>) {
|
||||
this.props.filterByColumn(e.currentTarget.value, this.props.columnName)
|
||||
this.props.filterByColumn(e.currentTarget.value, this.props.columnName);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -40,28 +40,28 @@ interface ResultType {
|
||||
favoriteNumber: number;
|
||||
}
|
||||
|
||||
var someData: ResultType[] = [
|
||||
const someData: ResultType[] = [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Mayer Leonard",
|
||||
"city": "Kapowsin",
|
||||
"state": "Hawaii",
|
||||
"country": "United Kingdom",
|
||||
"company": "Ovolo",
|
||||
"favoriteNumber": 7
|
||||
id: 0,
|
||||
name: "Mayer Leonard",
|
||||
city: "Kapowsin",
|
||||
state: "Hawaii",
|
||||
country: "United Kingdom",
|
||||
company: "Ovolo",
|
||||
favoriteNumber: 7
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Koch Becker",
|
||||
"city": "Johnsonburg",
|
||||
"state": "New Jersey",
|
||||
"country": "Madagascar",
|
||||
"company": "Eventage",
|
||||
"favoriteNumber": 2
|
||||
id: 1,
|
||||
name: "Koch Becker",
|
||||
city: "Johnsonburg",
|
||||
state: "New Jersey",
|
||||
country: "Madagascar",
|
||||
company: "Eventage",
|
||||
favoriteNumber: 2
|
||||
}
|
||||
];
|
||||
|
||||
var columnMeta: ColumnMetaData<ResultType>[] = [
|
||||
const columnMeta: Array<ColumnMetaData<ResultType>> = [
|
||||
{
|
||||
columnName: 'name',
|
||||
order: 1,
|
||||
@@ -82,7 +82,6 @@ var columnMeta: ColumnMetaData<ResultType>[] = [
|
||||
|
||||
class CustomHeaderComponentGrid extends React.Component<any, any> {
|
||||
render() {
|
||||
|
||||
type TypedGriddle = new () => Griddle<ResultType>;
|
||||
const TypedGriddle = Griddle as TypedGriddle;
|
||||
|
||||
|
||||
@@ -7,28 +7,28 @@ Copyright (c) 2016 David Hara
|
||||
import * as React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import Griddle, { CustomColumnComponentProps } from 'griddle-react';
|
||||
import CustomColumnComponentGrid from './test/CustomColumnComponent';
|
||||
import CustomHeaderComponentGrid from './test/CustomHeaderComponent';
|
||||
import CustomFilterComponentGrid from './test/CustomFilterComponent';
|
||||
import CustomColumnComponentGrid from './CustomColumnComponent';
|
||||
import CustomHeaderComponentGrid from './CustomHeaderComponent';
|
||||
import CustomFilterComponentGrid from './CustomFilterComponent';
|
||||
|
||||
interface MyCustomResult {
|
||||
name: string,
|
||||
test: string
|
||||
name: string;
|
||||
test: string;
|
||||
}
|
||||
|
||||
class LinkComponent extends React.Component<CustomColumnComponentProps<MyCustomResult>, any> {
|
||||
render() {
|
||||
var url = "speakers/" + this.props.rowData.test + "/" + this.props.data;
|
||||
return <a href={url}>{this.props.data}</a>
|
||||
const url = "speakers/" + this.props.rowData.test + "/" + this.props.data;
|
||||
return <a href={url}>{this.props.data}</a>;
|
||||
}
|
||||
}
|
||||
|
||||
const StatelessFunctionComponent = (props: CustomColumnComponentProps<MyCustomResult>) => {
|
||||
var url = "speakers/" + props.rowData.test + "/" + props.data;
|
||||
return <a href={url}>{props.data}</a>
|
||||
const url = "speakers/" + props.rowData.test + "/" + props.data;
|
||||
return <a href={url}>{props.data}</a>;
|
||||
};
|
||||
|
||||
var columnMeta = [
|
||||
const columnMeta = [
|
||||
{
|
||||
columnName: "name",
|
||||
order: 1,
|
||||
@@ -37,7 +37,7 @@ var columnMeta = [
|
||||
customComponent: StatelessFunctionComponent
|
||||
}];
|
||||
|
||||
var results: MyCustomResult[] = [
|
||||
const results: MyCustomResult[] = [
|
||||
{
|
||||
name: 'David Hara',
|
||||
test: 'blah'
|
||||
@@ -48,7 +48,7 @@ var results: MyCustomResult[] = [
|
||||
}
|
||||
];
|
||||
|
||||
var rowMetaData = {
|
||||
const rowMetaData = {
|
||||
bodyCssClassName: (rowData: MyCustomResult) => {
|
||||
return rowData.test;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"griddle-react-tests.tsx",
|
||||
"test/index.tsx",
|
||||
"test/CustomColumnComponent.tsx",
|
||||
"test/CustomFilterComponent.tsx",
|
||||
"test/CustomHeaderComponent.tsx"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
|
||||
function test_HandsontableInit() {
|
||||
var elem = document.createElement('div');
|
||||
var hot = new Handsontable(elem, {
|
||||
const elem = document.createElement('div');
|
||||
const hot = new Handsontable(elem, {
|
||||
allowEmpty: true,
|
||||
allowInsertColumn: true,
|
||||
allowInsertRow: true,
|
||||
@@ -206,8 +204,8 @@ function test_HandsontableInit() {
|
||||
}
|
||||
|
||||
function test_HandsontableMethods() {
|
||||
var elem = document.createElement('div');
|
||||
var hot = new Handsontable(elem, {});
|
||||
const elem = document.createElement('div');
|
||||
const hot = new Handsontable(elem, {});
|
||||
hot.addHook('foo', []);
|
||||
hot.addHookOnce('foo', []);
|
||||
hot.alter('foo', 123, 123, 'foo', true);
|
||||
@@ -298,4 +296,4 @@ class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin {
|
||||
isEnabled(): boolean {
|
||||
return !!this.hot.getSettings().manualRowMove;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-2
@@ -311,7 +311,6 @@ declare namespace ht {
|
||||
editor?: string | EditorConstructor;
|
||||
selectOptions?: any[];
|
||||
width?: number;
|
||||
|
||||
}
|
||||
|
||||
interface CellProperties {
|
||||
@@ -506,7 +505,7 @@ declare var Handsontable: {
|
||||
};
|
||||
|
||||
declare module "handsontable" {
|
||||
export var Handsontable: {
|
||||
const Handsontable: {
|
||||
new (element: Element, options: ht.Options): ht.Methods;
|
||||
plugins: ht.Plugins;
|
||||
hooks: ht.Hooks;
|
||||
|
||||
Vendored
+3
-5
@@ -30,10 +30,10 @@ declare namespace Highstock {
|
||||
}
|
||||
|
||||
interface RangeSelectorButton {
|
||||
type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'.
|
||||
type: string; // Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'.
|
||||
count?: number;
|
||||
text: string;
|
||||
dataGrouping?: any; //not sure how this works
|
||||
dataGrouping?: any; // not sure how this works
|
||||
}
|
||||
|
||||
interface RangeSelectorOptions {
|
||||
@@ -97,7 +97,6 @@ declare namespace Highstock {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
highcharts(type: "StockChart"): Highstock.ChartObject;
|
||||
@@ -117,7 +116,6 @@ declare global {
|
||||
**/
|
||||
highcharts(type: "StockChart", options: Highstock.Options, callback: (chart: Highstock.ChartObject) => void): JQuery;
|
||||
|
||||
|
||||
highcharts(type: string): Highcharts.ChartObject;
|
||||
highcharts(type: string, options: Highcharts.Options): JQuery;
|
||||
highcharts(type: string, options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery;
|
||||
@@ -126,4 +124,4 @@ declare global {
|
||||
|
||||
declare var Highstock: Highstock.Static;
|
||||
export = Highstock;
|
||||
export as namespace Highstock;
|
||||
export as namespace Highstock;
|
||||
|
||||
Vendored
+41
-42
@@ -530,8 +530,8 @@ declare namespace Highcharts {
|
||||
*/
|
||||
gridLineColor?: string;
|
||||
/**
|
||||
* The dash or dot style of the grid lines. For possible values,
|
||||
* see {@http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/|this demonstration}.
|
||||
* The dash or dot style of the grid lines. For possible values,
|
||||
* see {@http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/|this demonstration}.
|
||||
* Defaults to Solid.
|
||||
* @since 1.2
|
||||
*/
|
||||
@@ -629,7 +629,7 @@ declare namespace Highcharts {
|
||||
*/
|
||||
minorGridLineColor?: string;
|
||||
/**
|
||||
* The dash or dot style of the minor grid lines. For possible values,
|
||||
* The dash or dot style of the minor grid lines. For possible values,
|
||||
* see {@link http://jsfiddle.net/gh/get/jquery/1.7.1/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/|this demonstration}.
|
||||
* @default 'Solid'
|
||||
*/
|
||||
@@ -3329,7 +3329,6 @@ declare namespace Highcharts {
|
||||
* The default action is to toggle the visibility of the point. This can be prevented by calling event.preventDefault().
|
||||
*/
|
||||
legendItemClick?: (event: Event) => boolean | void;
|
||||
|
||||
}
|
||||
|
||||
interface Halo {
|
||||
@@ -5318,7 +5317,7 @@ declare namespace Highcharts {
|
||||
interface CrosshairObject {
|
||||
color?: string | Gradient;
|
||||
width?: number;
|
||||
dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot
|
||||
dashStyle?: string; // Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
@@ -5741,7 +5740,7 @@ declare namespace Highcharts {
|
||||
* @param {number} min The new minimum value
|
||||
* @param {number} max The new maximum value
|
||||
* @param {boolean} redraw Whether to redraw the chart or wait for an explicit call to chart.redraw().
|
||||
* @param {boolean | Animation} animation When true, the resize will be animated with default animation options.
|
||||
* @param {boolean | Animation} animation When true, the resize will be animated with default animation options.
|
||||
* The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -5792,7 +5791,7 @@ declare namespace Highcharts {
|
||||
* @param {AxisOptions} options The Axis options, as documented under xAxis and yAxis.
|
||||
* @param [boolean] isX Whether it is an X axis or Y axis
|
||||
* @param [boolean] redraw Defaults to true. Whether to redraw the chart after the series is added. See the redraw() method.
|
||||
* @param [boolean | Animation] animation Defaults to true. When true, the series' updating will be animated with default animation options.
|
||||
* @param [boolean | Animation] animation Defaults to true. When true, the series' updating will be animated with default animation options.
|
||||
* The animation can also be a configuration object with properties duration and easing.
|
||||
* @return {AxisObject}
|
||||
* @since 3.0
|
||||
@@ -5841,9 +5840,9 @@ declare namespace Highcharts {
|
||||
/**
|
||||
* Exporting module required. Submit an SVG version of the chart to a server along with some parameters for
|
||||
* conversion.
|
||||
* @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method.
|
||||
* All options default to the values given in the exporting config options. filename: the filename for the export without extension,
|
||||
* url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server,
|
||||
* @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method.
|
||||
* All options default to the values given in the exporting config options. filename: the filename for the export without extension,
|
||||
* url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server,
|
||||
* type: the MIME type of the converted image, sourceWidth: the width of the source (in-page) chart, sourceHeight: the height of the source chart.
|
||||
* @since 2.0
|
||||
*/
|
||||
@@ -5851,9 +5850,9 @@ declare namespace Highcharts {
|
||||
/**
|
||||
* Exporting module required. Submit an SVG version of the chart to a server along with some parameters for
|
||||
* conversion.
|
||||
* @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method.
|
||||
* All options default to the values given in the exporting config options. filename: the filename for the export without extension,
|
||||
* url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server,
|
||||
* @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method.
|
||||
* All options default to the values given in the exporting config options. filename: the filename for the export without extension,
|
||||
* url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server,
|
||||
* type: the MIME type of the converted image, sourceWidth: the width of the source (in-page) chart, sourceHeight: the height of the source chart.
|
||||
* @param {Options} chartOptions Additional chart options for the exported chart. For example a different background color can be added here.
|
||||
* @since 2.0
|
||||
@@ -5892,7 +5891,7 @@ declare namespace Highcharts {
|
||||
get(id: string): AxisObject | SeriesObject | PointObject;
|
||||
/**
|
||||
* Exporting module required. Get an SVG string representing the chart.
|
||||
* @param {Options} additionalOptions Chart options to add to the exported chart in addition to the options given for the original chart.
|
||||
* @param {Options} additionalOptions Chart options to add to the exported chart in addition to the options given for the original chart.
|
||||
* For example if series.lineWidth should be greater in the exported chart than in the original, or the chart should have a different background color, this is added here.
|
||||
* @return {string}
|
||||
* @since 2.0
|
||||
@@ -5934,7 +5933,7 @@ declare namespace Highcharts {
|
||||
* more than one operation on the chart before redrawing, for example add a number of points. In those cases it is a
|
||||
* waste of resources to redraw the chart for each new point added. So you add the points and call chart.redraw()
|
||||
* after.
|
||||
* @param [boolean | Animation] animation Defaults to true. When true, the update will be animated with default animation options.
|
||||
* @param [boolean | Animation] animation Defaults to true. When true, the update will be animated with default animation options.
|
||||
* The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6018,9 +6017,9 @@ declare namespace Highcharts {
|
||||
/**
|
||||
* This is the constructor for creating a new chart object.
|
||||
* @param {Options} options The chart options
|
||||
* @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread,
|
||||
* but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready,
|
||||
* and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart().
|
||||
* @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread,
|
||||
* but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready,
|
||||
* and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart().
|
||||
* s a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.event.load handler is equivalent.
|
||||
* @return {ChartObject}
|
||||
*/
|
||||
@@ -6036,9 +6035,9 @@ declare namespace Highcharts {
|
||||
* This is the constructor for creating a new chart object.
|
||||
* @param {string|HTMLElement} renderTo The id or a reference to a DOM element where the chart should be rendered (since v4.2.0).
|
||||
* @param {Options} options The chart options
|
||||
* @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread,
|
||||
* but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready,
|
||||
* and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart().
|
||||
* @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread,
|
||||
* but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready,
|
||||
* and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart().
|
||||
* As a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.event.load handler is equivalent.
|
||||
* @return {ChartObject}
|
||||
*/
|
||||
@@ -6062,7 +6061,7 @@ declare namespace Highcharts {
|
||||
* Apply numeric attributes to the SVG/VML element by animation. See Element.attr() for more information on setting
|
||||
* attributes.
|
||||
* @param {any} attributes A set of attributes to apply.
|
||||
* @param {any} animation Optional animation parameters that are passed over to jQuery or other framework.
|
||||
* @param {any} animation Optional animation parameters that are passed over to jQuery or other framework.
|
||||
* Valid properties depend on the library, but options like duration, easing and complete are supported by jQuery.
|
||||
* @return {ElementObject}
|
||||
* @since 2.0
|
||||
@@ -6152,7 +6151,7 @@ declare namespace Highcharts {
|
||||
circle(centerX: number, centerY: number, radius: number): ElementObject;
|
||||
/**
|
||||
* Add an SVG/VML group.
|
||||
* @param [string] name The name of the group. This will be used in the class name, which will be 'highcharts-'+ name.
|
||||
* @param [string] name The name of the group. This will be used in the class name, which will be 'highcharts-'+ name.
|
||||
* Other Element objects are added to the group by using the group as the first parameter in .add() for the wrappers
|
||||
* @return {ElementObject}
|
||||
* @since 2.0
|
||||
@@ -6181,7 +6180,7 @@ declare namespace Highcharts {
|
||||
* @param [number] anchorX If the shape has a pointer, like the chevron on a callout shape, anchorX is the x position to point to.
|
||||
* @param [number] anchorY If the shape has a pointer, like the chevron on a callout shape, anchorY is the y position to point to.
|
||||
* @param [boolean] useHTML Use HTML to render the text of the label.
|
||||
* @param [boolean] baseline Whether the label should be vertically aligned by the text baseline, which makes it behave like the text element,
|
||||
* @param [boolean] baseline Whether the label should be vertically aligned by the text baseline, which makes it behave like the text element,
|
||||
* or by the top left side, which makes it behave like a HTML div.
|
||||
* @param [string] className A class name for the g element surrounding the label.
|
||||
* @return {ElementObject}
|
||||
@@ -6309,9 +6308,9 @@ declare namespace Highcharts {
|
||||
percentage: number;
|
||||
/**
|
||||
* Remove the point from the series.
|
||||
* @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is removed.If doing more operations on the chart,
|
||||
* @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is removed.If doing more operations on the chart,
|
||||
* it is a good idea to set redraw to false and call chart.redraw() after.
|
||||
* @param [boolean|Animation] animation Defaults to true. When true, the graph's updating will be animated with default animation options.
|
||||
* @param [boolean|Animation] animation Defaults to true. When true, the graph's updating will be animated with default animation options.
|
||||
* The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6319,7 +6318,7 @@ declare namespace Highcharts {
|
||||
/**
|
||||
* Select or unselect the point.
|
||||
* @param [boolean] select When true, the point is selected. When false, the point is unselected. When null or undefined, the selection state is toggled.
|
||||
* @param [boolean] accumulate When true, the selection is added to other selected points. When false, other selected points are deselected.
|
||||
* @param [boolean] accumulate When true, the selection is added to other selected points. When false, other selected points are deselected.
|
||||
* Internally in Highcharts,selected points are accumulated on Control, Shift or Cmd clicking the point.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6339,7 +6338,7 @@ declare namespace Highcharts {
|
||||
* is selected.
|
||||
* @param [boolean] sliced When true, the point is sliced out. When false, the point is set in. When null or undefined, the sliced state is toggled.
|
||||
* @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is altered.
|
||||
* @param [boolean|Animation] animation Defaults to true. When true, the move will be animated with default animation options.
|
||||
* @param [boolean|Animation] animation Defaults to true. When true, the move will be animated with default animation options.
|
||||
* The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6350,12 +6349,12 @@ declare namespace Highcharts {
|
||||
total: number;
|
||||
/**
|
||||
* Update the point with new values.
|
||||
* @param {number|[number,number]|DataPoint} options The point options. Point options are handled as described under the series<type>.data item for each series type.
|
||||
* For example for a line series, if options is a single number, the point will be given that number as the main y value. If it is an array,
|
||||
* @param {number|[number,number]|DataPoint} options The point options. Point options are handled as described under the series<type>.data item for each series type.
|
||||
* For example for a line series, if options is a single number, the point will be given that number as the main y value. If it is an array,
|
||||
* it will be interpreted as x and y values respectively. If it is an object, advanced options are applied.
|
||||
* @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is updated.If doing more operations on the chart,
|
||||
* @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is updated.If doing more operations on the chart,
|
||||
* it is a good idea to set redraw to false and call chart.redraw() after.
|
||||
* @param {boolean|Animation} animation Defaults to true. When true, the update will be animated with default animation options.
|
||||
* @param {boolean|Animation} animation Defaults to true. When true, the update will be animated with default animation options.
|
||||
* The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6392,11 +6391,11 @@ declare namespace Highcharts {
|
||||
* the start or in the middle of the series.
|
||||
* @param {number|[number,number]|DataPoint} The point options. If options is a single number, a point with that y value is appended to the series.
|
||||
* If it is an array, it will be interpreted as x and y values respectively. If it is an object, advanced options as outlined under series.data are applied.
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the point is added. When adding more than one point,
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the point is added. When adding more than one point,
|
||||
* it is highly recommended that the redraw option be set to false, and instead chart.redraw() is explicitly called after the adding of points is finished.
|
||||
* @param [boolean=false] shift - When shift is true, one point is shifted off the start of the series as one is appended to the end.
|
||||
* @param [boolean=false] shift - When shift is true, one point is shifted off the start of the series as one is appended to the end.
|
||||
* Use this option for live charts monitoring a value over time.
|
||||
* @param [(boolean|Animation)=false] animation - When shift is true, one point is shifted off the start of the series as one is appended to the end.
|
||||
* @param [(boolean|Animation)=false] animation - When shift is true, one point is shifted off the start of the series as one is appended to the end.
|
||||
* Use this option for live charts monitoring a value over time.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6429,7 +6428,7 @@ declare namespace Highcharts {
|
||||
options: IndividualSeriesOptions;
|
||||
/**
|
||||
* Remove the series from the chart.
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the series is removed.If doing more operations on the chart,
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the series is removed.If doing more operations on the chart,
|
||||
* it is a good idea to set redraw to false and call chart.redraw() after.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6440,7 +6439,7 @@ declare namespace Highcharts {
|
||||
* @param {number} index - The index of the point in the data array.
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the point is added. When adding more than one point,
|
||||
* it is highly recommended that the redraw option be set to false, and instead chart.redraw() is explicitly called after the adding of points is finished.
|
||||
* @param [boolean|Animation=true] animation - When true, the graph will be animated with default animation options.
|
||||
* @param [boolean|Animation=true] animation - When true, the graph will be animated with default animation options.
|
||||
* The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 4.1.0
|
||||
*/
|
||||
@@ -6461,11 +6460,11 @@ declare namespace Highcharts {
|
||||
* Apply a new set of data to the series and optionally redraw it. Note that this method throws away all points and
|
||||
* creates new ones. For updating the values of existing points, use Point.update() instead.
|
||||
* @param {number[]|number[][]|DataPoint[]} data - Takes an array of data in the same format as described under series<type>data for the given series type.
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart,
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart,
|
||||
* it is a good idea to set redraw to false and call chart.redraw() after.
|
||||
* @param [boolean|Animation] animation - When the updated data is the same length as the existing data, points will be updated by default,
|
||||
* @param [boolean|Animation] animation - When the updated data is the same length as the existing data, points will be updated by default,
|
||||
* and animation visualizes how the points are changed. Set false to disable animation, or a configuration object to set duration or easing.
|
||||
* @param [boolean] updatePoints - When the updated data is the same length as the existing data, points will be updated instead of replace.
|
||||
* @param [boolean] updatePoints - When the updated data is the same length as the existing data, points will be updated instead of replace.
|
||||
* This option prevents this, and makes setData behave like it did prior to Highcharts 3.0.10.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6473,7 +6472,7 @@ declare namespace Highcharts {
|
||||
/**
|
||||
* A utility function to show or hide the series with an optional redraw.
|
||||
* @param [boolean] visible - Whether to show or hide the series. If undefined, the visibility is toggled.
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart,
|
||||
* @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart,
|
||||
* it is a good idea to set redraw to false and call chart.redraw() after.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -6493,7 +6492,7 @@ declare namespace Highcharts {
|
||||
* elements from the series is removed, and it is initiated from scratch. Therefore, this method is more performance
|
||||
* expensive than some other utility methods like setData or setVisible.
|
||||
* @param {IndividualSeriesOptions} options New options that will be merged into the series' existing options.
|
||||
* @param [boolean] redraw - Whether to redraw the chart after the series is altered. If doing more operations on the chart,
|
||||
* @param [boolean] redraw - Whether to redraw the chart after the series is altered. If doing more operations on the chart,
|
||||
* it is a good idea to set redraw to false and call chart.redraw() after.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
|
||||
Vendored
+7
-18
@@ -7,11 +7,11 @@ import * as highcharts from 'highcharts';
|
||||
import * as geojson from 'geojson';
|
||||
|
||||
declare module 'highcharts' {
|
||||
export interface Static {
|
||||
interface Static {
|
||||
mapChart(renderTo: string | HTMLElement, options: MapOptions, callback?: (chart: highcharts.ChartObject) => void): highcharts.ChartObject;
|
||||
}
|
||||
|
||||
export interface MapOptions {
|
||||
interface MapOptions {
|
||||
chart?: highcharts.ChartOptions;
|
||||
|
||||
legend?: highcharts.LegendOptions;
|
||||
@@ -43,24 +43,13 @@ declare module 'highcharts' {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface Navigation {
|
||||
interface Navigation {}
|
||||
|
||||
}
|
||||
interface MapSeriesOptionsDataLabels {}
|
||||
|
||||
export interface MapSeriesOptionsDataLabels {
|
||||
interface MapSeriesOptionsStates {}
|
||||
|
||||
}
|
||||
interface MapSeriesOptionsTooltip {}
|
||||
|
||||
export interface MapSeriesOptionsStates {
|
||||
|
||||
}
|
||||
|
||||
export interface MapSeriesOptionsTooltip {
|
||||
|
||||
}
|
||||
|
||||
export interface ColorAxis {
|
||||
|
||||
}
|
||||
interface ColorAxis {}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
/// <reference types="jquery" />
|
||||
import * as Highcharts from "highcharts";
|
||||
|
||||
var someData = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
const someData = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
|
||||
$(() => {
|
||||
$('#container').highcharts('StockChart', {
|
||||
|
||||
chart: {
|
||||
type: "arearange"
|
||||
},
|
||||
|
||||
+107
-111
@@ -1,5 +1,5 @@
|
||||
/// <reference types="jquery" />
|
||||
import * as Highcharts from "highcharts"; // May also use /// <reference types="highcharts" />
|
||||
/// <reference types="jquery" />
|
||||
import * as Highcharts from "highcharts"; // May also use /// <reference types="highcharts" />
|
||||
|
||||
function originalTests() {
|
||||
Highcharts.setOptions({
|
||||
@@ -15,14 +15,12 @@ function originalTests() {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var animate: Highcharts.Animation = {
|
||||
const animate: Highcharts.Animation = {
|
||||
duration: 200,
|
||||
easing: "linear"
|
||||
};
|
||||
|
||||
|
||||
var gradient: Highcharts.Gradient = {
|
||||
const gradient: Highcharts.Gradient = {
|
||||
linearGradient: {
|
||||
x1: 0,
|
||||
y1: 0,
|
||||
@@ -33,11 +31,11 @@ function originalTests() {
|
||||
[0, 'rgb(255, 255, 255)'],
|
||||
[1, 'rgb(200, 200, 255)']
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var color = "#fcfcff";
|
||||
const color = "#fcfcff";
|
||||
|
||||
var chart1 = new Highcharts.Chart({
|
||||
const chart1 = new Highcharts.Chart({
|
||||
chart: {
|
||||
renderTo: "container"
|
||||
},
|
||||
@@ -56,7 +54,7 @@ function originalTests() {
|
||||
|
||||
console.log((<Highcharts.LineChartSeriesOptions> chart1.series[0].options).dashStyle);
|
||||
|
||||
var chart2 = new Highcharts.Chart({
|
||||
const chart2 = new Highcharts.Chart({
|
||||
chart: {
|
||||
renderTo: 'container',
|
||||
width: 400,
|
||||
@@ -109,11 +107,11 @@ function originalTests() {
|
||||
}]
|
||||
});
|
||||
|
||||
var div: HTMLDivElement;
|
||||
var r = new Highcharts.Renderer(div, 20, 30);
|
||||
var box = r.text("Hello", 10, 10).getBBox();
|
||||
const div: HTMLDivElement = null as any;
|
||||
const r = new Highcharts.Renderer(div, 20, 30);
|
||||
const box = r.text("Hello", 10, 10).getBBox();
|
||||
|
||||
var highChartSettings: Highcharts.Options = {
|
||||
const highChartSettings: Highcharts.Options = {
|
||||
chart: {
|
||||
width: 400,
|
||||
height: 400
|
||||
@@ -125,18 +123,18 @@ function originalTests() {
|
||||
}]
|
||||
};
|
||||
|
||||
var container = $("#container").highcharts(highChartSettings, (chart) => {
|
||||
const container = $("#container").highcharts(highChartSettings, (chart) => {
|
||||
chart.series[0].setVisible(true, true);
|
||||
});
|
||||
|
||||
var singleYAxisOptions: Highcharts.Options = {
|
||||
const singleYAxisOptions: Highcharts.Options = {
|
||||
yAxis: {}
|
||||
};
|
||||
var multipleYAxisOptions: Highcharts.Options = {
|
||||
const multipleYAxisOptions: Highcharts.Options = {
|
||||
yAxis: [{}, {}]
|
||||
};
|
||||
|
||||
var renderToIdChart = new Highcharts.Chart("container", {
|
||||
const renderToIdChart = new Highcharts.Chart("container", {
|
||||
xAxis: {},
|
||||
series: [<Highcharts.LineChartSeriesOptions> {
|
||||
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
|
||||
@@ -145,7 +143,7 @@ function originalTests() {
|
||||
}]
|
||||
});
|
||||
|
||||
var renderToElementChart = new Highcharts.Chart(div, {
|
||||
const renderToElementChart = new Highcharts.Chart(div, {
|
||||
xAxis: {},
|
||||
series: [<Highcharts.LineChartSeriesOptions> {
|
||||
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
|
||||
@@ -154,7 +152,7 @@ function originalTests() {
|
||||
}]
|
||||
});
|
||||
|
||||
var createWithFunction = Highcharts.chart({
|
||||
const createWithFunction = Highcharts.chart({
|
||||
xAxis: {},
|
||||
series: [<Highcharts.LineChartSeriesOptions> {
|
||||
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
|
||||
@@ -163,7 +161,7 @@ function originalTests() {
|
||||
}]
|
||||
});
|
||||
|
||||
var createWithFunctionRenderToId = Highcharts.chart("container", {
|
||||
const createWithFunctionRenderToId = Highcharts.chart("container", {
|
||||
xAxis: {},
|
||||
series: [<Highcharts.LineChartSeriesOptions> {
|
||||
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
|
||||
@@ -172,7 +170,7 @@ function originalTests() {
|
||||
}]
|
||||
});
|
||||
|
||||
var createWithFunctionRenderToElement = Highcharts.chart(div, {
|
||||
const createWithFunctionRenderToElement = Highcharts.chart(div, {
|
||||
xAxis: {},
|
||||
series: [<Highcharts.LineChartSeriesOptions> {
|
||||
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
|
||||
@@ -183,7 +181,7 @@ function originalTests() {
|
||||
}
|
||||
|
||||
function test_alldefaults() {
|
||||
var options: Highcharts.Options = {
|
||||
const options: Highcharts.Options = {
|
||||
chart: {},
|
||||
credits: {},
|
||||
data: {},
|
||||
@@ -207,13 +205,13 @@ function test_alldefaults() {
|
||||
}
|
||||
|
||||
function test_ChartOptions() {
|
||||
var emptyChartOptions: Highcharts.ChartOptions = {
|
||||
const emptyChartOptions: Highcharts.ChartOptions = {
|
||||
events: {},
|
||||
options3d: {},
|
||||
resetZoomButton: {}
|
||||
};
|
||||
|
||||
var allValuesSet: Highcharts.ChartOptions = {
|
||||
const allValuesSet: Highcharts.ChartOptions = {
|
||||
alignTicks: false,
|
||||
animation: {
|
||||
duration: 500,
|
||||
@@ -320,7 +318,7 @@ function test_ChartOptions() {
|
||||
zoomType: "x"
|
||||
};
|
||||
|
||||
//alignticks example
|
||||
// alignticks example
|
||||
$('#container').highcharts({
|
||||
chart: {
|
||||
alignTicks: true,
|
||||
@@ -350,7 +348,7 @@ function test_ChartOptions() {
|
||||
y: 70
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function () {
|
||||
formatter() {
|
||||
return '<b> ' + this.series.name + '</b> <br/> ' + this.x + ': ' + this.y;
|
||||
}
|
||||
},
|
||||
@@ -378,9 +376,9 @@ function test_ChartOptions() {
|
||||
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
|
||||
}]
|
||||
});
|
||||
var i = 1;
|
||||
let i = 1;
|
||||
$('#update').click(() => {
|
||||
var chart = $('#container').highcharts();
|
||||
const chart = $('#container').highcharts();
|
||||
chart.series[0].data[0].update(i % 2 ? 200 : 0);
|
||||
i += 1;
|
||||
});
|
||||
@@ -410,7 +408,7 @@ function test_ChartOptions() {
|
||||
y: 70
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function () {
|
||||
formatter() {
|
||||
return `<b> ${this.series.name}</b> <br/> ${this.x}: ${this.y}`;
|
||||
}
|
||||
},
|
||||
@@ -448,8 +446,8 @@ function test_ChartOptions() {
|
||||
$('#container').highcharts({
|
||||
chart: {
|
||||
events: {
|
||||
addSeries: function () {
|
||||
var label = (<Highcharts.ChartObject> this).renderer.label('A series was added, about to redraw chart', 100, 120)
|
||||
addSeries() {
|
||||
const label = (<Highcharts.ChartObject> this).renderer.label('A series was added, about to redraw chart', 100, 120)
|
||||
.attr({
|
||||
fill: Highcharts.getOptions().colors[0],
|
||||
padding: 10,
|
||||
@@ -477,7 +475,7 @@ function test_ChartOptions() {
|
||||
|
||||
// activate the button
|
||||
$('#button').click(() => {
|
||||
var chart = $('#container').highcharts();
|
||||
const chart = $('#container').highcharts();
|
||||
|
||||
chart.addSeries({
|
||||
data: [216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5]
|
||||
@@ -578,7 +576,7 @@ function test_ChartOptions() {
|
||||
}
|
||||
|
||||
function test_CreditsOptions() {
|
||||
var allDefaults: Highcharts.CreditsOptions = {};
|
||||
const allDefaults: Highcharts.CreditsOptions = {};
|
||||
|
||||
// custom url and text example
|
||||
$('#container').highcharts({
|
||||
@@ -597,7 +595,7 @@ function test_CreditsOptions() {
|
||||
|
||||
function test_Data() {
|
||||
// all defaults
|
||||
var data: Highcharts.DataOptions = {};
|
||||
const data: Highcharts.DataOptions = {};
|
||||
|
||||
// data from table example
|
||||
$('#container').highcharts({
|
||||
@@ -675,7 +673,7 @@ function test_Data() {
|
||||
}
|
||||
|
||||
function test_Drilldown() {
|
||||
var allDefaults: Highcharts.DrilldownOptions = {};
|
||||
const allDefaults: Highcharts.DrilldownOptions = {};
|
||||
|
||||
// multiseries drilldown example
|
||||
$('#container').highcharts({
|
||||
@@ -858,7 +856,7 @@ function test_Drilldown() {
|
||||
}
|
||||
|
||||
function test_Exporting() {
|
||||
var allDefaults: Highcharts.ExportingOptions = {};
|
||||
const allDefaults: Highcharts.ExportingOptions = {};
|
||||
|
||||
// source size example
|
||||
$('#container').highcharts({
|
||||
@@ -890,13 +888,13 @@ function test_Exporting() {
|
||||
}
|
||||
|
||||
function test_Loading() {
|
||||
var allDefaults: Highcharts.LoadingOptions = {};
|
||||
const allDefaults: Highcharts.LoadingOptions = {};
|
||||
|
||||
// examples
|
||||
// the button handler
|
||||
var isLoading = false,
|
||||
$button = $('#button'),
|
||||
chart: Highcharts.ChartObject;
|
||||
let isLoading = false;
|
||||
const $button = $('#button');
|
||||
let chart: Highcharts.ChartObject;
|
||||
|
||||
$button.click(() => {
|
||||
if (!isLoading) {
|
||||
@@ -932,7 +930,7 @@ function test_Loading() {
|
||||
}
|
||||
|
||||
function test_Navigation() {
|
||||
var allDefaults: Highcharts.NavigationOptions = {};
|
||||
const allDefaults: Highcharts.NavigationOptions = {};
|
||||
|
||||
// examples
|
||||
$('#container').highcharts({
|
||||
@@ -974,7 +972,7 @@ function test_Navigation() {
|
||||
}
|
||||
|
||||
function test_NoData() {
|
||||
var allDefaults: Highcharts.NoDataOptions = {};
|
||||
const allDefaults: Highcharts.NoDataOptions = {};
|
||||
|
||||
// example
|
||||
$('#container').highcharts({
|
||||
@@ -1000,7 +998,7 @@ function test_NoData() {
|
||||
}
|
||||
|
||||
function test_AreaOptions() {
|
||||
var allDefaults: Highcharts.AreaChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.AreaChartSeriesOptions = {};
|
||||
|
||||
// examples
|
||||
$('#container').highcharts({
|
||||
@@ -1036,7 +1034,7 @@ function test_AreaOptions() {
|
||||
}
|
||||
|
||||
function test_AreaRange() {
|
||||
var allDefaults: Highcharts.AreaRangeChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.AreaRangeChartSeriesOptions = {};
|
||||
|
||||
// example
|
||||
$('#container').highcharts({
|
||||
@@ -1046,8 +1044,7 @@ function test_AreaRange() {
|
||||
},
|
||||
series: [<Highcharts.AreaRangeChartSeriesOptions> {
|
||||
data: (((arr: number[], len: number) => {
|
||||
var i: number;
|
||||
for (i = 0; i < len; i = i + 1) {
|
||||
for (let i = 0; i < len; i = i + 1) {
|
||||
arr.push(i);
|
||||
}
|
||||
return arr;
|
||||
@@ -1092,20 +1089,19 @@ function test_AreaRange() {
|
||||
},
|
||||
series: [<Highcharts.AreaRangeChartSeriesOptions> {
|
||||
name: 'Temperatures',
|
||||
data: data,
|
||||
data,
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
yHigh: 20,
|
||||
yLow: -20
|
||||
}
|
||||
}]
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function test_Bar() {
|
||||
var allDefaults: Highcharts.BarChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.BarChartSeriesOptions = {};
|
||||
|
||||
$('#container').highcharts({
|
||||
chart: {
|
||||
@@ -1230,7 +1226,7 @@ function test_Bar() {
|
||||
}
|
||||
|
||||
function test_BoxPlot() {
|
||||
var allDefaults: Highcharts.BoxPlotChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.BoxPlotChartSeriesOptions = {};
|
||||
|
||||
// boxplot example
|
||||
$('#container').highcharts({
|
||||
@@ -1282,7 +1278,7 @@ function test_BoxPlot() {
|
||||
}
|
||||
|
||||
function test_Bubble() {
|
||||
var allDefaults: Highcharts.BubbleChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.BubbleChartSeriesOptions = {};
|
||||
|
||||
// bubble example
|
||||
$('#container').highcharts({
|
||||
@@ -1365,19 +1361,19 @@ function test_Bubble() {
|
||||
}
|
||||
|
||||
function test_Column() {
|
||||
var allDefaults: Highcharts.ColumnChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.ColumnChartSeriesOptions = {};
|
||||
|
||||
// same options as bar chart
|
||||
}
|
||||
|
||||
function test_ColumnRange() {
|
||||
var allDefaults: Highcharts.ColumnRangeChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.ColumnRangeChartSeriesOptions = {};
|
||||
|
||||
// same options as bar chart and datalabels from arearange
|
||||
}
|
||||
|
||||
function test_ErrorBar() {
|
||||
var allDefaults: Highcharts.ErrorBarChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.ErrorBarChartSeriesOptions = {};
|
||||
|
||||
// error bar styling example
|
||||
$('#container').highcharts({
|
||||
@@ -1428,7 +1424,7 @@ function test_ErrorBar() {
|
||||
}
|
||||
|
||||
function test_Funnel() {
|
||||
var allDefaults: Highcharts.FunnelChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.FunnelChartSeriesOptions = {};
|
||||
|
||||
// funnel demo
|
||||
$('#container').highcharts({
|
||||
@@ -1472,7 +1468,7 @@ function test_Funnel() {
|
||||
}
|
||||
|
||||
function test_Gauge() {
|
||||
var allDefaults: Highcharts.GaugeChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.GaugeChartSeriesOptions = {};
|
||||
|
||||
// example
|
||||
$('#container').highcharts({
|
||||
@@ -1526,7 +1522,7 @@ function test_Gauge() {
|
||||
}
|
||||
|
||||
function test_HeatMap() {
|
||||
var allDefaults: Highcharts.HeatMapSeriesOptions = {};
|
||||
const allDefaults: Highcharts.HeatMapSeriesOptions = {};
|
||||
|
||||
// heatmap demo
|
||||
$('#container').highcharts({
|
||||
@@ -1586,7 +1582,7 @@ function test_HeatMap() {
|
||||
}
|
||||
|
||||
function test_Line() {
|
||||
var allDefaults: Highcharts.LineChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.LineChartSeriesOptions = {};
|
||||
|
||||
// step example
|
||||
$('#container').highcharts({
|
||||
@@ -1616,7 +1612,7 @@ function test_Line() {
|
||||
}
|
||||
|
||||
function test_Pie() {
|
||||
var allDefaults: Highcharts.PieChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.PieChartSeriesOptions = {};
|
||||
|
||||
// pie demo
|
||||
$('#container').highcharts({
|
||||
@@ -1757,7 +1753,7 @@ function test_Pie() {
|
||||
}
|
||||
|
||||
function test_Polygon() {
|
||||
var allDefaults: Highcharts.PolygonChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.PolygonChartSeriesOptions = {};
|
||||
|
||||
$('#container').highcharts({
|
||||
chart: {
|
||||
@@ -1786,7 +1782,7 @@ function test_Polygon() {
|
||||
}
|
||||
|
||||
function test_Pyramid() {
|
||||
var allDefaults: Highcharts.PyramidChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.PyramidChartSeriesOptions = {};
|
||||
|
||||
// pyramid demo
|
||||
$('#container').highcharts({
|
||||
@@ -1825,10 +1821,10 @@ function test_Pyramid() {
|
||||
}
|
||||
|
||||
function test_SolidGauge() {
|
||||
var allDefaults: Highcharts.SolidGaugeChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.SolidGaugeChartSeriesOptions = {};
|
||||
|
||||
// partial solid gauge demo
|
||||
var gaugeOptions: Highcharts.Options = {
|
||||
const gaugeOptions: Highcharts.Options = {
|
||||
chart: {
|
||||
type: 'solidgauge'
|
||||
},
|
||||
@@ -1880,10 +1876,10 @@ function test_SolidGauge() {
|
||||
}
|
||||
|
||||
function test_TreeMap() {
|
||||
var allDefaults: Highcharts.TreeMapChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.TreeMapChartSeriesOptions = {};
|
||||
|
||||
// allowDrillToNode
|
||||
var treeMap: Highcharts.TreeMapChartSeriesOptions = {
|
||||
const treeMap: Highcharts.TreeMapChartSeriesOptions = {
|
||||
type: "treemap",
|
||||
layoutAlgorithm: 'squarified',
|
||||
allowDrillToNode: true,
|
||||
@@ -1932,10 +1928,10 @@ function test_TreeMap() {
|
||||
}
|
||||
|
||||
function test_Waterfall() {
|
||||
var allDefaults: Highcharts.WaterFallChartSeriesOptions = {};
|
||||
const allDefaults: Highcharts.WaterFallChartSeriesOptions = {};
|
||||
|
||||
// partial waterfall demo
|
||||
var series: Highcharts.WaterFallChartSeriesOptions = {
|
||||
const series: Highcharts.WaterFallChartSeriesOptions = {
|
||||
upColor: Highcharts.getOptions().colors[2],
|
||||
color: Highcharts.getOptions().colors[3],
|
||||
data: [{
|
||||
@@ -1964,7 +1960,7 @@ function test_Waterfall() {
|
||||
}],
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
formatter: function () {
|
||||
formatter() {
|
||||
return Highcharts.numberFormat(this.y / 1000, 0, ',') + 'k';
|
||||
},
|
||||
style: {
|
||||
@@ -1978,9 +1974,9 @@ function test_Waterfall() {
|
||||
}
|
||||
|
||||
function test_AxisOptions() {
|
||||
var allDefaults: Highcharts.AxisOptions = {};
|
||||
const allDefaults: Highcharts.AxisOptions = {};
|
||||
|
||||
var axis: Highcharts.AxisOptions = {
|
||||
const axis: Highcharts.AxisOptions = {
|
||||
allowDecimals: false,
|
||||
alternateGridColor: '#000000',
|
||||
breaks: [{
|
||||
@@ -2014,7 +2010,7 @@ function test_AxisOptions() {
|
||||
distance: 10,
|
||||
enabled: true,
|
||||
format: "format",
|
||||
formatter: function () { return this.value; },
|
||||
formatter() { return this.value; },
|
||||
maxStaggerLines: 5,
|
||||
overflow: false,
|
||||
padding: 10,
|
||||
@@ -2133,7 +2129,7 @@ function test_AxisOptions() {
|
||||
}
|
||||
|
||||
function test_AxisObject() {
|
||||
var axis = $("#container").highcharts().xAxis[0];
|
||||
const axis = $("#container").highcharts().xAxis[0];
|
||||
axis.addPlotBand({
|
||||
from: 5.5,
|
||||
to: 7.5,
|
||||
@@ -2148,7 +2144,7 @@ function test_AxisObject() {
|
||||
id: 'plot-line-1'
|
||||
});
|
||||
axis.removePlotLine('plot-line-1');
|
||||
var extremes = axis.getExtremes();
|
||||
const extremes = axis.getExtremes();
|
||||
console.log('dataMax: ' + extremes.dataMax + '<br/> ' +
|
||||
'dataMin: ' + extremes.dataMin + '<br/> ' +
|
||||
'max: ' + extremes.max + '<br/> ' +
|
||||
@@ -2173,7 +2169,7 @@ function test_AxisObject() {
|
||||
}
|
||||
|
||||
function test_ChartObject() {
|
||||
var chart = $("#container").highcharts();
|
||||
const chart = $("#container").highcharts();
|
||||
chart.addAxis(<Highcharts.AxisOptions> {});
|
||||
chart.addAxis(<Highcharts.AxisOptions> {}, true);
|
||||
chart.addAxis(<Highcharts.AxisOptions> {}, true, false);
|
||||
@@ -2184,25 +2180,25 @@ function test_ChartObject() {
|
||||
chart.addSeries(<Highcharts.IndividualSeriesOptions> {}, false, false);
|
||||
chart.addSeries(<Highcharts.IndividualSeriesOptions> {}, false, { duration: 50 });
|
||||
chart.addSeriesAsDrilldown(<Highcharts.PointObject> {}, <Highcharts.IndividualSeriesOptions> {});
|
||||
var container = chart.container;
|
||||
const container = chart.container;
|
||||
console.log(container.id);
|
||||
chart.destroy();
|
||||
chart.drillUp();
|
||||
chart.exportChart(<Highcharts.ExportingOptions> {}, <Highcharts.Options> {});
|
||||
chart.exportChartLocal(<Highcharts.ExportingOptions> {}, <Highcharts.Options> {});
|
||||
var object = chart.get('axisIdOrSeriesIdOrPointId');
|
||||
var svg1 = chart.getSVG();
|
||||
var svg2 = chart.getSVG(<Highcharts.Options> {});
|
||||
var selectedPoints = chart.getSelectedPoints();
|
||||
var selectedSeries = chart.getSelectedSeries();
|
||||
const object = chart.get('axisIdOrSeriesIdOrPointId');
|
||||
const svg1 = chart.getSVG();
|
||||
const svg2 = chart.getSVG(<Highcharts.Options> {});
|
||||
const selectedPoints = chart.getSelectedPoints();
|
||||
const selectedSeries = chart.getSelectedSeries();
|
||||
chart.hideLoading();
|
||||
var options = chart.options;
|
||||
const options = chart.options;
|
||||
chart.print();
|
||||
chart.redraw();
|
||||
chart.redraw(false);
|
||||
chart.redraw({ duration: 50, easing: 'fadeIn' });
|
||||
chart.reflow();
|
||||
var series = chart.series;
|
||||
const series = chart.series;
|
||||
chart.setSize(200, 200);
|
||||
chart.setSize(200, 200, false);
|
||||
chart.setSize(200, 200, { duration: 50 });
|
||||
@@ -2210,14 +2206,14 @@ function test_ChartObject() {
|
||||
chart.setTitle({}, {}, false);
|
||||
chart.showLoading();
|
||||
chart.showLoading("Loading label");
|
||||
var firstXAxis = chart.xAxis[0];
|
||||
var firstYAxis = chart.yAxis[0];
|
||||
var legend = chart.legend;
|
||||
const firstXAxis = chart.xAxis[0];
|
||||
const firstYAxis = chart.yAxis[0];
|
||||
const legend = chart.legend;
|
||||
}
|
||||
|
||||
function test_ElementObject() {
|
||||
var renderer = new Highcharts.Renderer($("#container")[0], 400, 400);
|
||||
var group = renderer.g().add();
|
||||
const renderer = new Highcharts.Renderer($("#container")[0], 400, 400);
|
||||
const group = renderer.g().add();
|
||||
renderer
|
||||
.circle(200, 150, 100)
|
||||
.attr({
|
||||
@@ -2226,7 +2222,7 @@ function test_ElementObject() {
|
||||
'stroke-width': 1
|
||||
})
|
||||
.add(group);
|
||||
var rect = renderer
|
||||
const rect = renderer
|
||||
.rect(90, 150, 100, 100, 5)
|
||||
.attr({
|
||||
fill: '#C5FFC5',
|
||||
@@ -2242,7 +2238,7 @@ function test_ElementObject() {
|
||||
'stroke-width': 10
|
||||
});
|
||||
rect.destroy();
|
||||
var styledText = renderer
|
||||
const styledText = renderer
|
||||
.text('Series 1', 140, 140)
|
||||
.attr({
|
||||
rotation: -25
|
||||
@@ -2252,15 +2248,15 @@ function test_ElementObject() {
|
||||
fontSize: '16px'
|
||||
})
|
||||
.add();
|
||||
var bbox = styledText.getBBox();
|
||||
const bbox = styledText.getBBox();
|
||||
styledText.on('click', () => { });
|
||||
group.toFront();
|
||||
}
|
||||
|
||||
function test_PointObject() {
|
||||
var point = <Highcharts.PointObject> $('#container').highcharts().get('point1');
|
||||
var category = point.category;
|
||||
var percentage = point.percentage;
|
||||
const point = <Highcharts.PointObject> $('#container').highcharts().get('point1');
|
||||
const category = point.category;
|
||||
const percentage = point.percentage;
|
||||
point.index;
|
||||
point.remove();
|
||||
point.remove(false);
|
||||
@@ -2268,26 +2264,26 @@ function test_PointObject() {
|
||||
point.select();
|
||||
point.select(false);
|
||||
point.select(false, true);
|
||||
var isSelected = point.selected;
|
||||
var series = point.series;
|
||||
const isSelected = point.selected;
|
||||
const series = point.series;
|
||||
point.slice();
|
||||
point.slice(false);
|
||||
point.slice(false, false);
|
||||
point.slice(false, false, false);
|
||||
point.slice(false, false, { duration: 50 });
|
||||
var total = point.total;
|
||||
const total = point.total;
|
||||
point.update(0);
|
||||
point.update([0, 0]);
|
||||
point.update({});
|
||||
point.update({}, false);
|
||||
point.update({}, false, false);
|
||||
point.update({}, false, { duration: 50 });
|
||||
var x = point.x;
|
||||
var y = point.y;
|
||||
const x = point.x;
|
||||
const y = point.y;
|
||||
}
|
||||
|
||||
function test_RendererObject() {
|
||||
var renderer = $('#container').highcharts().renderer;
|
||||
const renderer = $('#container').highcharts().renderer;
|
||||
renderer.arc(0, 0, 20, 10, 0, Math.PI);
|
||||
renderer.circle(0, 0, 100);
|
||||
renderer.g('groupName');
|
||||
@@ -2299,7 +2295,7 @@ function test_RendererObject() {
|
||||
}
|
||||
|
||||
function test_SeriesObject() {
|
||||
var series = <Highcharts.SeriesObject> $('#container').highcharts().get('series1');
|
||||
const series = <Highcharts.SeriesObject> $('#container').highcharts().get('series1');
|
||||
series.addPoint(0);
|
||||
series.addPoint([0, 0]);
|
||||
series.addPoint({});
|
||||
@@ -2307,11 +2303,11 @@ function test_SeriesObject() {
|
||||
series.addPoint({}, false, true);
|
||||
series.addPoint({}, false, true, false);
|
||||
series.addPoint({}, false, true, { duration: 50 });
|
||||
var chart = series.chart;
|
||||
var data = series.data;
|
||||
const chart = series.chart;
|
||||
const data = series.data;
|
||||
series.hide();
|
||||
var name = series.name;
|
||||
var options = series.options;
|
||||
const name = series.name;
|
||||
const options = series.options;
|
||||
series.remove();
|
||||
series.remove(false);
|
||||
series.removePoint(0);
|
||||
@@ -2320,7 +2316,7 @@ function test_SeriesObject() {
|
||||
series.removePoint(0, false, { duration: 50 });
|
||||
series.select();
|
||||
series.select(true);
|
||||
var isSelected = series.selected;
|
||||
const isSelected = series.selected;
|
||||
series.setData([0, 1, 2]);
|
||||
series.setData([[0, 0], [1, 1], [2, 2]]);
|
||||
series.setData([{}, {}, {}]);
|
||||
@@ -2332,15 +2328,15 @@ function test_SeriesObject() {
|
||||
series.setVisible(true);
|
||||
series.setVisible(true, false);
|
||||
series.show();
|
||||
var type = series.type;
|
||||
const type = series.type;
|
||||
series.update({});
|
||||
series.update({}, false);
|
||||
var visible = series.visible;
|
||||
var xAxis = series.xAxis;
|
||||
var yAxis = series.yAxis;
|
||||
const visible = series.visible;
|
||||
const xAxis = series.xAxis;
|
||||
const yAxis = series.yAxis;
|
||||
}
|
||||
function test_LegendObject() {
|
||||
var legend = $('#container').highcharts().legend;
|
||||
const legend = $('#container').highcharts().legend;
|
||||
legend.update({});
|
||||
legend.update({}, false);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
function test_NoDataToDisplay() {
|
||||
var chart = $("#container").highcharts();
|
||||
var chartHasData = chart.hasData();
|
||||
const chart = $("#container").highcharts();
|
||||
const chartHasData = chart.hasData();
|
||||
chart.hideNoData();
|
||||
chart.showNoData("Custom no data message");
|
||||
}
|
||||
|
||||
HighchartsNoDataToDisplay(Highcharts);
|
||||
HighchartsNoDataToDisplay(Highcharts);
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
declare function htmlescape(o: any): string;
|
||||
declare namespace htmlescape {
|
||||
export function sanitize(s: string): string;
|
||||
function sanitize(s: string): string;
|
||||
}
|
||||
|
||||
export = htmlescape;
|
||||
|
||||
Vendored
+62
-62
@@ -3,65 +3,65 @@
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export declare const ACCEPTED: number;
|
||||
export declare const ALREADY_REPORTED: number;
|
||||
export declare const BAD_GATEWAY: number;
|
||||
export declare const BAD_REQUEST: number;
|
||||
export declare const BANDWIDTH_LIMIT_EXCEEDED: number;
|
||||
export declare const CONFLICT: number;
|
||||
export declare const CONTINUE: number;
|
||||
export declare const CREATED: number;
|
||||
export declare const EXPECTATION_FAILED: number;
|
||||
export declare const FAILED_DEPENDENCY: number;
|
||||
export declare const FORBIDDEN: number;
|
||||
export declare const FOUND: number;
|
||||
export declare const GATEWAY_TIMEOUT: number;
|
||||
export declare const GONE: number;
|
||||
export declare const HTTP_VERSION_NOT_SUPPORTED: number;
|
||||
export declare const IM_A_TEAPOT: number;
|
||||
export declare const IM_USED: number;
|
||||
export declare const INSUFFICIENT_STORAGE: number;
|
||||
export declare const INTERNAL_SERVER_ERROR: number;
|
||||
export declare const LENGTH_REQUIRED: number;
|
||||
export declare const LOCKED: number;
|
||||
export declare const LOOP_DETECTED: number;
|
||||
export declare const METHOD_NOT_ALLOWED: number;
|
||||
export declare const MISDIRECTED_REQUEST: number;
|
||||
export declare const MOVED_PERMANENTLY: number;
|
||||
export declare const MULTIPLE_CHOICES: number;
|
||||
export declare const MULTI_STATUS: number;
|
||||
export declare const NETWORK_AUTHENTICATION_REQUIRED: number;
|
||||
export declare const NON_AUTHORITATIVE_INFORMATION: number;
|
||||
export declare const NOT_ACCEPTABLE: number;
|
||||
export declare const NOT_EXTENDED: number;
|
||||
export declare const NOT_FOUND: number;
|
||||
export declare const NOT_IMPLEMENTED: number;
|
||||
export declare const NOT_MODIFIED: number;
|
||||
export declare const NO_CONTENT: number;
|
||||
export declare const OK: number;
|
||||
export declare const PARTIAL_CONTENT: number;
|
||||
export declare const PAYLOAD_TOO_LARGE: number;
|
||||
export declare const PAYMENT_REQUIRED: number;
|
||||
export declare const PERMANENT_REDIRECT: number;
|
||||
export declare const PRECONDITION_FAILED: number;
|
||||
export declare const PRECONDITION_REQUIRED: number;
|
||||
export declare const PROCESSING: number;
|
||||
export declare const PROXY_AUTHENTICATION_REQUIRED: number;
|
||||
export declare const RANGE_NOT_SATISFIABLE: number;
|
||||
export declare const REQUEST_HEADER_FIELDS_TOO_LARGE: number;
|
||||
export declare const REQUEST_TIMEOUT: number;
|
||||
export declare const RESET_CONTENT: number;
|
||||
export declare const SEE_OTHER: number;
|
||||
export declare const SERVICE_UNAVAILABLE: number;
|
||||
export declare const SWITCHING_PROTOCOLS: number;
|
||||
export declare const TEMPORARY_REDIRECT: number;
|
||||
export declare const TOO_MANY_REQUESTS: number;
|
||||
export declare const UNAUTHORIZED: number;
|
||||
export declare const UNAVAILABLE_FOR_LEGAL_REASONS: number;
|
||||
export declare const UNORDERED_COLLECTION: number;
|
||||
export declare const UNPROCESSABLE_ENTITY: number;
|
||||
export declare const UNSUPPORTED_MEDIA_TYPE: number;
|
||||
export declare const UPGRADE_REQUIRED: number;
|
||||
export declare const URI_TOO_LONG: number;
|
||||
export declare const USE_PROXY: number;
|
||||
export declare const VARIANT_ALSO_NEGOTIATES: number;
|
||||
export const ACCEPTED: number;
|
||||
export const ALREADY_REPORTED: number;
|
||||
export const BAD_GATEWAY: number;
|
||||
export const BAD_REQUEST: number;
|
||||
export const BANDWIDTH_LIMIT_EXCEEDED: number;
|
||||
export const CONFLICT: number;
|
||||
export const CONTINUE: number;
|
||||
export const CREATED: number;
|
||||
export const EXPECTATION_FAILED: number;
|
||||
export const FAILED_DEPENDENCY: number;
|
||||
export const FORBIDDEN: number;
|
||||
export const FOUND: number;
|
||||
export const GATEWAY_TIMEOUT: number;
|
||||
export const GONE: number;
|
||||
export const HTTP_VERSION_NOT_SUPPORTED: number;
|
||||
export const IM_A_TEAPOT: number;
|
||||
export const IM_USED: number;
|
||||
export const INSUFFICIENT_STORAGE: number;
|
||||
export const INTERNAL_SERVER_ERROR: number;
|
||||
export const LENGTH_REQUIRED: number;
|
||||
export const LOCKED: number;
|
||||
export const LOOP_DETECTED: number;
|
||||
export const METHOD_NOT_ALLOWED: number;
|
||||
export const MISDIRECTED_REQUEST: number;
|
||||
export const MOVED_PERMANENTLY: number;
|
||||
export const MULTIPLE_CHOICES: number;
|
||||
export const MULTI_STATUS: number;
|
||||
export const NETWORK_AUTHENTICATION_REQUIRED: number;
|
||||
export const NON_AUTHORITATIVE_INFORMATION: number;
|
||||
export const NOT_ACCEPTABLE: number;
|
||||
export const NOT_EXTENDED: number;
|
||||
export const NOT_FOUND: number;
|
||||
export const NOT_IMPLEMENTED: number;
|
||||
export const NOT_MODIFIED: number;
|
||||
export const NO_CONTENT: number;
|
||||
export const OK: number;
|
||||
export const PARTIAL_CONTENT: number;
|
||||
export const PAYLOAD_TOO_LARGE: number;
|
||||
export const PAYMENT_REQUIRED: number;
|
||||
export const PERMANENT_REDIRECT: number;
|
||||
export const PRECONDITION_FAILED: number;
|
||||
export const PRECONDITION_REQUIRED: number;
|
||||
export const PROCESSING: number;
|
||||
export const PROXY_AUTHENTICATION_REQUIRED: number;
|
||||
export const RANGE_NOT_SATISFIABLE: number;
|
||||
export const REQUEST_HEADER_FIELDS_TOO_LARGE: number;
|
||||
export const REQUEST_TIMEOUT: number;
|
||||
export const RESET_CONTENT: number;
|
||||
export const SEE_OTHER: number;
|
||||
export const SERVICE_UNAVAILABLE: number;
|
||||
export const SWITCHING_PROTOCOLS: number;
|
||||
export const TEMPORARY_REDIRECT: number;
|
||||
export const TOO_MANY_REQUESTS: number;
|
||||
export const UNAUTHORIZED: number;
|
||||
export const UNAVAILABLE_FOR_LEGAL_REASONS: number;
|
||||
export const UNORDERED_COLLECTION: number;
|
||||
export const UNPROCESSABLE_ENTITY: number;
|
||||
export const UNSUPPORTED_MEDIA_TYPE: number;
|
||||
export const UPGRADE_REQUIRED: number;
|
||||
export const URI_TOO_LONG: number;
|
||||
export const USE_PROXY: number;
|
||||
export const VARIANT_ALSO_NEGOTIATES: number;
|
||||
|
||||
Vendored
+1
-1
@@ -84,5 +84,5 @@ declare class MockAjax {
|
||||
}
|
||||
|
||||
declare namespace jasmine {
|
||||
export var Ajax: MockAjax;
|
||||
const Ajax: MockAjax;
|
||||
}
|
||||
|
||||
+113
-117
@@ -5,12 +5,11 @@
|
||||
|
||||
/// <reference types="jasmine" />
|
||||
|
||||
|
||||
declare function getJasmineRequireObj();
|
||||
|
||||
describe('StubTracker', () => {
|
||||
beforeEach(() => {
|
||||
var Constructor = getJasmineRequireObj().AjaxStubTracker();
|
||||
const Constructor = getJasmineRequireObj().AjaxStubTracker();
|
||||
this.tracker = new Constructor();
|
||||
});
|
||||
|
||||
@@ -19,21 +18,21 @@ describe('StubTracker', () => {
|
||||
});
|
||||
|
||||
it('finds an added stub', () => {
|
||||
var stub = { matches: () => true };
|
||||
const stub = { matches: () => true };
|
||||
this.tracker.addStub(stub);
|
||||
|
||||
expect(this.tracker.findStub()).toBe(stub);
|
||||
});
|
||||
|
||||
it('skips an added stub that does not match', () => {
|
||||
var stub = { matches: () => false };
|
||||
const stub = { matches: () => false };
|
||||
this.tracker.addStub(stub);
|
||||
|
||||
expect(this.tracker.findStub()).toBeUndefined();
|
||||
});
|
||||
|
||||
it('passes url, data, and method to the stub', () => {
|
||||
var stub = { matches: jasmine.createSpy('matches') };
|
||||
const stub = { matches: jasmine.createSpy('matches') };
|
||||
this.tracker.addStub(stub);
|
||||
|
||||
this.tracker.findStub('url', 'data', 'method');
|
||||
@@ -42,7 +41,7 @@ describe('StubTracker', () => {
|
||||
});
|
||||
|
||||
it('can clear out all stubs', () => {
|
||||
var stub = { matches: jasmine.createSpy('matches') };
|
||||
const stub = { matches: jasmine.createSpy('matches') };
|
||||
this.tracker.addStub(stub);
|
||||
|
||||
this.tracker.findStub();
|
||||
@@ -58,9 +57,9 @@ describe('StubTracker', () => {
|
||||
});
|
||||
|
||||
it('uses the most recently added stub that matches', () => {
|
||||
var stub1 = { matches: () => true };
|
||||
var stub2 = { matches: () => false };
|
||||
var stub3 = { matches: () => false };
|
||||
const stub1 = { matches: () => true };
|
||||
const stub2 = { matches: () => false };
|
||||
const stub3 = { matches: () => false };
|
||||
|
||||
this.tracker.addStub(stub1);
|
||||
this.tracker.addStub(stub2);
|
||||
@@ -74,9 +73,9 @@ describe('FakeRequest', () => {
|
||||
beforeEach(() => {
|
||||
this.requestTracker = { track: jasmine.createSpy('trackRequest') };
|
||||
this.stubTracker = { findStub() { } };
|
||||
var parserInstance = this.parserInstance = jasmine.createSpy('parse');
|
||||
const parserInstance = this.parserInstance = jasmine.createSpy('parse');
|
||||
this.paramParser = { findParser: () => ({ parse: parserInstance }) };
|
||||
var eventBus = this.fakeEventBus = {
|
||||
const eventBus = this.fakeEventBus = {
|
||||
addEventListener: jasmine.createSpy('addEventListener'),
|
||||
trigger: jasmine.createSpy('trigger'),
|
||||
removeEventListener: jasmine.createSpy('removeEventListener')
|
||||
@@ -95,15 +94,15 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('extends from the global XMLHttpRequest', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
expect(request.extraAttribute).toEqual('my cool attribute');
|
||||
});
|
||||
|
||||
it('skips XMLHttpRequest attributes that IE does not want copied', () => {
|
||||
// use real window here so it will correctly go red on IE if it breaks
|
||||
var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser);
|
||||
var request = new FakeRequest();
|
||||
const FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser);
|
||||
const request = new FakeRequest();
|
||||
|
||||
expect(request.responseBody).toBeUndefined();
|
||||
expect(request.responseXML).toBeUndefined();
|
||||
@@ -111,20 +110,20 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('tracks the request', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
expect(this.requestTracker.track).toHaveBeenCalledWith(request);
|
||||
});
|
||||
|
||||
it('has default request headers and override mime type', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
expect(request.requestHeaders).toEqual({});
|
||||
expect(request.overriddenMimeType).toBeNull();
|
||||
});
|
||||
|
||||
it('saves request information when opened', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD');
|
||||
|
||||
expect(request.method).toEqual('METHOD');
|
||||
@@ -134,7 +133,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('saves an override mime type', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
request.overrideMimeType('application/text; charset: utf-8');
|
||||
|
||||
@@ -142,7 +141,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('saves request headers', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
request.setRequestHeader('X-Header-1', 'value1');
|
||||
request.setRequestHeader('X-Header-2', 'value2');
|
||||
@@ -154,7 +153,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('combines request headers with the same header name', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
request.setRequestHeader('X-Header', 'value1');
|
||||
request.setRequestHeader('X-Header', 'value2');
|
||||
@@ -163,7 +162,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('finds the content-type request header', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
request.setRequestHeader('ContEnt-tYPe', 'application/text+xml');
|
||||
|
||||
@@ -248,9 +247,9 @@ describe('FakeRequest', () => {
|
||||
this.request.send();
|
||||
this.fakeEventBus.trigger.calls.reset();
|
||||
|
||||
var request = this.request;
|
||||
var events = [];
|
||||
var headers = [
|
||||
const request = this.request;
|
||||
const events = [];
|
||||
const headers = [
|
||||
{ name: 'X-Header', value: 'foo' }
|
||||
];
|
||||
|
||||
@@ -284,7 +283,7 @@ describe('FakeRequest', () => {
|
||||
this.request.open();
|
||||
this.request.send();
|
||||
this.request.respondWith({});
|
||||
var request = this.request;
|
||||
const request = this.request;
|
||||
|
||||
expect(() => {
|
||||
request.responseTimeout();
|
||||
@@ -295,7 +294,7 @@ describe('FakeRequest', () => {
|
||||
this.request.open();
|
||||
this.request.send();
|
||||
this.request.respondWith({});
|
||||
var request = this.request;
|
||||
const request = this.request;
|
||||
|
||||
expect(() => {
|
||||
request.respondWith({});
|
||||
@@ -306,7 +305,7 @@ describe('FakeRequest', () => {
|
||||
this.request.open();
|
||||
this.request.send();
|
||||
this.request.respondWith({});
|
||||
var request = this.request;
|
||||
const request = this.request;
|
||||
|
||||
expect(() => {
|
||||
request.responseError({});
|
||||
@@ -335,7 +334,7 @@ describe('FakeRequest', () => {
|
||||
this.request.ontimeout = jasmine.createSpy('timeout');
|
||||
this.request.onloadend = jasmine.createSpy('loadend');
|
||||
|
||||
var args = this.fakeEventBus.addEventListener.calls.allArgs();
|
||||
const args = this.fakeEventBus.addEventListener.calls.allArgs();
|
||||
for (const [eventName, busCallback] of args) {
|
||||
busCallback();
|
||||
expect(this.request['on' + eventName]).toHaveBeenCalled();
|
||||
@@ -462,10 +461,10 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('ticks the jasmine clock on timeout', () => {
|
||||
var clock = { tick: jasmine.createSpy('tick') };
|
||||
const clock = { tick: jasmine.createSpy('tick') };
|
||||
spyOn(jasmine, 'clock').and.returnValue(clock);
|
||||
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -475,13 +474,13 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('has an initial status of null', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
expect(request.status).toBeNull();
|
||||
});
|
||||
|
||||
it('has an aborted status', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
|
||||
request.abort();
|
||||
|
||||
@@ -490,7 +489,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('has a status from the response', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -501,7 +500,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('has a statusText from the response', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -512,7 +511,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('saves off any data sent to the server', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send('foo=bar&baz=quux');
|
||||
|
||||
@@ -520,7 +519,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('parses data sent to the server', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send('foo=bar&baz=quux');
|
||||
|
||||
@@ -530,7 +529,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('skips parsing if no data was sent', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -539,7 +538,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('saves responseText', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -549,7 +548,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('defaults responseText if none is given', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -559,7 +558,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('retrieves individual response headers', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -574,7 +573,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('retrieves individual response headers case-insensitively', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -589,7 +588,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('retrieves a combined response header', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -605,11 +604,11 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it("doesn't pollute the response headers of other XHRs", () => {
|
||||
var request1 = new this.FakeRequest();
|
||||
const request1 = new this.FakeRequest();
|
||||
request1.open();
|
||||
request1.send();
|
||||
|
||||
var request2 = new this.FakeRequest();
|
||||
const request2 = new this.FakeRequest();
|
||||
request2.open();
|
||||
request2.send();
|
||||
|
||||
@@ -621,7 +620,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('retrieves all response headers', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -638,7 +637,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('sets the content-type header to the specified contentType when no other headers are supplied', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -649,7 +648,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('sets a default content-type header if no contentType and headers are supplied', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -660,7 +659,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('has no responseXML by default', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -670,7 +669,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('parses a text/xml document into responseXML', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -687,7 +686,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('parses an application/xml document into responseXML', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -704,7 +703,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('parses a custom blah+xml document into responseXML', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -721,7 +720,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('defaults the response attribute to the responseText', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -731,7 +730,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('has a text response when the responseType is blank', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -741,7 +740,7 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
|
||||
it('has a text response when the responseType is text', () => {
|
||||
var request = new this.FakeRequest();
|
||||
const request = new this.FakeRequest();
|
||||
request.open();
|
||||
request.send();
|
||||
|
||||
@@ -751,16 +750,15 @@ describe('FakeRequest', () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
var request, anotherRequest, response;
|
||||
var success, error, complete;
|
||||
var client, onreadystatechange;
|
||||
var sharedContext: any = {};
|
||||
var fakeGlobal, mockAjax;
|
||||
let request, anotherRequest, response;
|
||||
let success, error, complete;
|
||||
let client, onreadystatechange;
|
||||
const sharedContext: any = {};
|
||||
let fakeGlobal, mockAjax;
|
||||
|
||||
beforeEach(() => {
|
||||
var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest');
|
||||
const fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest');
|
||||
fakeGlobal = {
|
||||
XMLHttpRequest: fakeXMLHttpRequest,
|
||||
DOMParser: window['DOMParser'],
|
||||
@@ -832,7 +830,6 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
});
|
||||
|
||||
describe("mockAjax.requests.mostRecent()", () => {
|
||||
|
||||
describe("when there is one request queued", () => {
|
||||
it("should return the request", () => {
|
||||
expect(mockAjax.requests.mostRecent()).toEqual(request);
|
||||
@@ -921,7 +918,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json" };
|
||||
const responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json" };
|
||||
|
||||
request.respondWith(responseObject);
|
||||
|
||||
@@ -948,7 +945,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
});
|
||||
|
||||
it("should return a JavaScript object for XHR2 response", () => {
|
||||
var responseText = sharedContext.responseText;
|
||||
const responseText = sharedContext.responseText;
|
||||
expect(success.calls.mostRecent().args[0]).toEqual(responseText);
|
||||
|
||||
expect(response.responseText).toEqual(responseText);
|
||||
@@ -967,7 +964,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json' };
|
||||
const responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json' };
|
||||
|
||||
request.respondWith(responseObject);
|
||||
|
||||
@@ -982,7 +979,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
});
|
||||
|
||||
it("should return the provided override for the XHR2 response", () => {
|
||||
var responseText = sharedContext.responseText;
|
||||
const responseText = sharedContext.responseText;
|
||||
|
||||
expect(response.responseText).toEqual(responseText);
|
||||
expect(response.response).toEqual({ foo: "bar" });
|
||||
@@ -999,7 +996,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
var responseObject = {
|
||||
const responseObject = {
|
||||
status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: {
|
||||
'X-Header1': 'header 1 value',
|
||||
'X-Header2': 'header 2 value',
|
||||
@@ -1033,7 +1030,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
var responseObject = {
|
||||
const responseObject = {
|
||||
status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [
|
||||
{ name: 'X-Header', value: 'header value 1' },
|
||||
{ name: 'X-Header', value: 'header value 2' }
|
||||
@@ -1201,10 +1198,9 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function sharedAjaxResponseBehaviorForZepto_Success(context) {
|
||||
describe("the success response", () => {
|
||||
var xhr;
|
||||
let xhr;
|
||||
beforeEach(() => {
|
||||
xhr = context.responseCallback.calls.mostRecent().args[2];
|
||||
});
|
||||
@@ -1218,7 +1214,7 @@ function sharedAjaxResponseBehaviorForZepto_Success(context) {
|
||||
});
|
||||
|
||||
it("should have the expected xhr2 response", () => {
|
||||
var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText;
|
||||
const expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText;
|
||||
expect(xhr.response).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -1234,7 +1230,7 @@ function sharedAjaxResponseBehaviorForZepto_Success(context) {
|
||||
|
||||
function sharedAjaxResponseBehaviorForZepto_Failure(context) {
|
||||
describe("the failure response", () => {
|
||||
var xhr;
|
||||
let xhr;
|
||||
beforeEach(() => {
|
||||
xhr = context.responseCallback.calls.mostRecent().args[0];
|
||||
});
|
||||
@@ -1248,7 +1244,7 @@ function sharedAjaxResponseBehaviorForZepto_Failure(context) {
|
||||
});
|
||||
|
||||
it("should have the expected xhr2 response", () => {
|
||||
var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText;
|
||||
const expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText;
|
||||
expect(xhr.response).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -1264,13 +1260,13 @@ function sharedAjaxResponseBehaviorForZepto_Failure(context) {
|
||||
|
||||
describe('ParamParser', () => {
|
||||
beforeEach(() => {
|
||||
var Constructor = getJasmineRequireObj().AjaxParamParser();
|
||||
const Constructor = getJasmineRequireObj().AjaxParamParser();
|
||||
expect(Constructor).toEqual(jasmine.any(Function));
|
||||
this.parser = new Constructor();
|
||||
});
|
||||
|
||||
it('has a default parser', () => {
|
||||
var parser = this.parser.findParser({ contentType: () => { } }),
|
||||
const parser = this.parser.findParser({ contentType: () => { } }),
|
||||
parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely');
|
||||
|
||||
expect(parsed).toEqual({
|
||||
@@ -1280,7 +1276,7 @@ describe('ParamParser', () => {
|
||||
});
|
||||
|
||||
it('should detect and parse json', () => {
|
||||
var data = {
|
||||
const data = {
|
||||
foo: 'bar',
|
||||
baz: ['q', 'u', 'u', 'x'],
|
||||
nested: {
|
||||
@@ -1296,7 +1292,7 @@ describe('ParamParser', () => {
|
||||
});
|
||||
|
||||
it('should parse json with further qualifiers on content-type', () => {
|
||||
var data = {
|
||||
const data = {
|
||||
foo: 'bar',
|
||||
baz: ['q', 'u', 'u', 'x'],
|
||||
nested: {
|
||||
@@ -1312,14 +1308,14 @@ describe('ParamParser', () => {
|
||||
});
|
||||
|
||||
it('should have custom parsers take precedence', () => {
|
||||
var custom = {
|
||||
const custom = {
|
||||
test: jasmine.createSpy('test').and.returnValue(true),
|
||||
parse: jasmine.createSpy('parse').and.returnValue('parsedFormat')
|
||||
};
|
||||
|
||||
this.parser.add(custom);
|
||||
|
||||
var parser = this.parser.findParser({ contentType: () => { } }),
|
||||
const parser = this.parser.findParser({ contentType: () => { } }),
|
||||
parsed = parser.parse('custom_format');
|
||||
|
||||
expect(parsed).toEqual('parsedFormat');
|
||||
@@ -1328,14 +1324,14 @@ describe('ParamParser', () => {
|
||||
});
|
||||
|
||||
it('should skip custom parsers that do not match', () => {
|
||||
var custom = {
|
||||
const custom = {
|
||||
test: jasmine.createSpy('test').and.returnValue(false),
|
||||
parse: jasmine.createSpy('parse').and.returnValue('parsedFormat')
|
||||
};
|
||||
|
||||
this.parser.add(custom);
|
||||
|
||||
var parser = this.parser.findParser({ contentType: () => { } }),
|
||||
const parser = this.parser.findParser({ contentType: () => { } }),
|
||||
parsed = parser.parse('custom_format');
|
||||
|
||||
expect(parsed).toEqual({ custom_format: ['undefined'] });
|
||||
@@ -1344,14 +1340,14 @@ describe('ParamParser', () => {
|
||||
});
|
||||
|
||||
it('removes custom parsers when reset', () => {
|
||||
var custom = {
|
||||
const custom = {
|
||||
test: jasmine.createSpy('test').and.returnValue(true),
|
||||
parse: jasmine.createSpy('parse').and.returnValue('parsedFormat')
|
||||
};
|
||||
|
||||
this.parser.add(custom);
|
||||
|
||||
var parser = this.parser.findParser({ contentType: () => { } }),
|
||||
let parser = this.parser.findParser({ contentType: () => { } }),
|
||||
parsed = parser.parse('custom_format');
|
||||
|
||||
expect(parsed).toEqual('parsedFormat');
|
||||
@@ -1389,31 +1385,31 @@ describe('RequestStub', () => {
|
||||
});
|
||||
|
||||
it('matches just by exact url', () => {
|
||||
var stub = new this.RequestStub('www.example.com/foo');
|
||||
const stub = new this.RequestStub('www.example.com/foo');
|
||||
|
||||
expect(stub)['toMatchRequest']('www.example.com/foo');
|
||||
});
|
||||
|
||||
it('does not match if the url differs', () => {
|
||||
var stub = new this.RequestStub('www.example.com/foo');
|
||||
const stub = new this.RequestStub('www.example.com/foo');
|
||||
|
||||
expect(stub).not['toMatchRequest']('www.example.com/bar');
|
||||
});
|
||||
|
||||
it('matches unordered query params', () => {
|
||||
var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux');
|
||||
const stub = new this.RequestStub('www.example.com?foo=bar&baz=quux');
|
||||
|
||||
expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar');
|
||||
});
|
||||
|
||||
it('requires all specified query params to be there', () => {
|
||||
var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux');
|
||||
const stub = new this.RequestStub('www.example.com?foo=bar&baz=quux');
|
||||
|
||||
expect(stub).not['toMatchRequest']('www.example.com?foo=bar');
|
||||
});
|
||||
|
||||
it('can match the url with a RegExp', () => {
|
||||
var stub = new this.RequestStub(/ba[rz]/);
|
||||
const stub = new this.RequestStub(/ba[rz]/);
|
||||
|
||||
expect(stub)['toMatchRequest']('bar');
|
||||
expect(stub)['toMatchRequest']('baz');
|
||||
@@ -1421,7 +1417,7 @@ describe('RequestStub', () => {
|
||||
});
|
||||
|
||||
it('requires the method to match if supplied', () => {
|
||||
var stub = new this.RequestStub('www.example.com/foo', null, 'POST');
|
||||
const stub = new this.RequestStub('www.example.com/foo', null, 'POST');
|
||||
|
||||
expect(stub).not['toMatchRequest']('www.example.com/foo');
|
||||
expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET');
|
||||
@@ -1429,7 +1425,7 @@ describe('RequestStub', () => {
|
||||
});
|
||||
|
||||
it('requires the data submitted to match if supplied', () => {
|
||||
var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux');
|
||||
const stub = new this.RequestStub('/foo', 'foo=bar&baz=quux');
|
||||
|
||||
expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar');
|
||||
expect(stub).not['toMatchRequest']('/foo', 'foo=bar');
|
||||
@@ -1438,7 +1434,7 @@ describe('RequestStub', () => {
|
||||
|
||||
describe('RequestTracker', () => {
|
||||
beforeEach(() => {
|
||||
var Constructor = getJasmineRequireObj().AjaxRequestTracker();
|
||||
const Constructor = getJasmineRequireObj().AjaxRequestTracker();
|
||||
this.tracker = new Constructor();
|
||||
});
|
||||
|
||||
@@ -1511,7 +1507,7 @@ describe('RequestTracker', () => {
|
||||
this.tracker.track({ url: 'bar' });
|
||||
this.tracker.track({ url: 'baz' });
|
||||
|
||||
var func = request => request.url === 'bar';
|
||||
const func = request => request.url === 'bar';
|
||||
|
||||
expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]);
|
||||
});
|
||||
@@ -1527,7 +1523,7 @@ describe('EventBus', () => {
|
||||
});
|
||||
|
||||
it('calls an event listener', () => {
|
||||
var callback = jasmine.createSpy('callback');
|
||||
const callback = jasmine.createSpy('callback');
|
||||
|
||||
this.bus.addEventListener('foo', callback);
|
||||
this.bus.trigger('foo');
|
||||
@@ -1536,7 +1532,7 @@ describe('EventBus', () => {
|
||||
});
|
||||
|
||||
it('calls an event listener with additional arguments', () => {
|
||||
var callback = jasmine.createSpy('callback');
|
||||
const callback = jasmine.createSpy('callback');
|
||||
|
||||
this.bus.addEventListener('foo', callback);
|
||||
this.bus.trigger('foo', 'bar');
|
||||
@@ -1545,7 +1541,7 @@ describe('EventBus', () => {
|
||||
});
|
||||
|
||||
it('only triggers callbacks for the specified event', () => {
|
||||
var fooCallback = jasmine.createSpy('foo'),
|
||||
const fooCallback = jasmine.createSpy('foo'),
|
||||
barCallback = jasmine.createSpy('bar');
|
||||
|
||||
this.bus.addEventListener('foo', fooCallback);
|
||||
@@ -1558,8 +1554,8 @@ describe('EventBus', () => {
|
||||
});
|
||||
|
||||
it('calls all the callbacks for the specified event', () => {
|
||||
var callback1 = jasmine.createSpy('callback');
|
||||
var callback2 = jasmine.createSpy('otherCallback');
|
||||
const callback1 = jasmine.createSpy('callback');
|
||||
const callback2 = jasmine.createSpy('otherCallback');
|
||||
|
||||
this.bus.addEventListener('foo', callback1);
|
||||
this.bus.addEventListener('foo', callback2);
|
||||
@@ -1571,14 +1567,14 @@ describe('EventBus', () => {
|
||||
});
|
||||
|
||||
it('works if there are no callbacks for the event', () => {
|
||||
var bus = this.bus;
|
||||
const bus = this.bus;
|
||||
expect(() => {
|
||||
bus.trigger('notActuallyThere');
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('does not call listeners that have been removed', () => {
|
||||
var callback = jasmine.createSpy('callback');
|
||||
const callback = jasmine.createSpy('callback');
|
||||
|
||||
this.bus.addEventListener('foo', callback);
|
||||
this.bus.removeEventListener('foo', callback);
|
||||
@@ -1588,8 +1584,8 @@ describe('EventBus', () => {
|
||||
});
|
||||
|
||||
it('only removes the specified callback', () => {
|
||||
var callback1 = jasmine.createSpy('callback');
|
||||
var callback2 = jasmine.createSpy('otherCallback');
|
||||
const callback1 = jasmine.createSpy('callback');
|
||||
const callback2 = jasmine.createSpy('otherCallback');
|
||||
|
||||
this.bus.addEventListener('foo', callback1);
|
||||
this.bus.addEventListener('foo', callback2);
|
||||
@@ -1603,12 +1599,12 @@ describe('EventBus', () => {
|
||||
});
|
||||
|
||||
describe("Webmock style mocking", () => {
|
||||
var successSpy, errorSpy, response, fakeGlobal, mockAjax;
|
||||
let successSpy, response, fakeGlobal, mockAjax;
|
||||
|
||||
var sendRequest = function(fakeGlobal, url?, method?) {
|
||||
const sendRequest = function(fakeGlobal, url?, method?) {
|
||||
url = url || "http://example.com/someApi";
|
||||
method = method || 'GET';
|
||||
var xhr = new fakeGlobal.XMLHttpRequest();
|
||||
const xhr = new fakeGlobal.XMLHttpRequest();
|
||||
xhr.onreadystatechange = args => {
|
||||
if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE
|
||||
response = this;
|
||||
@@ -1681,15 +1677,15 @@ describe("Webmock style mocking", () => {
|
||||
});
|
||||
|
||||
describe("withMock", () => {
|
||||
var sendRequest = fakeGlobal => {
|
||||
var xhr = new fakeGlobal.XMLHttpRequest();
|
||||
const sendRequest = fakeGlobal => {
|
||||
const xhr = new fakeGlobal.XMLHttpRequest();
|
||||
|
||||
xhr.open("GET", "http://example.com/someApi");
|
||||
xhr.send();
|
||||
};
|
||||
|
||||
it("installs the mock for passed in function, and uninstalls when complete", () => {
|
||||
var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']),
|
||||
const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']),
|
||||
xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest),
|
||||
fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
@@ -1704,7 +1700,7 @@ describe("withMock", () => {
|
||||
});
|
||||
|
||||
it("properly uninstalls when the passed in function throws", () => {
|
||||
var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']),
|
||||
const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']),
|
||||
xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest),
|
||||
fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
@@ -1722,7 +1718,7 @@ describe("withMock", () => {
|
||||
|
||||
describe("mockAjax", () => {
|
||||
it("throws an error if installed multiple times", () => {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
|
||||
@@ -1735,7 +1731,7 @@ describe("mockAjax", () => {
|
||||
});
|
||||
|
||||
it("does not throw an error if uninstalled between installs", () => {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
|
||||
@@ -1749,7 +1745,7 @@ describe("mockAjax", () => {
|
||||
});
|
||||
|
||||
it("does not replace XMLHttpRequest until it is installed", () => {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
|
||||
@@ -1763,7 +1759,7 @@ describe("mockAjax", () => {
|
||||
});
|
||||
|
||||
it("replaces the global XMLHttpRequest on uninstall", () => {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
|
||||
@@ -1775,7 +1771,7 @@ describe("mockAjax", () => {
|
||||
});
|
||||
|
||||
it("clears requests and stubs upon uninstall", () => {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
|
||||
@@ -1794,24 +1790,24 @@ describe("mockAjax", () => {
|
||||
});
|
||||
|
||||
it("allows the httpRequest to be retrieved", () => {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
|
||||
mockAjax.install();
|
||||
var request = new (<any> fakeGlobal.XMLHttpRequest)();
|
||||
const request = new (<any> fakeGlobal.XMLHttpRequest)();
|
||||
|
||||
expect(mockAjax.requests.count()).toBe(1);
|
||||
expect(mockAjax.requests.mostRecent()).toBe(request);
|
||||
});
|
||||
|
||||
it("allows the httpRequests to be cleared", () => {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new MockAjax(fakeGlobal);
|
||||
|
||||
mockAjax.install();
|
||||
var request = new (<any> fakeGlobal.XMLHttpRequest)();
|
||||
const request = new (<any> fakeGlobal.XMLHttpRequest)();
|
||||
|
||||
expect(mockAjax.requests.mostRecent()).toBe(request);
|
||||
mockAjax.requests.reset();
|
||||
|
||||
Vendored
+1
-1
@@ -65,7 +65,7 @@ declare namespace create {
|
||||
};
|
||||
}
|
||||
|
||||
export interface JenkinsPromisifiedAPI {
|
||||
interface JenkinsPromisifiedAPI {
|
||||
info(): Promise<any>;
|
||||
build: {
|
||||
get(name: string, n: number): Promise<any>;
|
||||
|
||||
@@ -20,7 +20,7 @@ jenkins.build.log('example', 1, (err, data) => {
|
||||
console.log('log', data);
|
||||
});
|
||||
|
||||
var log = jenkins.build.logStream('example', 1);
|
||||
const log = jenkins.build.logStream('example', 1);
|
||||
|
||||
log.on('data', (text: string) => {
|
||||
process.stdout.write(text);
|
||||
@@ -202,4 +202,4 @@ jenkins.view.remove('example', 'jobExample', (err) => {
|
||||
|
||||
const jenkins2 = J({ baseUrl: 'http://user:pass@localhost:8080', crumbIssuer: true, promisify: true });
|
||||
jenkins2.info().then(info => console.log(info));
|
||||
jenkins2.job.exists('example').then(exists => { var b: boolean = exists; });
|
||||
jenkins2.job.exists('example').then(exists => { const b: boolean = exists; });
|
||||
|
||||
Vendored
+4
-4
@@ -7,21 +7,21 @@
|
||||
declare const JsonFileStore: JsonFileStore.JsonFileStore;
|
||||
|
||||
declare namespace JsonFileStore {
|
||||
export interface Storable {
|
||||
interface Storable {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
interface Options {
|
||||
type?: 'single' | 'memory';
|
||||
pretty?: boolean;
|
||||
saveId?: boolean | string;
|
||||
}
|
||||
|
||||
export interface JsonFileStore {
|
||||
interface JsonFileStore {
|
||||
new <T extends Storable>(name?: string, opts?: Options): Instance<T>;
|
||||
}
|
||||
|
||||
export interface Instance<T> {
|
||||
interface Instance<T> {
|
||||
save<K extends keyof T, V extends T[K]>(id: K, o: V, cb?: (err?: Error, id?: K) => void): void;
|
||||
save<V extends T[keyof T]>(o: V, cb?: (err?: Error, id?: string) => void): void;
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ db.all((err, objs) => {
|
||||
});
|
||||
|
||||
// get all synchronously
|
||||
var objs = db.allSync();
|
||||
const objs = db.allSync();
|
||||
|
||||
// delete by ID
|
||||
db.delete('foo', err => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import jmespath = require("jmespath");
|
||||
|
||||
const a = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar.baz[2]");
|
||||
const b = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar")
|
||||
const c = jmespath.search({"foo": [{"first": "a", "last": "b"}, {"first": "c", "last": "d"}]}, "foo[*].first");
|
||||
const d = jmespath.search({"foo": [{"age": 20}, {"age": 25}, {"age": 30}, {"age": 35}, {"age": 40}]}, "foo[?age > `30`]");
|
||||
const b = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar");
|
||||
const c = jmespath.search({foo: [{first: "a", last: "b"}, {first: "c", last: "d"}]}, "foo[*].first");
|
||||
const d = jmespath.search({foo: [{age: 20}, {age: 25}, {age: 30}, {age: 35}, {age: 40}]}, "foo[?age > `30`]");
|
||||
|
||||
Vendored
+1
-4
@@ -6,7 +6,6 @@
|
||||
/// <reference types="jquery" />
|
||||
|
||||
declare namespace jQueryMask {
|
||||
|
||||
interface Invalid {
|
||||
p: number;
|
||||
v: string;
|
||||
@@ -42,11 +41,9 @@ declare namespace jQueryMask {
|
||||
[key: string]: Pattern | {} | undefined;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
|
||||
/**
|
||||
* Applies the mask to the matching selector elements.
|
||||
* @param mask should be a string or a function.
|
||||
@@ -72,4 +69,4 @@ interface JQuery {
|
||||
* @returns Masked value.
|
||||
*/
|
||||
masked(value: string): string;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user