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