mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
Merge pull request #16589 from tomwanzek/d3-selection-transition-1-1
[d3-selection/d3-transition] Update to version 1.1
This commit is contained in:
@@ -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
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
92
types/d3-selection/index.d.ts
vendored
92
types/d3-selection/index.d.ts
vendored
@@ -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 <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// 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<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* The generic represents the type of the descendant element to be selected.
|
||||
*
|
||||
* @param selector A selector function, which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* It must return an element, or null if there is no matching element.
|
||||
*/
|
||||
select<DescElement extends BaseType>(selector: ValueFn<GElement, Datum, DescElement>): Selection<DescElement, Datum, PElement, PDatum>;
|
||||
@@ -241,7 +241,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.
|
||||
*
|
||||
* @param selector A selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. It must return an array of elements
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). It must return an array of elements
|
||||
* (or a pseudo-array, such as a NodeList), or the empty array if there are no matching elements.
|
||||
*/
|
||||
selectAll<DescElement extends BaseType, OldDatum>(selector: ValueFn<GElement, Datum, DescElement[] | ArrayLike<DescElement>>): Selection<DescElement, OldDatum, GElement, Datum>;
|
||||
@@ -276,7 +276,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*
|
||||
* @param name Name of the attribute
|
||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. A null value will clear the attribute.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). A null value will clear the attribute.
|
||||
*/
|
||||
attr(name: string, value: ValueFn<GElement, Datum, string | number | boolean | null>): this;
|
||||
|
||||
@@ -304,16 +304,15 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*
|
||||
* @param names A string of space-separated class names.
|
||||
* @param value A value function which is evaluated for each selected element, in order,
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* The function’s return value is then used to assign or unassign classes on each element.
|
||||
*/
|
||||
classed(names: string, value: ValueFn<GElement, Datum, boolean>): 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<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*
|
||||
* @param name Name of the style
|
||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. A null value will clear the style.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). A null value will clear the style.
|
||||
* @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
||||
*/
|
||||
style(name: string, value: ValueFn<GElement, Datum, string | number | boolean | null>, priority?: null | 'important'): this;
|
||||
@@ -367,7 +366,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*
|
||||
* @param name Name of the property
|
||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. A null value will clear the property.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). A null value will clear the property.
|
||||
*/
|
||||
property(name: string, value: ValueFn<GElement, Datum, any>): this;
|
||||
/**
|
||||
@@ -423,7 +422,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* All elements are given the same text content.
|
||||
*
|
||||
* @param value A value unction which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* The function’s return value is then used to set each element’s text content. A null value will clear the content.
|
||||
*/
|
||||
text(value: ValueFn<GElement, Datum, string | number | boolean | null>): this;
|
||||
@@ -449,16 +448,17 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* The inner HTML is determined for each individual element using a value function.
|
||||
*
|
||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current
|
||||
* datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* The function’s return value is then used to set each element’s inner HTML. A null value will clear the content.
|
||||
*/
|
||||
html(value: ValueFn<GElement, Datum, string | null>): 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<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*/
|
||||
append<ChildElement extends BaseType>(type: string): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
/**
|
||||
* 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<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* The generic refers to the type of the child element to be appended.
|
||||
*
|
||||
* @param type A creator function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return
|
||||
* an element to be appended. (The function typically creates a new element, but it may instead return an existing element.)
|
||||
*/
|
||||
append<ChildElement extends BaseType>(type: ValueFn<GElement, Datum, ChildElement>): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
|
||||
/**
|
||||
* 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<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used
|
||||
* (for example, svg implies svg:svg)
|
||||
* * A creator function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return
|
||||
* an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.)
|
||||
* @param before One of:
|
||||
* * A CSS selector string for the element before which the insertion should occur.
|
||||
* * A child selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return the child element
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return the child element
|
||||
* before which the element should be inserted.
|
||||
*/
|
||||
insert<ChildElement extends BaseType>(
|
||||
@@ -572,7 +574,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
||||
*
|
||||
* @param selector A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return true
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return true
|
||||
* for an element to be included, and false otherwise.
|
||||
*/
|
||||
filter(selector: ValueFn<GElement, Datum, boolean>): Selection<GElement, Datum, PElement, PDatum>;
|
||||
@@ -584,7 +586,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
||||
*
|
||||
* @param selector A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return true
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return true
|
||||
* for an element to be included, and false otherwise.
|
||||
*/
|
||||
filter<FilteredElement extends BaseType>(selector: ValueFn<GElement, Datum, boolean>): Selection<FilteredElement, Datum, PElement, PDatum>;
|
||||
@@ -639,7 +641,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*
|
||||
* @param value A value function which is evaluated for each selected element, in order,
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element. The function is then used to set each element’s new data.
|
||||
* with this as the current DOM element (nodes[i]). The function is then used to set each element’s new data.
|
||||
* A null value will delete the bound data.
|
||||
*/
|
||||
datum<NewDatum>(value: ValueFn<GElement, Datum, NewDatum>): Selection<GElement, NewDatum, PElement, PDatum>;
|
||||
@@ -659,7 +661,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*/
|
||||
data(): Datum[];
|
||||
/**
|
||||
* Joins the specified array of data with the selected elements, returning a new selection that it represents
|
||||
* Joins the specified array of data with the selected elements, returning a new selection that represents
|
||||
* the update selection: the elements successfully bound to data. Also defines the enter and exit selections on
|
||||
* the returned selection, which can be used to add or remove elements to correspond to the new data.
|
||||
*
|
||||
@@ -682,9 +684,9 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*
|
||||
* @param data The specified data is an array of arbitrary values (e.g., numbers or objects).
|
||||
* @param key An optional key function which is evaluated for each selected element, in order, being passed the
|
||||
* current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* The key function is then also evaluated for each new datum in data, being passed the current datum (d),
|
||||
* the current index (i), and the group’s new data, with this as the group’s parent DOM element.
|
||||
* the current index (i), and the group’s new data, with this as the group’s parent DOM element (nodes[i]).
|
||||
* The datum for a given key is assigned to the element with the matching key. If multiple elements have the same key,
|
||||
* the duplicate elements are put into the exit selection; if multiple data have the same key, the duplicate data are put into the enter selection.
|
||||
*/
|
||||
@@ -714,7 +716,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* (d, which may be undefined), the group index (i), and the selection’s parent nodes (nodes),
|
||||
* with this as the group’s parent element. The function returns an array of values for each group.
|
||||
* @param key An optional key function which is evaluated for each selected element, in order, being passed the
|
||||
* current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* The key function is then also evaluated for each new datum in data, being passed the current datum (d),
|
||||
* the current index (i), and the group’s new data, with this as the group’s parent DOM element.
|
||||
* The datum for a given key is assigned to the element with the matching key. If multiple elements have the same key,
|
||||
@@ -780,7 +782,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* to receive events of the same type, such as click.foo and click.bar. To specify multiple typenames, separate typenames with spaces,
|
||||
* such as "input change"" or "click.foo click.bar".
|
||||
* @param listener A listener function which will be evaluated for each selected element, being passed the current datum (d), the current index (i),
|
||||
* and the current group (nodes), with this as the current DOM element. Listeners always see the latest datum for their element,
|
||||
* and the current group (nodes), with this as the current DOM element (nodes[i]). Listeners always see the latest datum for their element,
|
||||
* but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener.
|
||||
* To access the current event within a listener, use d3.event.
|
||||
* @param capture An optional capture flag which corresponds to the W3C useCapture flag.
|
||||
@@ -802,7 +804,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
* @param type Name of event to dispatch
|
||||
* @param parameters A value function which is evaluated for each selected element, in order,
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element. It must return the parameters map for the current element.
|
||||
* with this as the current DOM element (nodes[i]). It must return the parameters map for the current element.
|
||||
*/
|
||||
dispatch(type: string, parameters?: ValueFn<GElement, Datum, CustomEventParameters>): this;
|
||||
|
||||
@@ -810,11 +812,11 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
|
||||
/**
|
||||
* Invoke the specified function for each selected element, passing in the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]).
|
||||
* This method can be used to invoke arbitrary code for each selected element, and is useful for creating a context to access parent and child data simultaneously.
|
||||
*
|
||||
* @param func A function which is invoked for each selected element,
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes), with this of the current DOM element.
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]).
|
||||
*/
|
||||
each(func: ValueFn<GElement, Datum, void>): 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
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
44
types/d3-transition/index.d.ts
vendored
44
types/d3-transition/index.d.ts
vendored
@@ -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 <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// 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<GElement extends BaseType, Datum, PElement extends B
|
||||
* The generic represents the type of the descendant element to be selected.
|
||||
*
|
||||
* @param selector A selector function, which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* It must return an element, or null if there is no matching element.
|
||||
*/
|
||||
select<DescElement extends BaseType>(selector: ValueFn<GElement, Datum, DescElement>): Transition<DescElement, Datum, PElement, PDatum>;
|
||||
@@ -135,7 +135,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
* datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.
|
||||
*
|
||||
* @param selector A selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. It must return an array of elements
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). It must return an array of elements
|
||||
* (or a pseudo-array, such as a NodeList), or the empty array if there are no matching elements.
|
||||
*/
|
||||
selectAll<DescElement extends BaseType, OldDatum>(selector: ValueFn<GElement, Datum, DescElement[] | ArrayLike<DescElement>>): Transition<DescElement, OldDatum, GElement, Datum>;
|
||||
@@ -194,7 +194,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*
|
||||
* @param name Name of the attribute.
|
||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* A null value will clear the attribute at the start of the transition.
|
||||
*/
|
||||
attr(name: string, value: ValueFn<GElement, Datum, string | number | boolean | null>): this;
|
||||
@@ -221,7 +221,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*
|
||||
* @param name Name of attribute.
|
||||
* @param factory An interpolator factory which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. The interpolator factory returns a string interpolator,
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The interpolator factory returns a string interpolator,
|
||||
* which takes as its argument eased time t, typically in the range [0, 1] and returns the interpolated string.
|
||||
*/
|
||||
attrTween(name: string, factory: ValueFn<GElement, Datum, (t: number) => string>): this;
|
||||
@@ -234,8 +234,9 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*/
|
||||
style(name: string, value: null): this;
|
||||
/**
|
||||
* For each selected element, assigns the style tween for the style with the specified name to the specified target value.
|
||||
* The starting value of the tween is the style’s value when the transition starts.
|
||||
* For each selected element, assigns the style tween for the style with the specified name to the specified target value with the
|
||||
* specified priority.
|
||||
* The starting value of the tween is the style’s inline value if present, and otherwise its computed value.
|
||||
* The target value is the specified constant value for all elements.
|
||||
*
|
||||
* An interpolator is chosen based on the type of the target value, using the following algorithm:
|
||||
@@ -251,8 +252,9 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*/
|
||||
style(name: string, value: string | number | boolean, priority?: null | 'important'): this;
|
||||
/**
|
||||
* For each selected element, assigns the style tween for the style with the specified name to the specified target value.
|
||||
* The starting value of the tween is the style's value when the transition starts.
|
||||
* For each selected element, assigns the style tween for the style with the specified name to the specified target value with the
|
||||
* specified priority.
|
||||
* The starting value of the tween is the style's inline value if present, and otherwise its computed value.
|
||||
* The target value is return value of the value function evaluated for the selected element.
|
||||
*
|
||||
* An interpolator is chosen based on the type of the target value, using the following algorithm:
|
||||
@@ -264,7 +266,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*
|
||||
* @param name Name of the style.
|
||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* A null value will clear the style at the start of the transition.
|
||||
* @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
||||
*/
|
||||
@@ -292,7 +294,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*
|
||||
* @param name Name of style.
|
||||
* @param factory An interpolator factory which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. The interpolator factory returns a string interpolator,
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The interpolator factory returns a string interpolator,
|
||||
* which takes as its argument eased time t, typically in the range [0, 1] and returns the interpolated string.
|
||||
* @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
||||
*/
|
||||
@@ -319,7 +321,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
* append a replacement element and cross-fade opacity (for example). Text is not interpolated by default because it is usually undesirable.
|
||||
*
|
||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
||||
* A null value will clear the text content at the start of the transition.
|
||||
*/
|
||||
text(value: ValueFn<GElement, Datum, string | number | boolean>): this;
|
||||
@@ -348,7 +350,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
*
|
||||
* @param name Name of tween.
|
||||
* @param tweenFn A tween function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. The tween function returns a function
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The tween function returns a function
|
||||
* which takes as its argument eased time t, typically in the range [0, 1] and performs the tweening activities for each transition frame.
|
||||
*/
|
||||
tween(name: string, tweenFn: ValueFn<GElement, Datum, (t: number) => void>): this;
|
||||
@@ -397,7 +399,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
* the existing transition is returned for that element.
|
||||
*
|
||||
* @param filter A filter function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. The filter function returns a boolean indicating,
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The filter function returns a boolean indicating,
|
||||
* whether the selected element matches.
|
||||
*/
|
||||
filter(filter: ValueFn<GElement, Datum, boolean>): Transition<GElement, Datum, PElement, PDatum>;
|
||||
@@ -411,7 +413,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
* contained in a pre-filter selection are narrowed to a subset as part of the filtering.
|
||||
*
|
||||
* @param filter A filter function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. The filter function returns a boolean indicating,
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The filter function returns a boolean indicating,
|
||||
* whether the selected element matches.
|
||||
*/
|
||||
filter<FilteredElement extends BaseType>(filter: ValueFn<GElement, Datum, boolean>): Transition<FilteredElement, Datum, PElement, PDatum>;
|
||||
@@ -448,7 +450,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
* the optional name allows multiple callbacks to be registered to receive events of the same type, such as "start.foo"" and "start.bar".
|
||||
* To specify multiple typenames, separate typenames with spaces, such as "interrupt end"" or "start.foo start.bar".
|
||||
* @param listener A listener function which will be evaluated for each selected element, being passed the current datum (d), the current index (i),
|
||||
* and the current group (nodes), with this as the current DOM element. Listeners always see the latest datum for their element,
|
||||
* and the current group (nodes), with this as the current DOM element (nodes[i]). Listeners always see the latest datum for their element,
|
||||
* but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener.
|
||||
*/
|
||||
on(type: string, listener: ValueFn<GElement, Datum, void>): this;
|
||||
@@ -457,11 +459,11 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
|
||||
/**
|
||||
* Invoke the specified function for each selected element, passing the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element.
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]).
|
||||
* This method can be used to invoke arbitrary code for each selected element, and is useful for creating a context to access parent and child data simultaneously.
|
||||
*
|
||||
* @param func A function which is invoked for each selected element,
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes), with this of the current DOM element.
|
||||
* being passed the current datum (d), the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]).
|
||||
*/
|
||||
each(func: ValueFn<GElement, Datum, void>): this;
|
||||
|
||||
@@ -513,7 +515,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
* value function.
|
||||
*
|
||||
* @param milliseconds A value function which is evaluated for each selected element, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element. The return value is a number
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]). The return value is a number
|
||||
* specifying the delay in milliseconds.
|
||||
*/
|
||||
delay(milliseconds: ValueFn<GElement, Datum, number>): this;
|
||||
@@ -535,7 +537,7 @@ export interface Transition<GElement extends BaseType, Datum, PElement extends B
|
||||
* value function.
|
||||
*
|
||||
* @param milliseconds A value function which is evaluated for each selected element, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element. The return value is a number
|
||||
* the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]). The return value is a number
|
||||
* specifying the duration in milliseconds.
|
||||
*/
|
||||
duration(milliseconds: ValueFn<GElement, Datum, number>): this;
|
||||
|
||||
2
types/d3/index.d.ts
vendored
2
types/d3/index.d.ts
vendored
@@ -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 <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Reference in New Issue
Block a user