From 9e49d5aa0ef5a33084dc2301c921535da4ba1ea7 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 20 Jul 2016 17:42:42 -0400 Subject: [PATCH] Temporarily remove d3-collection and d3-force. These two modules are temporarily removed from this branch so that, the pull-request for the other release candidate definitions cum tests can be submitted as a pull request. They will be resubmitted in a follow-up, once completed. --- d3-collection/d3-collection-tests.ts | 59 ---------- d3-collection/index.d.ts | 75 ------------- d3-collection/tsconfig.json | 19 ---- d3-force/d3-force-tests.ts | 126 --------------------- d3-force/index.d.ts | 158 --------------------------- d3-force/tsconfig.json | 19 ---- 6 files changed, 456 deletions(-) delete mode 100644 d3-collection/d3-collection-tests.ts delete mode 100644 d3-collection/index.d.ts delete mode 100644 d3-collection/tsconfig.json delete mode 100644 d3-force/d3-force-tests.ts delete mode 100644 d3-force/index.d.ts delete mode 100644 d3-force/tsconfig.json diff --git a/d3-collection/d3-collection-tests.ts b/d3-collection/d3-collection-tests.ts deleted file mode 100644 index 7b31f14a1d..0000000000 --- a/d3-collection/d3-collection-tests.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Typescript definition tests for d3/d3-collection module - * - * Note: These tests are intended to test the definitions only - * in the sense of typing and call signature consistency. They - * are not intended as functional tests. - */ - -import * as d3Collection from 'd3-collection'; - -// Preparatory steps -------------------------------------------------------------- - -let keyValueObj = { - a: 'test', - b: 123, - c: [true, true, false] -}; - -let keyValueObj2 = { - a: 'test', - b: 'same', - c: 'type' -}; - -let stringArray: string[], - anyArray: any[], - stringKVArray: Array<{key: string, value: string}>, - anyKVArray: Array<{key: string, value: any}>; - - -// test keys(...) signatures ------------------------------------------------------ - -stringArray = d3Collection.keys(keyValueObj); - -stringArray = d3Collection.keys(document); // purely for the fun of it - -// test values(...) signatures ------------------------------------------------------ - -anyArray = d3Collection.values(keyValueObj); -// stringArray = d3Collection.values(keyValueObj); // test fails, as values in keyValueObj are not all strings - -stringArray = d3Collection.values(keyValueObj2); -stringArray = d3Collection.values(keyValueObj2); - -anyArray = d3Collection.values(document); // purely for the fun of it - -// test entries(...) signatures ------------------------------------------------------ - -anyKVArray = d3Collection.entries(keyValueObj); -// stringKVArray = d3Collection.entres(keyValueObj); // test fails, as values in keyValueObj are not all strings - -stringKVArray = d3Collection.entries(keyValueObj2); -stringKVArray = d3Collection.entries(keyValueObj2); - -anyKVArray = d3Collection.entries(document); // purely for the fun of it - -// test D3Map signatures ------------------------------------------------------------ - -let map1: d3Collection.D3Map; \ No newline at end of file diff --git a/d3-collection/index.d.ts b/d3-collection/index.d.ts deleted file mode 100644 index 0b8db43df9..0000000000 --- a/d3-collection/index.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -// Type definitions for D3JS d3-collection module -// Project: https://github.com/d3/d3-collection/ -// Definitions by: Alex Ford , Boris Yankov , Tom Wanzek -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/** - * Reference type things that can be coerced to string implicitely - */ -type Stringifiable = { - toString(): string; -}; - - -export function keys(object: { [key: string]: any }): Array; -export function keys(object: Object): Array; - -export function values(object: { [key: string]: T }): Array; -export function values(object: Object): Array; - -export function entries(object: { [key: string]: T }): Array<{ key: string, value: T }>; -export function entries(object: Object): Array<{ key: string, value: any }>; - -export interface D3Map { - has(key: string): boolean; - get(key: string): any; - set(key: string, value: T): D3Map; - remove(key: string): boolean; - clear(): void; - keys(): Array; - values(): Array; - entries(): Array<{ key: string, value: T }>; - each(func: (value: T, key: string, map: D3Map) => void): undefined; - empty(): boolean; - size(): number; -} - -export function map(): D3Map; -export function map(d3Map: D3Map): D3Map; -export function map(array: Array, key?: (value: T, i?: number, array?: Array) => string): D3Map; -export function map(object: Object): D3Map; - - -export interface D3Set { - has(value: T): boolean; - add(value: T): D3Set; - remove(value: T): boolean; - clear(): void; - values(): Array; - /** - * The first and second parameter of the function are both passed - * the 'value' of the set entry for consistency with map.each(...) - * signature - */ - each(func: (value: string, valueRepeat: string, set: D3Set) => void): undefined; - empty(): boolean; - size(): number; -} - - -export function set(): D3Set; -export function set(d3Set: D3Set): D3Set; -export function set(array: Array, key?: (value: T) => string): D3Set; - - -interface D3Nest { - key(func: (datum: T) => string): D3Nest; - sortKeys(comparator: (a: string, b: string) => number): D3Nest; - sortValues(comparator: (a: T, b: T) => number): D3Nest; - rollup(func: (values: T[]) => U): D3Nest; - map(array: T[]): D3Map; - object(array: T[]): { [key: string]: any}; - entries(array: T[]): { key: string; values: any }[]; -} - -export function nest(): D3Nest; diff --git a/d3-collection/tsconfig.json b/d3-collection/tsconfig.json deleted file mode 100644 index d73566e5e9..0000000000 --- a/d3-collection/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-collection-tests.ts" - ] -} \ No newline at end of file diff --git a/d3-force/d3-force-tests.ts b/d3-force/d3-force-tests.ts deleted file mode 100644 index 315ac28af7..0000000000 --- a/d3-force/d3-force-tests.ts +++ /dev/null @@ -1,126 +0,0 @@ -// /** -// * Typescript definition tests for d3/d3-force module -// * -// * Note: These tests are intended to test the definitions only -// * in the sense of typing and call signature consistency. They -// * are not intended as functional tests. -// */ - -// import * as d3Select from 'd3-selection'; -// import { -// forceCenter, -// ForceCenter, -// forceLink, -// ForceLink, -// forceManyBody, -// ForceManyBody, -// forceSimulation, -// Simulation, -// SimulationLinkDatum, -// SimulationNodeDatum -// } from 'd3-force'; - -// import * as d3Drag from 'd3-drag'; - -// interface SimNode extends SimulationNodeDatum { -// id: string; -// group: number; - -// } - -// interface SimLink extends SimulationLinkDatum { -// value: number; -// } - -// interface Graph { -// nodes: Array; -// links: Array; -// } - - -// let canvas = document.querySelector("canvas"), -// context = canvas.getContext("2d"), -// width = canvas.width, -// height = canvas.height; - -// let simulation = forceSimulation() -// .force("link", forceLink().id(function (d) { return d.id; })) -// .force("charge", forceManyBody()) -// .force("center", forceCenter(width / 2, height / 2)); - - -// let graph: Graph = { -// nodes: [ -// { "id": "Myriel", "group": 1 }, -// { "id": "Napoleon", "group": 1 }, -// { "id": "Mlle.Baptistine", "group": 1 }, -// { "id": "Mme.Magloire", "group": 1 }, -// { "id": "CountessdeLo", "group": 1 } -// ], -// links: [ -// { "source": "Napoleon", "target": "Myriel", "value": 1 }, -// { "source": "Mlle.Baptistine", "target": "Myriel", "value": 8 }, -// { "source": "Mme.Magloire", "target": "Myriel", "value": 10 }, -// { "source": "Mme.Magloire", "target": "Mlle.Baptistine", "value": 6 } -// ] -// }; - - -// simulation -// .nodes(graph.nodes) -// .on("tick", function ticked() { -// context.clearRect(0, 0, width, height); - -// context.beginPath(); -// graph.links.forEach(drawLink); -// context.strokeStyle = "#aaa"; -// context.stroke(); - -// context.beginPath(); -// graph.nodes.forEach(drawNode); -// context.fill(); -// context.strokeStyle = "#fff"; -// context.stroke(); -// }); - -// (>simulation.force("link")) -// .links(graph.links); - -// d3Select.select(canvas) -// .call(d3Drag.drag() -// .container(canvas) -// .subject(dragsubject) -// .on("start", dragstarted) -// .on("drag", dragged) -// .on("end", dragended) -// ); - - -// function dragsubject() { -// return simulation.find(d3Select.event.x, d3Select.event.y); -// } - - -// function dragstarted() { -// if (!d3Select.event.active) simulation.alphaTarget(0.3).restart() -// simulation.fix(d3.event.subject); -// } - -// function dragged() { -// simulation.fix(d3.event.subject, d3Select.event.x, d3Select.event.y); -// } - -// function dragended() { -// if (!d3Select.event.active) simulation.alphaTarget(0); -// simulation.unfix(d3Select.event.subject); -// } - -// function drawLink(d: SimLink) { -// context.moveTo(d.source.x, d.source.y); -// context.lineTo(d.target.x, d.target.y); -// } - -// function drawNode(d: SimLink) { -// context.moveTo(d.x + 3, d.y); -// context.arc(d.x, d.y, 3, 0, 2 * Math.PI); -// } \ No newline at end of file diff --git a/d3-force/index.d.ts b/d3-force/index.d.ts deleted file mode 100644 index 5057f24f9f..0000000000 --- a/d3-force/index.d.ts +++ /dev/null @@ -1,158 +0,0 @@ -// Type definitions for D3JS d3-force module -// Project: https://github.com/d3/d3-force/ -// Definitions by: Alex Ford , Boris Yankov , Tom Wanzek -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -// ----------------------------------------------------------------------- -// Force Simulation -// ----------------------------------------------------------------------- - -// TODO: Review below: fx and fy should be optional as a matter of principle. The other properties, are optional prior to initialization, but once the -// the nodes array is passed into the simulation, will be initialized. -export interface SimulationNodeDatum { - // NB: index is assigned internally by simulation, once initialized it is defined - index?: number; - x?: number; - y?: number; - vx?: number; - vy?: number; - fx?: number; - fy?: number; -} - -export interface SimulationLinkDatum { - // TODO: Strictly speaking, the string or number typing of source and target is only used when (re)initializing links - // Once initialized, links' source and target fields will be of type NodeDatum - source: NodeDatum | string | number; - target: NodeDatum | string | number; - // NB: index is assigned internally by force, once initialized it is defined - index?: number; -} - -export interface Simulation> { - restart(): Simulation; - stop(): Simulation; - tick(): Simulation; - nodes(): Array; - nodes(nodesData: Array): Simulation; - alpha(): number; - alpha(alpha: number): Simulation; - alphaMin(): number; - alphaMin(min: number): Simulation; - alphaDecay(): number; - alphaDecay(decay: number): Simulation; - alphaTarget(): number; - alphaTarget(target: number): Simulation; - velocityDecay(): number; - velocityDecay(decay: number): Simulation; - force(name: string): Force; - force(name: string, force: Force): Simulation; - find(x: number, y: number, radius?: number): NodeDatum | undefined; - on(typenames: 'tick' | 'end' | string): (this: Simulation) => void; - on(typenames: 'tick' | 'end' | string, listener: null): Simulation; - on(typenames: 'tick' | 'end' | string, listener: (this: this) => void): Simulation; -} - -export function forceSimulation(nodesData?: Array): Simulation; -export function forceSimulation>(nodesData?: Array): Simulation; - -// ---------------------------------------------------------------------- -// Forces -// ---------------------------------------------------------------------- - - -export interface Force> { - (alpha: number): void; - initialize(nodes: Array): void; -} - - -// Centering ------------------------------------------------------------ - -export interface ForceCenter extends Force { - x(): number; - x(x: number): ForceCenter; - y(): number; - y(y: number): ForceCenter; -} - -export function forceCenter(x?: number, y?: number): ForceCenter; - -// Collision ------------------------------------------------------------ - -export interface ForceCollide extends Force { - radius(): (node: NodeDatum, i: number, nodes: Array) => number; - radius(radius: number): ForceCollide; - radius(radius: (node: NodeDatum, i?: number, nodes?: Array) => number): ForceCollide; - strength(): number; - strength(strength: number): ForceCollide; - iterations(): number; - iterations(iterations: number): ForceCollide; -} - -export function forceCollide(): ForceCollide; -export function forceCollide(radius: number): ForceCollide; -export function forceCollide(radius: (node: NodeDatum, i: number, nodes: Array) => number): ForceCollide; - -// Link ---------------------------------------------------------------- - -export interface ForceLink> extends Force { - links(): Array; - links(links: Array): ForceLink; - id(): (d: NodeDatum, i: number, nodesData: Array) => (string | number); - id(id: (d: NodeDatum, i?: number, nodesData?: Array) => string): ForceLink; - distance(): (d: LinkDatum, i: number, linksData: Array) => number; - distance(distance: (d: LinkDatum, i: number, linksData: Array) => number): ForceLink; - strength(): (d: LinkDatum, i: number, linksData: Array) => number; - strength(strength: (d: LinkDatum, i: number, linksData: Array) => number): ForceLink; - iterations(): number; - iterations(iterations: number): ForceLink; -} - -export function forceLink>(): ForceLink; -export function forceLink>(linksData: Array): ForceLink; - -// Many Body ---------------------------------------------------------------- - -export interface ForceManyBody extends Force { - strength(): (d: NodeDatum, i: number, data: Array) => number; - strength(strength: number): ForceManyBody; - strength(strength: (d: NodeDatum, i: number, data: Array) => number): ForceManyBody; - theta(): number; - theta(theta: number): ForceManyBody; - distanceMin(): number; - distanceMin(distance: number): ForceManyBody; - distanceMax(): number; - distanceMax(distance: number): ForceManyBody; -} - -export function forceManyBody(): ForceManyBody; - -// Positioning ---------------------------------------------------------------- - -export interface ForcePositionX extends Force { - strength(): (d: NodeDatum, i: number, data: Array) => number; - strength(strength: number): ForcePositionX; - strength(strength: (d: NodeDatum, i: number, data: Array) => number): ForcePositionX; - x(): (d: NodeDatum, i: number, data: Array) => number; - x(x: number): ForcePositionX; - x(x: (d: NodeDatum, i: number, data: Array) => number): ForcePositionX; -} - -export function forceX(): ForcePositionX; -export function forceX(x: number): ForcePositionX; -export function forceX(x: (d: NodeDatum, i: number, data: Array) => number): ForcePositionX; - -export interface ForcePositionY extends Force { - strength(): (d: NodeDatum, i: number, data: Array) => number; - strength(strength: number): ForcePositionY; - strength(strength: (d: NodeDatum, i: number, data: Array) => number): ForcePositionY; - y(): (d: NodeDatum, i: number, data: Array) => number; - y(y: number): ForcePositionY; - y(y: (d: NodeDatum, i: number, data: Array) => number): ForcePositionY; -} - -export function forceY(): ForcePositionY; -export function forceY(y: number): ForcePositionY; -export function forceY(y: (d: NodeDatum, i: number, data: Array) => number): ForcePositionY; diff --git a/d3-force/tsconfig.json b/d3-force/tsconfig.json deleted file mode 100644 index 82b666c6cd..0000000000 --- a/d3-force/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-force-tests.ts" - ] -} \ No newline at end of file