| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. All rights reserved. | 2 * Copyright 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style | 4 * Use of this source code is governed by a BSD-style |
| 5 * license that can be found in the LICENSE file or at | 5 * license that can be found in the LICENSE file or at |
| 6 * https://developers.google.com/open-source/licenses/bsd | 6 * https://developers.google.com/open-source/licenses/bsd |
| 7 */ | 7 */ |
| 8 /* | 8 /* |
| 9 * TODO(prsd): Document library | 9 * TODO(prsd): Document library |
| 10 */ | 10 */ |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void classedWithCallback(String name, SelectionCallback<bool> fn); | 145 void classedWithCallback(String name, SelectionCallback<bool> fn); |
| 146 | 146 |
| 147 /** Sets CSS [property] to [val] on all elements in the selection. */ | 147 /** Sets CSS [property] to [val] on all elements in the selection. */ |
| 148 void style(String property, val, {String priority}); | 148 void style(String property, val, {String priority}); |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * Same as [style], but calls [fn] for each non-null element in the | 151 * Same as [style], but calls [fn] for each non-null element in the |
| 152 * selection (with data associated to the element, index of the element in | 152 * selection (with data associated to the element, index of the element in |
| 153 * it's group and the element itself) to get the value of the property. | 153 * it's group and the element itself) to get the value of the property. |
| 154 */ | 154 */ |
| 155 void styleWithCallback(String property, | 155 void styleWithCallback(String property, SelectionCallback<String> fn, |
| 156 SelectionCallback<String> fn, {String priority}); | 156 {String priority}); |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * Sets textContent of all elements in the selection to [val]. A side-effect | 159 * Sets textContent of all elements in the selection to [val]. A side-effect |
| 160 * of this call is that any children of these elements will not be part of | 160 * of this call is that any children of these elements will not be part of |
| 161 * the DOM anymore. | 161 * the DOM anymore. |
| 162 */ | 162 */ |
| 163 void text(String val); | 163 void text(String val); |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * Same as [text], but calls [fn] for each non-null element in | 166 * Same as [text], but calls [fn] for each non-null element in |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 * Computes the enter, update and exit selections. | 255 * Computes the enter, update and exit selections. |
| 256 */ | 256 */ |
| 257 DataSelection data(Iterable vals, [SelectionKeyFunction keyFn]); | 257 DataSelection data(Iterable vals, [SelectionKeyFunction keyFn]); |
| 258 | 258 |
| 259 /** | 259 /** |
| 260 * Same as [data], but calls [fn] for each non-null element in the | 260 * Same as [data], but calls [fn] for each non-null element in the |
| 261 * selection (with data associated to the element, index of the element in | 261 * selection (with data associated to the element, index of the element in |
| 262 * it's group and the element itself) to get the data to be set on the | 262 * it's group and the element itself) to get the data to be set on the |
| 263 * current element. | 263 * current element. |
| 264 */ | 264 */ |
| 265 DataSelection dataWithCallback( | 265 DataSelection dataWithCallback(SelectionCallback<Iterable> fn, |
| 266 SelectionCallback<Iterable> fn, [SelectionKeyFunction keyFn]); | 266 [SelectionKeyFunction keyFn]); |
| 267 | 267 |
| 268 /** | 268 /** |
| 269 * Associates data with all the elements - no join is performed. Unlike | 269 * Associates data with all the elements - no join is performed. Unlike |
| 270 * [data], this does not compute the enter, update and exit selections. | 270 * [data], this does not compute the enter, update and exit selections. |
| 271 */ | 271 */ |
| 272 void datum(Iterable vals); | 272 void datum(Iterable vals); |
| 273 | 273 |
| 274 /** | 274 /** |
| 275 * Same as [datum], but calls [fn] for each non-null element in the | 275 * Same as [datum], but calls [fn] for each non-null element in the |
| 276 * selection (with data associated to the element, index of the element in | 276 * selection (with data associated to the element, index of the element in |
| 277 * it's group and the element itself) to get the data to be set on the | 277 * it's group and the element itself) to get the data to be set on the |
| 278 * current element. | 278 * current element. |
| 279 */ | 279 */ |
| 280 void datumWithCallback(SelectionCallback<Iterable> fn); | 280 void datumWithCallback(SelectionCallback<Iterable> fn); |
| 281 | 281 |
| 282 /** | 282 /** |
| 283 * Starts a transition for the current selection. Transitions behave much | 283 * Starts a transition for the current selection. Transitions behave much |
| 284 * like selections, except operators animate smoothly over time rather than | 284 * like selections, except operators animate smoothly over time rather than |
| 285 * applying instantaneously. | 285 * applying instantaneously. |
| 286 */ | 286 */ |
| 287 Transition transition(); | 287 Transition transition(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 | |
| 291 /* | 290 /* |
| 292 * Group of elements in the selection. | 291 * Group of elements in the selection. |
| 293 * Each selection may contain more than one group of elements. | 292 * Each selection may contain more than one group of elements. |
| 294 */ | 293 */ |
| 295 abstract class SelectionGroup { | 294 abstract class SelectionGroup { |
| 296 Iterable<Element> elements; | 295 Iterable<Element> elements; |
| 297 Element parent; | 296 Element parent; |
| 298 } | 297 } |
| 299 | 298 |
| 300 | |
| 301 /** | 299 /** |
| 302 * [EnterSelection] is a sub-selection that represents missing elements of a | 300 * [EnterSelection] is a sub-selection that represents missing elements of a |
| 303 * selection - an element is considered missing when there is data and no | 301 * selection - an element is considered missing when there is data and no |
| 304 * corresponding element in a selection. | 302 * corresponding element in a selection. |
| 305 */ | 303 */ |
| 306 abstract class EnterSelection { | 304 abstract class EnterSelection { |
| 307 /** | 305 /** |
| 308 * Indicate if this selection is empty | 306 * Indicate if this selection is empty |
| 309 * See [Selection.isEmpty] for more information. | 307 * See [Selection.isEmpty] for more information. |
| 310 */ | 308 */ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 * elements which weren't associated with an element in the DOM. | 379 * elements which weren't associated with an element in the DOM. |
| 382 */ | 380 */ |
| 383 EnterSelection get enter; | 381 EnterSelection get enter; |
| 384 | 382 |
| 385 /** | 383 /** |
| 386 * A view of the current selection containing elements that don't have data | 384 * A view of the current selection containing elements that don't have data |
| 387 * associated with them. | 385 * associated with them. |
| 388 */ | 386 */ |
| 389 ExitSelection get exit; | 387 ExitSelection get exit; |
| 390 } | 388 } |
| OLD | NEW |