[d3-selection] Update comments

* captures comment updates from patch releases 1.0.3 to 1.0.6
This commit is contained in:
Tom Wanzek
2017-05-16 12:43:26 -04:00
parent e251c14388
commit dc28f3d89c
+36 -33
View File
@@ -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 <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -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,7 +304,7 @@ 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 functions return value is then used to assign or unassign classes on each element.
*/
classed(names: string, value: ValueFn<GElement, Datum, boolean>): this;
@@ -340,7 +340,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 +367,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 +423,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 functions return value is then used to set each elements text content. A null value will clear the content.
*/
text(value: ValueFn<GElement, Datum, string | number | boolean | null>): this;
@@ -449,16 +449,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 functions return value is then used to set each elements 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 +473,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 +485,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 +506,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 +575,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 +587,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 +642,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 elements new data.
* with this as the current DOM element (nodes[i]). The function is then used to set each elements new data.
* A null value will delete the bound data.
*/
datum<NewDatum>(value: ValueFn<GElement, Datum, NewDatum>): Selection<GElement, NewDatum, PElement, PDatum>;
@@ -659,7 +662,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 +685,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 groups new data, with this as the groups parent DOM element.
* the current index (i), and the groups new data, with this as the groups 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 +717,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
* (d, which may be undefined), the group index (i), and the selections parent nodes (nodes),
* with this as the groups 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 groups new data, with this as the groups 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 +783,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 +805,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 +813,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;