1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | export type BaseType = Element | EnterElement | Document | Window | null;
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | export type KeyType = string | number;
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | export interface ArrayLike<T> {
|
34 | length: number;
|
35 | item(index: number): T | null;
|
36 | [index: number]: T;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | export interface EnterElement {
|
44 | ownerDocument: Document;
|
45 | namespaceURI: string;
|
46 | appendChild(newChild: Node): Node;
|
47 | insertBefore(newChild: Node, refChild: Node): Node;
|
48 | querySelector(selectors: string): Element;
|
49 | querySelectorAll(selectors: string): NodeListOf<Element>;
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | export type ContainerElement = HTMLElement | SVGSVGElement | SVGGElement;
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | export interface ClientPointEvent {
|
61 | clientX: number;
|
62 | clientY: number;
|
63 | }
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | export interface CustomEventParameters {
|
70 | |
71 |
|
72 |
|
73 | bubbles: boolean;
|
74 | |
75 |
|
76 |
|
77 | cancelable: boolean;
|
78 | |
79 |
|
80 |
|
81 | detail: any;
|
82 | }
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | export type ValueFn<T extends BaseType, Datum, Result> = (this: T, datum: Datum, index: number, groups: T[] | ArrayLike<T>) => Result;
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 | export interface TransitionLike<GElement extends BaseType, Datum> {
|
100 | selection(): Selection<GElement, Datum, any, any>;
|
101 | on(type: string, listener: null): TransitionLike<GElement, Datum>;
|
102 | on(type: string, listener: ValueFn<GElement, Datum, void>): TransitionLike<GElement, Datum>;
|
103 | tween(name: string, tweenFn: null): TransitionLike<GElement, Datum>;
|
104 | tween(name: string, tweenFn: ValueFn<GElement, Datum, ((t: number) => void)>): TransitionLike<GElement, Datum>;
|
105 | }
|
106 |
|
107 | // --------------------------------------------------------------------------
|
108 | // All Selection related interfaces and function
|
109 | // --------------------------------------------------------------------------
|
110 |
|
111 | /**
|
112 | * Select the first element that matches the specified selector string. If no elements match the selector, returns an empty selection.
|
113 | * If multiple elements match the selector, only the first matching element (in document order) will be selected.
|
114 | *
|
115 | * The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the
|
116 | * datum, on the selected element. This is useful when re-selecting an element with a previously set, know datum type.
|
117 | *
|
118 | * @param selector CSS selector string
|
119 | */
|
120 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
121 | export function select<GElement extends BaseType, OldDatum>(selector: string): Selection<GElement, OldDatum, HTMLElement, any>;
|
122 | /**
|
123 | * Select the specified node element.
|
124 | *
|
125 | * The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the
|
126 | * datum, on the selected element. This is useful when re-selecting an element with a previously set, know datum type.
|
127 | *
|
128 | * @param node An element to be selected
|
129 | */
|
130 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
131 | export function select<GElement extends BaseType, OldDatum>(node: GElement): Selection<GElement, OldDatum, null, undefined>;
|
132 |
|
133 | /**
|
134 | * Create an empty selection.
|
135 | */
|
136 | export function selectAll(selector?: null): Selection<null, undefined, null, undefined>;
|
137 | /**
|
138 | * Select all elements that match the specified selector string. The elements will be selected in document order (top-to-bottom).
|
139 | * If no elements in the document match the selector, returns an empty selection.
|
140 | *
|
141 | * The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the
|
142 | * datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.
|
143 | *
|
144 | * @param selector CSS selector string
|
145 | */
|
146 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
147 | export function selectAll<GElement extends BaseType, OldDatum>(selector: string): Selection<GElement, OldDatum, HTMLElement, any>;
|
148 | /**
|
149 | * Select the specified array, array-like, or iterable of nodes.
|
150 | * This is useful if you already have a reference to nodes, such as `this.childNodes` within an event listener or a global such as `document.links`.
|
151 | * The nodes may instead be an iterable, or a pseudo-array such as a NodeList.
|
152 | *
|
153 | * The first generic "GElement" refers to the type of element to be selected.
|
154 | * The second generic "OldDatum" refers to the type of the datum, of a selected element.
|
155 | *
|
156 | * @param nodes An array, array-like, or iterable of nodes
|
157 | */
|
158 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
159 | export function selectAll<GElement extends BaseType, OldDatum>(nodes: GElement[] | ArrayLike<GElement> | Iterable<GElement>): Selection<GElement, OldDatum, null, undefined>;
|
160 |
|
161 | /**
|
162 | * A D3 Selection of elements.
|
163 | *
|
164 | * The first generic "GElement" refers to the type of the selected element(s).
|
165 | * The second generic "Datum" refers to the type of the datum of a selected element(s).
|
166 | * The third generic "PElement" refers to the type of the parent element(s) in the D3 selection.
|
167 | * The fourth generic "PDatum" refers to the type of the datum of the parent element(s).
|
168 | */
|
169 | export interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
170 | // Sub-selection -------------------------
|
171 |
|
172 | /**
|
173 | * For each selected element, select the first descendant element that matches the specified selector string.
|
174 | * If no element matches the specified selector for the current element, the element at the current index will
|
175 | * be null in the returned selection. If multiple elements match the selector, only the first matching element
|
176 | * in document order is selected. Selection.select does not affect grouping: it preserves the existing group
|
177 | * structure and indexes, and propagates data (if any) to selected children.
|
178 | *
|
179 | * If the current element has associated data, this data is propagated to the
|
180 | * corresponding selected element.
|
181 | *
|
182 | * The generic represents the type of the descendant element to be selected.
|
183 | *
|
184 | * @param selector CSS selector string
|
185 | */
|
186 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
187 | select<DescElement extends BaseType>(selector: string): Selection<DescElement, Datum, PElement, PDatum>;
|
188 | /**
|
189 | * Create an empty sub-selection. Selection.select does not affect grouping: it preserves the existing group
|
190 | * structure and indexes.
|
191 | */
|
192 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
193 | select<DescElement extends BaseType>(selector: null): Selection<null, undefined, PElement, PDatum>;
|
194 | /**
|
195 | * For each selected element, select the descendant element returned by the selector function.
|
196 | * If no element is returned by the selector function for the current element, the element at the
|
197 | * current index will be null in the returned selection. Selection.select does not affect grouping:
|
198 | * it preserves the existing group structure and indexes, and propagates data (if any) to selected children.
|
199 | *
|
200 | * If the current element has associated data, this data is propagated to the
|
201 | * corresponding selected element.
|
202 | *
|
203 | * The generic represents the type of the descendant element to be selected.
|
204 | *
|
205 | * @param selector A selector function, which is evaluated for each selected element, in order, being passed the current datum (d),
|
206 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
207 | * It must return an element, or null if there is no matching element.
|
208 | */
|
209 | select<DescElement extends BaseType>(selector: ValueFn<GElement, Datum, DescElement>): Selection<DescElement, Datum, PElement, PDatum>;
|
210 |
|
211 | /**
|
212 | * Create an empty sub-selection. Selection.selectAll does affect grouping: The elements in the returned
|
213 | * selection are grouped by their corresponding parent node in this selection, the group at the current index will be empty.
|
214 | */
|
215 | selectAll(selector?: null): Selection<null, undefined, GElement, Datum>;
|
216 | /**
|
217 | * For each selected element, selects the descendant elements that match the specified selector string. The elements in the returned
|
218 | * selection are grouped by their corresponding parent node in this selection. If no element matches the specified selector
|
219 | * for the current element, the group at the current index will be empty. Selection.selectAll does affect grouping: each selected descendant
|
220 | * is grouped by the parent element in the originating selection.
|
221 | *
|
222 | * The selected elements do not inherit data from this selection; use selection.data to propagate data to children.
|
223 | *
|
224 | * The first generic "DescElement" refers to the type of descendant element to be selected. The second generic "OldDatum" refers to the type of the
|
225 | * datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.
|
226 | *
|
227 | * @param selector CSS selector string
|
228 | */
|
229 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
230 | selectAll<DescElement extends BaseType, OldDatum>(selector: string): Selection<DescElement, OldDatum, GElement, Datum>;
|
231 | /**
|
232 | * For each selected element, selects the descendant elements returned by the selector function. The elements in the returned
|
233 | * selection are grouped by their corresponding parent node in this selection. If no element matches the specified selector
|
234 | * for the current element, the group at the current index will be empty. Selection.selectAll does affect grouping: each selected descendant
|
235 | * is grouped by the parent element in the originating selection.
|
236 | *
|
237 | * The selected elements do not inherit data from this selection; use selection.data to propagate data to children.
|
238 | *
|
239 | * The first generic "DescElement" refers to the type of descendant element to be selected. The second generic "OldDatum" refers to the type of the
|
240 | * datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.
|
241 | *
|
242 | * @param selector A selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
243 | * 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
|
244 | * (or an iterable, or a pseudo-array, such as a NodeList), or the empty array if there are no matching elements.
|
245 | */
|
246 | selectAll<DescElement extends BaseType, OldDatum>(
|
247 | selector: ValueFn<GElement, Datum, DescElement[] | ArrayLike<DescElement> | Iterable<DescElement>>
|
248 |
|
249 | ): Selection<DescElement, OldDatum, GElement, Datum>;
|
250 |
|
251 | /**
|
252 | * Filters the selection, returning a new selection that contains only the elements for
|
253 | * which the specified filter is true.
|
254 | *
|
255 | * The returned filtered selection preserves the parents of this selection, but like array.filter,
|
256 | * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
257 | *
|
258 | * @param selector A CSS selector string to match when filtering.
|
259 | */
|
260 | filter(selector: string): Selection<GElement, Datum, PElement, PDatum>;
|
261 | /**
|
262 | * Filters the selection, returning a new selection that contains only the elements for
|
263 | * which the specified filter is true.
|
264 | *
|
265 | * The returned filtered selection preserves the parents of this selection, but like array.filter,
|
266 | * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
267 | *
|
268 | * The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types
|
269 | * contained in a pre-filter selection are narrowed to a subset as part of the filtering.
|
270 | *
|
271 | * @param selector A CSS selector string to match when filtering.
|
272 | */
|
273 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
274 | filter<FilteredElement extends BaseType>(selector: string): Selection<FilteredElement, Datum, PElement, PDatum>;
|
275 | /**
|
276 | * Filter the selection, returning a new selection that contains only the elements for
|
277 | * which the specified filter is true.
|
278 | *
|
279 | * The returned filtered selection preserves the parents of this selection, but like array.filter,
|
280 | * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
281 | *
|
282 | * @param selector A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
283 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return true
|
284 | * for an element to be included, and false otherwise.
|
285 | */
|
286 | filter(selector: ValueFn<GElement, Datum, boolean>): Selection<GElement, Datum, PElement, PDatum>;
|
287 | /**
|
288 | * Filter the selection, returning a new selection that contains only the elements for
|
289 | * which the specified filter is true.
|
290 | *
|
291 | * The returned filtered selection preserves the parents of this selection, but like array.filter,
|
292 | * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
293 | *
|
294 | * @param selector A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
295 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return true
|
296 | * for an element to be included, and false otherwise.
|
297 | */
|
298 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
299 | filter<FilteredElement extends BaseType>(selector: ValueFn<GElement, Datum, boolean>): Selection<FilteredElement, Datum, PElement, PDatum>;
|
300 |
|
301 | /**
|
302 | * Returns a new selection merging this selection with the specified other selection or transition.
|
303 | * The returned selection has the same number of groups and the same parents as this selection.
|
304 | * Any missing (null) elements in this selection are filled with the corresponding element,
|
305 | * if present (not null), from the specified selection. (If the other selection has additional groups or parents,
|
306 | * they are ignored.)
|
307 | *
|
308 | * This method is commonly used to merge the enter and update selections after a data-join.
|
309 | * After modifying the entering and updating elements separately, you can merge the two selections and
|
310 | * perform operations on both without duplicate code.
|
311 | *
|
312 | * This method is not intended for concatenating arbitrary selections, however: if both this selection
|
313 | * and the specified other selection have (non-null) elements at the same index, this selection’s element
|
314 | * is returned in the merge and the other selection’s element is ignored.
|
315 | *
|
316 | * @param other Selection to be merged.
|
317 | */
|
318 | merge(other: Selection<GElement, Datum, PElement, PDatum> | TransitionLike<GElement, Datum>): Selection<GElement, Datum, PElement, PDatum>;
|
319 |
|
320 | /**
|
321 | * Returns a new selection with the (first) child of each element of the current selection matching the selector.
|
322 | * Selects the first child that matches (if any).
|
323 | *
|
324 | * The generic represents the type of the descendant element to be selected.
|
325 | *
|
326 | * @param selector CSS selector string
|
327 | */
|
328 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
329 | selectChild<DescElement extends BaseType>(selector?: string): Selection<DescElement, Datum, PElement, PDatum>;
|
330 | /**
|
331 | * Returns a new selection with the (first) child of each element of the current selection matching the selector.
|
332 | *
|
333 | * The first generic represents the type of the descendant element to be selected.
|
334 | * The second generic represents the type of any of the child elements.
|
335 | *
|
336 | * @param selector A selector function, which is evaluated for each of the children nodes, in order, being passed the child (child), the child’s index (i), and the list of children (children);
|
337 | * the method selects the first child for which the selector return truthy, if any.
|
338 | */
|
339 | selectChild<ResultElement extends BaseType, ChildElement extends BaseType>(
|
340 | selector: (child: ChildElement, i: number, children: ChildElement[]) => boolean
|
341 |
|
342 | ): Selection<ResultElement, Datum, PElement, PDatum>;
|
343 |
|
344 | /**
|
345 | * Returns a new selection with the children of each element of the current selection matching the selector.
|
346 | * Selects the children that match (if any)
|
347 | *
|
348 | * The first generic represents the type of the descendant element to be selected.
|
349 | * The second generic refers to the type of the datum of the element to be selected.
|
350 | *
|
351 | * @param selector CSS selector string
|
352 | */
|
353 | selectChildren<DescElement extends BaseType, OldDatum>(
|
354 | selector?: string
|
355 |
|
356 | ): Selection<DescElement, OldDatum, GElement, Datum>;
|
357 | /**
|
358 | * Returns a new selection with the children of each element of the current selection matching the selector.
|
359 | *
|
360 | * The first generic represents the type of the descendant element to be selected.
|
361 | * The second generic refers to the type of the datum of the element to be selected.
|
362 | * The third generic represents the type of any of the child elements.
|
363 | *
|
364 | * @param selector A selector function, which is evaluated for each of the children nodes, in order, being passed the child (child), the child’s index (i), and the list of children (children);
|
365 | * the method selects the first child for which the selector return truthy, if any.
|
366 | */
|
367 | selectChildren<ResultElement extends BaseType, ResultDatum, ChildElement extends BaseType>(
|
368 | selector: (child: ChildElement, i: number, children: ChildElement[]) => boolean
|
369 |
|
370 | ): Selection<ResultElement, ResultDatum, GElement, Datum>;
|
371 |
|
372 | /**
|
373 | * Returns the selection (for symmetry with transition.selection).
|
374 | */
|
375 | selection(): this;
|
376 |
|
377 | // Modifying -------------------------------
|
378 |
|
379 | /**
|
380 | * Return the current value of the specified attribute for the first (non-null) element in the selection.
|
381 | * This is generally useful only if you know that the selection contains exactly one element.
|
382 | *
|
383 | * @param name Name of the attribute
|
384 | */
|
385 | attr(name: string): string;
|
386 | /**
|
387 | * Sets the attribute with the specified name to the specified value on the selected elements and returns this selection.
|
388 | * If the value is a constant, all elements are given the same attribute value;
|
389 | * otherwise, if the value is a function, it is evaluated for each selected element, in order, being passed the current datum (d),
|
390 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
391 | * The function’s return value is then used to set each element’s attribute.
|
392 | * A null value will remove the specified attribute.
|
393 | */
|
394 | attr(name: string, value: null | string | number | boolean | ReadonlyArray<string | number> | ValueFn<GElement, Datum, null | string | number | boolean | ReadonlyArray<string | number>>): this;
|
395 |
|
396 | /**
|
397 | * Returns true if and only if the first (non-null) selected element has the specified classes.
|
398 | * This is generally useful only if you know the selection contains exactly one element.
|
399 | *
|
400 | * @param names A string of space-separated class names.
|
401 | */
|
402 | classed(names: string): boolean;
|
403 | /**
|
404 | * Assigns or unassigns the specified CSS class names on the selected elements by setting
|
405 | * the class attribute or modifying the classList property and returns this selection.
|
406 | * If the constant value is truthy, then all elements are assigned the specified classes; otherwise, the classes are unassigned.
|
407 | *
|
408 | * @param names A string of space-separated class names.
|
409 | * @param value A boolean flag (true = assign / false = unassign)
|
410 | */
|
411 | classed(names: string, value: boolean): this;
|
412 | /**
|
413 | * Assigns or unassigns the specified CSS class names on the selected elements by setting
|
414 | * the class attribute or modifying the classList property and returns this selection.
|
415 | * The assign/unassign status for the individual selected elements is determined by the boolean return
|
416 | * value of the value function.
|
417 | *
|
418 | * @param names A string of space-separated class names.
|
419 | * @param value A value function which is evaluated for each selected element, in order,
|
420 | * being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
421 | * The function’s return value is then used to assign or unassign classes on each element.
|
422 | */
|
423 | classed(names: string, value: ValueFn<GElement, Datum, boolean>): this;
|
424 |
|
425 | /**
|
426 | * Returns the current value of the specified style property for the first (non-null) element in the selection.
|
427 | * The current value is defined as the element’s inline value, if present, and otherwise its computed value.
|
428 | * Accessing the current style value is generally useful only if you know the selection contains exactly one element.
|
429 | *
|
430 | * @param name Name of the style
|
431 | */
|
432 | style(name: string): string;
|
433 | /**
|
434 | * Clear the style with the specified name for the selected elements and returns this selection.
|
435 | *
|
436 | * @param name Name of the style
|
437 | * @param value null,to clear the style
|
438 | */
|
439 | style(name: string, value: null): this;
|
440 | /**
|
441 | * Sets the value of the style with the specified name for the selected elements and returns this selection.
|
442 | * All elements are given the same style value.
|
443 | *
|
444 | * @param name Name of the style
|
445 | * @param value Constant value for the style
|
446 | * @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
447 | */
|
448 | style(name: string, value: string | number | boolean, priority?: null | 'important'): this;
|
449 | /**
|
450 | * Sets the value of the style with the specified name for the selected elements and returns this selection.
|
451 | * The value for the individual selected elements is determined by the value function.
|
452 | *
|
453 | * @param name Name of the style
|
454 | * @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
455 | * 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.
|
456 | * @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
457 | */
|
458 | style(name: string, value: ValueFn<GElement, Datum, string | number | boolean | null>, priority?: null | 'important'): this;
|
459 |
|
460 | /**
|
461 | * Return the current value of the specified property for the first (non-null) element in the selection.
|
462 | * This is generally useful only if you know that the selection contains exactly one element.
|
463 | *
|
464 | * @param name Name of the property
|
465 | */
|
466 | property(name: string): any;
|
467 | /**
|
468 | * Look up a local variable on the first node of this selection. Note that this is not equivalent to `local.get(selection.node())` in that it will not look up locals set on the parent node(s).
|
469 | *
|
470 | * @param name The `d3.local` variable to look up.
|
471 | */
|
472 | property<T>(name: Local<T>): T | undefined;
|
473 | /**
|
474 | * Sets the property with the specified name to the specified value on selected elements.
|
475 | * If the value is a constant, then all elements are given the same property value;
|
476 | * otherwise, if the value is a function, it is evaluated for each selected element, in order, being passed the current datum (d),
|
477 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
478 | * The function’s return value is then used to set each element’s property. A null value will delete the specified property.
|
479 | */
|
480 | property(name: string, value: ValueFn<GElement, Datum, any> | null): this;
|
481 | /**
|
482 | * Sets the value of the property with the specified name for the selected elements and returns this selection.
|
483 | * All elements are given the same property value.
|
484 | *
|
485 | * @param name Name of the property
|
486 | * @param value Constant value for the property
|
487 | */
|
488 | property(name: string, value: any): this;
|
489 | /**
|
490 | * Store a value in a `d3.local` variable.
|
491 | * This is equivalent to `selection.each(function (d, i, g) { name.set(this, value.call(this, d, i, g)); })` but more concise.
|
492 | *
|
493 | * @param name A `d3.local` variable
|
494 | * @param value A callback that returns the value to store
|
495 | */
|
496 | property<T>(name: Local<T>, value: ValueFn<GElement, Datum, T>): this;
|
497 | /**
|
498 | * Store a value in a `d3.local` variable for each node in the selection.
|
499 | * This is equivalent to `selection.each(function () { name.set(this, value); })` but more concise.
|
500 | *
|
501 | * @param name A `d3.local` variable
|
502 | * @param value A callback that returns the value to store
|
503 | */
|
504 | property<T>(name: Local<T>, value: T): this;
|
505 |
|
506 | /**
|
507 | * Returns the text content for the first (non-null) element in the selection.
|
508 | * This is generally useful only if you know the selection contains exactly one element.
|
509 | */
|
510 | text(): string;
|
511 | /**
|
512 | * Sets the text content to the specified value on all selected elements, replacing any existing child elements.
|
513 | * If the value is a constant, then all elements are given the same text content;
|
514 | * otherwise, if the value is a function, it is evaluated for each selected element, in order, being passed the current datum (d),
|
515 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
516 | * The function’s return value is then used to set each element’s text content.
|
517 | * A null value will clear the content.
|
518 | */
|
519 | text(value: null | string | number | boolean | ValueFn<GElement, Datum, string | number | boolean | null>): this;
|
520 |
|
521 | /**
|
522 | * Returns a string representation of the inner HTML for the first (non-null) element in the selection.
|
523 | * This is generally useful only if you know the selection contains exactly one element.
|
524 | */
|
525 | html(): string;
|
526 | /**
|
527 | * Sets the inner HTML to the specified value on all selected elements, replacing any existing child elements.
|
528 | * If the value is a constant, then all elements are given the same inner HTML;
|
529 | * otherwise, if the value is a function, it is evaluated for each selected element, in order, being passed the current datum (d),
|
530 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
531 | * The function’s return value is then used to set each element’s inner HTML.
|
532 | * A null value will clear the content.
|
533 | */
|
534 | html(value: null | string | ValueFn<GElement, Datum, string | null>): this;
|
535 |
|
536 | /**
|
537 | * Appends a new element of this type (tag name) as the last child of each selected element,
|
538 | * or before the next following sibling in the update selection if this is an enter selection.
|
539 | * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data;
|
540 | * however, note that selection.order may still be required if updating elements change order
|
541 | * (i.e., if the order of new data is inconsistent with old data).
|
542 | *
|
543 | * This method returns a new selection containing the appended elements.
|
544 | * Each new element inherits the data of the current elements, if any.
|
545 | *
|
546 | * @param type A string representing the tag name.
|
547 | */
|
548 | append<K extends keyof ElementTagNameMap>(type: K): Selection<ElementTagNameMap[K], Datum, PElement, PDatum>;
|
549 | /**
|
550 | * Appends a new element of this type (tag name) as the last child of each selected element,
|
551 | * or before the next following sibling in the update selection if this is an enter selection.
|
552 | * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data;
|
553 | * however, note that selection.order may still be required if updating elements change order
|
554 | * (i.e., if the order of new data is inconsistent with old data).
|
555 | *
|
556 | * This method returns a new selection containing the appended elements.
|
557 | * Each new element inherits the data of the current elements, if any.
|
558 | *
|
559 | * The generic refers to the type of the child element to be appended.
|
560 | *
|
561 | * @param type A string representing the tag name. The specified name may have a namespace prefix, such as svg:text
|
562 | * to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited
|
563 | * from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used
|
564 | * (for example, svg implies svg:svg)
|
565 | */
|
566 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
567 | append<ChildElement extends BaseType>(type: string): Selection<ChildElement, Datum, PElement, PDatum>;
|
568 | /**
|
569 | * Appends a new element of the type provided by the element creator function as the last child of each selected element,
|
570 | * or before the next following sibling in the update selection if this is an enter selection.
|
571 | * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data;
|
572 | * however, note that selection.order may still be required if updating elements change order
|
573 | * (i.e., if the order of new data is inconsistent with old data).
|
574 | *
|
575 | * This method returns a new selection containing the appended elements.
|
576 | * Each new element inherits the data of the current elements, if any.
|
577 | *
|
578 | * The generic refers to the type of the child element to be appended.
|
579 | *
|
580 | * @param type A creator function which is evaluated for each selected element, in order, being passed the current datum (d),
|
581 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return
|
582 | * an element to be appended. (The function typically creates a new element, but it may instead return an existing element.)
|
583 | */
|
584 | append<ChildElement extends BaseType>(type: ValueFn<GElement, Datum, ChildElement>): Selection<ChildElement, Datum, PElement, PDatum>;
|
585 |
|
586 | /**
|
587 | * Inserts a new element of the specified type (tag name) before the first element matching the specified
|
588 | * before selector for each selected element. For example, a before selector :first-child will prepend nodes before the first child.
|
589 | * If before is not specified, it defaults to null. (To append elements in an order consistent with bound data, use selection.append.)
|
590 | *
|
591 | * This method returns a new selection containing the appended elements.
|
592 | * Each new element inherits the data of the current elements, if any.
|
593 | *
|
594 | * The generic refers to the type of the child element to be appended.
|
595 | *
|
596 | * @param type A string representing the tag name for the element type to be inserted.
|
597 | * @param before One of:
|
598 | * * A CSS selector string for the element before which the insertion should occur.
|
599 | * * A child selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
600 | * 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
|
601 | * before which the element should be inserted.
|
602 | */
|
603 | insert<K extends keyof ElementTagNameMap>(
|
604 | type: K,
|
605 | before?: string | ValueFn<GElement, Datum, BaseType>
|
606 | ): Selection<ElementTagNameMap[K], Datum, PElement, PDatum>;
|
607 | /**
|
608 | * Inserts a new element of the specified type (tag name) before the first element matching the specified
|
609 | * before selector for each selected element. For example, a before selector :first-child will prepend nodes before the first child.
|
610 | * If before is not specified, it defaults to null. (To append elements in an order consistent with bound data, use selection.append.)
|
611 | *
|
612 | * This method returns a new selection containing the appended elements.
|
613 | * Each new element inherits the data of the current elements, if any.
|
614 | *
|
615 | * The generic refers to the type of the child element to be appended.
|
616 | *
|
617 | * @param type One of:
|
618 | * * A string representing the tag name for the element type to be inserted. The specified name may have a namespace prefix,
|
619 | * such as svg:text to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited
|
620 | * from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used
|
621 | * (for example, svg implies svg:svg)
|
622 | * * A creator function which is evaluated for each selected element, in order, being passed the current datum (d),
|
623 | * the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). This function should return
|
624 | * an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.)
|
625 | * @param before One of:
|
626 | * * A CSS selector string for the element before which the insertion should occur.
|
627 | * * A child selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
628 | * 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
|
629 | * before which the element should be inserted.
|
630 | */
|
631 | insert<ChildElement extends BaseType>(
|
632 | type: string | ValueFn<GElement, Datum, ChildElement>,
|
633 | before?: string | ValueFn<GElement, Datum, BaseType>
|
634 | ): Selection<ChildElement, Datum, PElement, PDatum>;
|
635 |
|
636 | /**
|
637 | * Removes the selected elements from the document.
|
638 | * Returns this selection (the removed elements) which are now detached from the DOM.
|
639 | */
|
640 | remove(): this;
|
641 |
|
642 | /**
|
643 | * Inserts clones of the selected elements immediately following the selected elements and returns a selection of the newly
|
644 | * added clones. If deep is true, the descendant nodes of the selected elements will be cloned as well. Otherwise, only the elements
|
645 | * themselves will be cloned.
|
646 | *
|
647 | * @param deep Perform deep cloning if this flag is set to true.
|
648 | */
|
649 | clone(deep?: boolean): Selection<GElement, Datum, PElement, PDatum>;
|
650 |
|
651 | /**
|
652 | * Return a new selection that contains a copy of each group in this selection sorted according
|
653 | * to the compare function. After sorting, re-inserts elements to match the resulting order (per selection.order).
|
654 | *
|
655 | * Note that sorting is not guaranteed to be stable; however, it is guaranteed to have the same
|
656 | * behavior as your browser’s built-in sort method on arrays.
|
657 | *
|
658 | * @param comparator An optional comparator function, which defaults to "ascending". The function is passed
|
659 | * two elements’ data a and b to compare. It should return either a negative, positive, or zero value.
|
660 | * If negative, then a should be before b; if positive, then a should be after b; otherwise, a and b are
|
661 | * considered equal and the order is arbitrary.
|
662 | */
|
663 | sort(comparator?: (a: Datum, b: Datum) => number): this;
|
664 |
|
665 | /**
|
666 | * Re-insert elements into the document such that the document order of each group matches the selection order.
|
667 | * This is equivalent to calling selection.sort if the data is already sorted, but much faster.
|
668 | */
|
669 | order(): this;
|
670 |
|
671 | /**
|
672 | * Re-insert each selected element, in order, as the last child of its parent.
|
673 | */
|
674 | raise(): this;
|
675 |
|
676 | /**
|
677 | * Re-insert each selected element, in order, as the first child of its parent.
|
678 | */
|
679 | lower(): this;
|
680 |
|
681 | // Data Join ---------------------------------
|
682 |
|
683 | /**
|
684 | * Returns the array of data for the selected elements.
|
685 | */
|
686 | data(): Datum[];
|
687 | /**
|
688 | * Joins the specified array of data with the selected elements, returning a new selection that represents
|
689 | * the update selection: the elements successfully bound to data. Also defines the enter and exit selections on
|
690 | * the returned selection, which can be used to add or remove elements to correspond to the new data.
|
691 | *
|
692 | * The data is specified for each group in the selection. If the selection has multiple groups
|
693 | * (such as d3.selectAll followed by selection.selectAll), then data should typically be specified as a function.
|
694 | *
|
695 | * If a key function is not specified, then the first datum in data is assigned to the first selected element,
|
696 | * the second datum to the second selected element, and so on.
|
697 | * A key function may be specified to control which datum is assigned to which element, replacing the default join-by-index,
|
698 | * by computing a string identifier for each datum and element.
|
699 | *
|
700 | * The update and enter selections are returned in data order, while the exit selection preserves the selection
|
701 | * order prior to the join. If a key function is specified, the order of elements in the selection may not match
|
702 | * their order in the document; use selection.order or selection.sort as needed.
|
703 | *
|
704 | * This method cannot be used to clear bound data; use selection.datum instead.
|
705 | *
|
706 | * For details see: {@link https://github.com/d3/d3-selection#joining-data }
|
707 | *
|
708 | * The generic refers to the type of the new datum to be used for the selected elements.
|
709 | *
|
710 | * @param data The specified data is an array or iterable of arbitrary values (e.g., numbers or objects)
|
711 | * or a value function which will be evaluated for each group in order, being passed the group’s parent datum
|
712 | * (d, which may be undefined), the group index (i), and the selection’s parent nodes (nodes),
|
713 | * with this as the group’s parent element. The function returns an array or iterable of values for each group.
|
714 | * @param key An optional key function which is evaluated for each selected element, in order, being passed the
|
715 | * current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]); the returned string is the element’s key.
|
716 | * The key function is then also evaluated for each new datum in data, being passed the current datum (d),
|
717 | * the current index (i), and the group’s new data, with this as the group’s parent DOM element (nodes[i]); the returned string is the datum’s key.
|
718 | * The datum for a given key is assigned to the element with the matching key. If multiple elements have the same key,
|
719 | * 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.
|
720 | */
|
721 | data<NewDatum>(
|
722 | data: NewDatum[] | Iterable<NewDatum> | ValueFn<PElement, PDatum, NewDatum[] | Iterable<NewDatum>>,
|
723 | key?: ValueFn<GElement | PElement, Datum | NewDatum, KeyType>
|
724 | ): Selection<GElement, NewDatum, PElement, PDatum>;
|
725 |
|
726 | /**
|
727 | * Appends, removes and reorders elements as necessary to match the data that was previously bound by `selection.data`, returning the merged enter and update selection.
|
728 | * This method is a convenient alternative to the more explicit `selection.enter`, `selection.exit`, `selection.append` and `selection.remove`.
|
729 | *
|
730 | * The "matching" logic is determined by the key function passed to `selection.data`.
|
731 | */
|
732 | join<K extends keyof ElementTagNameMap, OldDatum = Datum>(
|
733 | enter: K,
|
734 | update?: (elem: Selection<GElement, Datum, PElement, PDatum>) => Selection<GElement, Datum, PElement, PDatum> | TransitionLike<GElement, Datum> | undefined,
|
735 |
|
736 | exit?: (elem: Selection<GElement, OldDatum, PElement, PDatum>) => void
|
737 | ): Selection<GElement | ElementTagNameMap[K], Datum, PElement, PDatum>;
|
738 | /**
|
739 | * Appends, removes and reorders elements as necessary to match the data that was previously bound by `selection.data`, returning the merged enter and update selection.
|
740 | * This method is a convenient alternative to the more explicit `selection.enter`, `selection.exit`, `selection.append` and `selection.remove`.
|
741 | *
|
742 | * The "matching" logic is determined by the key function passed to `selection.data`.
|
743 | */
|
744 | join<ChildElement extends BaseType, OldDatum = Datum>(
|
745 | enter: string | ((elem: Selection<EnterElement, Datum, PElement, PDatum>) => Selection<ChildElement, Datum, PElement, PDatum> | TransitionLike<GElement, Datum>),
|
746 | update?: (elem: Selection<GElement, Datum, PElement, PDatum>) => Selection<GElement, Datum, PElement, PDatum> | TransitionLike<GElement, Datum> | undefined,
|
747 |
|
748 | exit?: (elem: Selection<GElement, OldDatum, PElement, PDatum>) => void
|
749 |
|
750 | ): Selection<ChildElement | GElement, Datum, PElement, PDatum>;
|
751 |
|
752 | /**
|
753 | * Return the enter selection: placeholder nodes for each datum that had no corresponding DOM element
|
754 | * in the selection. (The enter selection is empty for selections not returned by selection.data.)
|
755 | */
|
756 | enter(): Selection<EnterElement, Datum, PElement, PDatum>;
|
757 |
|
758 | /**
|
759 | * Returns the exit selection: existing DOM elements in the selection for which no new datum was found.
|
760 | * (The exit selection is empty for selections not returned by selection.data.)
|
761 | *
|
762 | * IMPORTANT: The generic refers to the type of the old datum associated with the exit selection elements.
|
763 | * Ensure you set the generic to the correct type, if you need to access the data on the exit selection in
|
764 | * follow-up steps, e.g. to set styles as part of an exit transition before removing them.
|
765 | */
|
766 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
767 | exit<OldDatum>(): Selection<GElement, OldDatum, PElement, PDatum>;
|
768 |
|
769 | /**
|
770 | * Returns the bound datum for the first (non-null) element in the selection.
|
771 | * This is generally useful only if you know the selection contains exactly one element.
|
772 | */
|
773 | datum(): Datum;
|
774 | /**
|
775 | * Delete the bound data for each element in the selection.
|
776 | */
|
777 | datum(value: null): Selection<GElement, undefined, PElement, PDatum>;
|
778 | /**
|
779 | * Sets the element’s bound data using the specified value function on all selected elements.
|
780 | * Unlike selection.data, this method does not compute a join and does not affect
|
781 | * indexes or the enter and exit selections.
|
782 | *
|
783 | * The generic refers to the type of the new datum to be used for the selected elements.
|
784 | *
|
785 | * @param value A value function which is evaluated for each selected element, in order,
|
786 | * being passed the current datum (d), the current index (i), and the current group (nodes),
|
787 | * with this as the current DOM element (nodes[i]). The function is then used to set each element’s new data.
|
788 | * A null value will delete the bound data.
|
789 | */
|
790 | datum<NewDatum>(value: ValueFn<GElement, Datum, NewDatum>): Selection<GElement, NewDatum, PElement, PDatum>;
|
791 | /**
|
792 | * Sets the element’s bound data to the specified value on all selected elements.
|
793 | * Unlike selection.data, this method does not compute a join and does not affect
|
794 | * indexes or the enter and exit selections.
|
795 | *
|
796 | * The generic refers to the type of the new datum to be used for the selected elements.
|
797 | *
|
798 | * @param value A value object to be used as the datum for each element.
|
799 | */
|
800 | datum<NewDatum>(value: NewDatum): Selection<GElement, NewDatum, PElement, PDatum>;
|
801 |
|
802 | // Event Handling -------------------
|
803 |
|
804 | /**
|
805 | * Return the currently-assigned listener for the specified event typename on the first (non-null) selected element,
|
806 | * if any, If multiple typenames are specified, the first matching listener is returned.
|
807 | *
|
808 | * @param typenames The typenames is a string event type, such as click, mouseover, or submit; any DOM event type supported by your browser may be used.
|
809 | * The type may be optionally followed by a period (.) and a name; the optional name allows multiple callbacks to be registered
|
810 | * to receive events of the same type, such as click.foo and click.bar. To specify multiple typenames, separate typenames with spaces,
|
811 | * such as "input change"" or "click.foo click.bar".
|
812 | */
|
813 | on(typenames: string): ((this: GElement, event: any, d: Datum) => void) | undefined;
|
814 | /**
|
815 | * Remove a listener for the specified event type names. To remove all listeners for a given name,
|
816 | * pass null as the listener and ".foo" as the typename, where foo is the name; to remove all listeners with no name, specify "." as the typename.
|
817 | *
|
818 | * @param typenames The typenames is a string event type, such as click, mouseover, or submit; any DOM event type supported by your browser may be used.
|
819 | * The type may be optionally followed by a period (.) and a name; the optional name allows multiple callbacks to be registered
|
820 | * to receive events of the same type, such as click.foo and click.bar. To specify multiple typenames, separate typenames with spaces,
|
821 | * such as "input change"" or "click.foo click.bar".
|
822 | * @param listener null to indicate removal of listener
|
823 | */
|
824 | on(typenames: string, listener: null): this;
|
825 | /**
|
826 | * Add an event listener for the specified event type names. If an event listener was previously registered for the same typename
|
827 | * on a selected element, the old listener is removed before the new listener is added.
|
828 | *
|
829 | * When a specified event is dispatched on a selected node, the specified listener will be evaluated for each selected element.
|
830 | *
|
831 | * @param typenames The typenames is a string event type, such as click, mouseover, or submit; any DOM event type supported by your browser may be used.
|
832 | * The type may be optionally followed by a period (.) and a name; the optional name allows multiple callbacks to be registered
|
833 | * to receive events of the same type, such as click.foo and click.bar. To specify multiple typenames, separate typenames with spaces,
|
834 | * such as "input change"" or "click.foo click.bar".
|
835 | * @param listener A listener function which will be evaluated for each selected element,
|
836 | * being passed the current event (event) and the current datum (d), with this as the current DOM element (event.currentTarget).
|
837 | * Listeners always see the latest datum for their element.
|
838 | * Note: while you can use event.pageX and event.pageY directly,
|
839 | * it is often convenient to transform the event position to the local coordinate system of that element that received the event using d3.pointer.
|
840 | * @param options An optional options object may specify characteristics about the event listener, such as wehether it is captures or passive; see element.addEventListener.
|
841 | */
|
842 | on(typenames: string, listener: (this: GElement, event: any, d: Datum) => void, options?: any): this;
|
843 |
|
844 | /**
|
845 | * Dispatches a custom event of the specified type to each selected element, in order.
|
846 | * An optional parameters map may be specified to set additional properties of the event.
|
847 | *
|
848 | * @param type Name of event to dispatch
|
849 | * @param parameters An optional value map with custom event parameters
|
850 | */
|
851 | dispatch(type: string, parameters?: CustomEventParameters): this;
|
852 | /**
|
853 | * Dispatches a custom event of the specified type to each selected element, in order.
|
854 | * An optional value function returning a parameters map for each element in the selection may be specified to set additional properties of the event.
|
855 | *
|
856 | * @param type Name of event to dispatch
|
857 | * @param parameters A value function which is evaluated for each selected element, in order,
|
858 | * being passed the current datum (d), the current index (i), and the current group (nodes),
|
859 | * with this as the current DOM element (nodes[i]). It must return the parameters map for the current element.
|
860 | */
|
861 | dispatch(type: string, parameters?: ValueFn<GElement, Datum, CustomEventParameters>): this;
|
862 |
|
863 | // Control Flow ----------------------
|
864 |
|
865 | /**
|
866 | * Invoke the specified function for each selected element, passing in the current datum (d),
|
867 | * the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]).
|
868 | * 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.
|
869 | *
|
870 | * @param func A function which is invoked for each selected element,
|
871 | * being passed the current datum (d), the current index (i), and the current group (nodes), with this of the current DOM element (nodes[i]).
|
872 | */
|
873 | each(func: ValueFn<GElement, Datum, void>): this;
|
874 |
|
875 | /**
|
876 | * Invoke the specified function exactly once, passing in this selection along with any optional arguments.
|
877 | * Returns this selection.
|
878 | *
|
879 | * @param func A function which is passed this selection as the first argument along with any optional arguments.
|
880 | * @param args List of optional arguments to be passed to the callback function.
|
881 | */
|
882 | call<Args extends any[]>(func: (selection: Selection<GElement, Datum, PElement, PDatum>, ...args: Args) => void, ...args: Args): this;
|
883 |
|
884 | /**
|
885 | * Return true if this selection contains no (non-null) elements.
|
886 | */
|
887 | empty(): boolean;
|
888 |
|
889 | /**
|
890 | * Return an array of all (non-null) elements in this selection.
|
891 | */
|
892 | nodes(): GElement[];
|
893 |
|
894 | /**
|
895 | * Return the first (non-null) element in this selection. If the selection is empty, returns null.
|
896 | */
|
897 | node(): GElement | null;
|
898 |
|
899 | /**
|
900 | * Returns the total number of elements in this selection.
|
901 | */
|
902 | size(): number;
|
903 |
|
904 | /**
|
905 | * Returns an iterator over the selected (non-null) elements.
|
906 | */
|
907 | [Symbol.iterator](): Iterator<GElement>;
|
908 | }
|
909 |
|
910 | /**
|
911 | * Selects the root element, document.documentElement. This function can also be used to test for selections
|
912 | * (instanceof d3.selection) or to extend the selection prototype.
|
913 | */
|
914 | export type SelectionFn = () => Selection<HTMLElement, any, null, undefined>;
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 | export const selection: SelectionFn;
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 | export function pointer(event: any, target?: any): [number, number];
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 | export function pointers(event: any, target?: any): Array<[number, number]>;
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 | export function style(node: Element, name: string): string;
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 | export interface Local<T> {
|
971 | |
972 |
|
973 |
|
974 |
|
975 |
|
976 | get(node: Element): T | undefined;
|
977 | |
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 | remove(node: Element): boolean;
|
985 | |
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 | set(node: Element, value: T): T;
|
992 | |
993 |
|
994 |
|
995 |
|
996 | toString(): string;
|
997 | }
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 | export function local<T>(): Local<T>;
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 | export interface NamespaceLocalObject {
|
1015 | |
1016 |
|
1017 |
|
1018 | space: string;
|
1019 | |
1020 |
|
1021 |
|
1022 | local: string;
|
1023 | }
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 | export function namespace(prefixedLocal: string): NamespaceLocalObject | string;
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 | export interface NamespaceMap { [prefix: string]: string; }
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 | export const namespaces: NamespaceMap;
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 | export function window(DOMNode: Window | Document | Element): Window;
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 | export function create<K extends keyof ElementTagNameMap>(name: K): Selection<ElementTagNameMap[K], undefined, null, undefined>;
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 | export function create<NewGElement extends Element>(name: string): Selection<NewGElement, undefined, null, undefined>;
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 | export function creator<K extends keyof ElementTagNameMap>(name: K): (this: BaseType) => ElementTagNameMap[K];
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 | export function creator<NewGElement extends Element>(name: string): (this: BaseType) => NewGElement;
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 | export function matcher(selector: string): (this: BaseType) => boolean;
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 | export function selector<DescElement extends Element>(selector: string): (this: BaseType) => DescElement;
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 | export function selectorAll<DescElement extends Element>(selector: string): (this: BaseType) => NodeListOf<DescElement>;
|