From dc28f3d89c59dc3c16135b56282d14876b9de2aa Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Tue, 16 May 2017 12:43:26 -0400 Subject: [PATCH 1/5] [d3-selection] Update comments * captures comment updates from patch releases 1.0.3 to 1.0.6 --- types/d3-selection/index.d.ts | 69 ++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index ef164164cf..08daf8b0c5 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3-selection module 1.0 +// Type definitions for D3JS d3-selection module 1.1 // Project: https://github.com/d3/d3-selection/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -194,7 +194,7 @@ export interface Selection(selector: ValueFn): Selection; @@ -241,7 +241,7 @@ export interface Selection(selector: ValueFn>): Selection; @@ -276,7 +276,7 @@ export interface Selection): this; @@ -304,7 +304,7 @@ export interface Selection): this; @@ -340,7 +340,7 @@ export interface Selection, priority?: null | 'important'): this; @@ -367,7 +367,7 @@ export interface Selection): this; /** @@ -423,7 +423,7 @@ export interface Selection): this; @@ -449,16 +449,17 @@ export interface Selection): this; /** - * Appends a new element of the specified type (tag name) as the last child of each selected element, or the next - * following sibling in the update selection if this is an enter selection. - * (The enter behavior allows you to insert elements into the DOM in an order consistent with bound data; - * however, the slower selection.order may still be required if updating elements change order.) + * Appends a new element of this type (tag name) as the last child of each selected element, + * or before the next following sibling in the update selection if this is an enter selection. + * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; + * however, note that selection.order may still be required if updating elements change order + * (i.e., if the order of new data is inconsistent with old data). * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -472,10 +473,11 @@ export interface Selection(type: string): Selection; /** - * Appends a new element of the type provided by the element creator function as the last child of each selected element, - * or the next following sibling in the update selection if this is an enter selection. - * (The enter behavior allows you to insert elements into the DOM in an order consistent with bound data; - * however, the slower selection.order may still be required if updating elements change order.) + * Appends a new element of the type provided by the element creator functionas the last child of each selected element, + * or before the next following sibling in the update selection if this is an enter selection. + * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; + * however, note that selection.order may still be required if updating elements change order + * (i.e., if the order of new data is inconsistent with old data). * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -483,14 +485,15 @@ export interface Selection(type: ValueFn): Selection; /** - * Inserts a new element of the specified type (tag name) before the element matching the specified "before" - * selector string for each selected element. + * Inserts a new element of the specified type (tag name) before the first element matching the specified + * before selector for each selected element. For example, a before selector :first-child will prepend nodes before the first child. + * If before is not specified, it defaults to null. (To append elements in an order consistent with bound data, use selection.append.) * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -503,12 +506,12 @@ export interface Selection( @@ -572,7 +575,7 @@ export interface Selection): Selection; @@ -584,7 +587,7 @@ export interface Selection(selector: ValueFn): Selection; @@ -639,7 +642,7 @@ export interface Selection(value: ValueFn): Selection; @@ -659,7 +662,7 @@ export interface Selection): this; @@ -810,11 +813,11 @@ export interface Selection): this; From 256816065c2b38714bd3f2da20c85081d6cff53a Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:01:39 -0400 Subject: [PATCH 2/5] [d3-selection] Update to 1.1 * [FEATURE] Update JSDoc comments for `Selection.style(...)` to reflecgt new behavior * [FEATURE] Add `d3.style(...)` standalone function. --- types/d3-selection/d3-selection-tests.ts | 7 +++++++ types/d3-selection/index.d.ts | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index 0b2dec77c2..baae76bad2 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -1036,6 +1036,13 @@ positions = d3Selection.touches(svg, changedTouches); positions = d3Selection.touches(g, changedTouches); positions = d3Selection.touches(h, changedTouches); +// --------------------------------------------------------------------------------------- +// Tests of style +// --------------------------------------------------------------------------------------- + +declare let n: Element; +str = d3Selection.style(n, 'opacity'); + // --------------------------------------------------------------------------------------- // Tests of Local // --------------------------------------------------------------------------------------- diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index 08daf8b0c5..2b61695abd 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -310,10 +310,9 @@ export interface Selection): this; /** - * Returns the current computed value of the specified style for the first (non-null) element in the selection. - * This is generally useful only if you know that the selection contains exactly one element. - * The computed value may be different than the previously-set value, particularly if it was set using a - * shorthand property (such as the font style, which is shorthand for font-size, font-face, etc.). + * Returns the current value of the specified style property for the first (non-null) element in the selection. + * The current value is defined as the element’s inline value, if present, and otherwise its computed value. + * Accessing the current style value is generally useful only if you know the selection contains exactly one element. * * @param name Name of the style */ @@ -973,6 +972,20 @@ export function touch(container: ContainerElement, touches: TouchList, identifie */ export function touches(container: ContainerElement, touches?: TouchList): Array<[number, number]>; +// --------------------------------------------------------------------------- +// style +// --------------------------------------------------------------------------- + +/** + * Returns the value of the style property with the specified name for the specified node. + * If the node has an inline style with the specified name, its value is returned; otherwise, the computed property value is returned. + * See also selection.style. + * + * @param node A DOM node (e.g. HTMLElement, SVGElement) for which to retrieve the style property. + * @param name Style property name. + */ +export function style(node: Element, name: string): string; + // --------------------------------------------------------------------------- // local.js related // --------------------------------------------------------------------------- From a870cb6d5f2bb38525b889efd7342617d0d2a08e Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:02:54 -0400 Subject: [PATCH 3/5] [d3-selection] * [Chore] Update last validated version comment --- types/d3-selection/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index 2b61695abd..abbb14db0f 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.2 +// Last module patch version validated against: 1.1 // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces From 739fe57f0bac39b5a018ae95683c6177373142a9 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:17:18 -0400 Subject: [PATCH 4/5] [d3-transition] Update to 1.1 * [FEATURE] Update JSDoc comments to reflect new style transition behavior. * [CHORE] Clarify some JSDoc comments --- types/d3-transition/index.d.ts | 44 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/types/d3-transition/index.d.ts b/types/d3-transition/index.d.ts index 58c8fd4063..1ff8d46d04 100644 --- a/types/d3-transition/index.d.ts +++ b/types/d3-transition/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-transition module 1.0 +// Type definitions for D3JS d3-transition module 1.1 // Project: https://github.com/d3/d3-transition/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.3 +// Last module patch version validated against: 1.1 import { ArrayLike, BaseType, Selection, ValueFn } from 'd3-selection'; @@ -110,7 +110,7 @@ export interface Transition(selector: ValueFn): Transition; @@ -135,7 +135,7 @@ export interface Transition(selector: ValueFn>): Transition; @@ -194,7 +194,7 @@ export interface Transition): this; @@ -221,7 +221,7 @@ export interface Transition string>): this; @@ -234,8 +234,9 @@ export interface Transition): this; @@ -348,7 +350,7 @@ export interface Transition void>): this; @@ -397,7 +399,7 @@ export interface Transition): Transition; @@ -411,7 +413,7 @@ export interface Transition(filter: ValueFn): Transition; @@ -448,7 +450,7 @@ export interface Transition): this; @@ -457,11 +459,11 @@ export interface Transition): this; @@ -513,7 +515,7 @@ export interface Transition): this; @@ -535,7 +537,7 @@ export interface Transition): this; From 373a3b98e31a2c4af7b1960ddc471dc0695c466d Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:20:54 -0400 Subject: [PATCH 5/5] [d3] Bump to version 4.9 --- types/d3/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3/index.d.ts b/types/d3/index.d.ts index 29d4a7c861..8bb0ae6bd8 100644 --- a/types/d3/index.d.ts +++ b/types/d3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3 standard bundle 4.8 +// Type definitions for D3JS d3 standard bundle 4.9 // Project: https://github.com/d3/d3 // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped