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 ef164164cf..abbb14db0f 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -1,9 +1,9 @@ -// 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 -// Last module patch version validated against: 1.0.2 +// Last module patch version validated against: 1.1 // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces @@ -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,16 +304,15 @@ 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 */ @@ -340,7 +339,7 @@ export interface Selection, priority?: null | 'important'): this; @@ -367,7 +366,7 @@ export interface Selection): this; /** @@ -423,7 +422,7 @@ export interface Selection): this; @@ -449,16 +448,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 +472,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 +484,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 +505,12 @@ export interface Selection( @@ -572,7 +574,7 @@ export interface Selection): Selection; @@ -584,7 +586,7 @@ export interface Selection(selector: ValueFn): Selection; @@ -639,7 +641,7 @@ export interface Selection(value: ValueFn): Selection; @@ -659,7 +661,7 @@ export interface Selection): this; @@ -810,11 +812,11 @@ export interface Selection): this; @@ -970,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 // --------------------------------------------------------------------------- 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; 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