Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #304 from dart-lang/github-sync
Browse files Browse the repository at this point in the history
GitHub sync
  • Loading branch information
TedSander authored Jul 27, 2018
2 parents 3ef0f20 + 5c97f14 commit 2f9b64a
Show file tree
Hide file tree
Showing 222 changed files with 2,301 additions and 1,893 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## 0.9.0-beta+2

> NOTE: This code is considered production quality, but depends on angular:
> 5.0.0-beta+2 (5.0.0-beta+2 is used in production Google apps).
### Breaking Changes
* Remove `SelectableChangeNotifier` and deprecate `SelectableWithComposition`
with the intention to remove. They are widely unused, complicated the
implementations, and unsound in Dart 2.

#### Material Dialog
* Fix bug where a disposable could be added to its disposer after it had already
been destroyed.

#### Material Icon
* Add aria label and use them for trailing/leading icons of Material Input.

#### Material Popup
* Change `<main>` html tag to a `<div>`. HTML5 states there should only be one
main tag per application.

### Other Updates
#### Miscellaneous
* Add `is{Selectable|Disabled|Hidden}In()`, `getOptionIn()` and, `filterWhere()`
as static helpers to `Selectable`.
* Add a lookup method for finding the closest Material Color name based on any
input color.

#### Dart 2 Updates
* Fixes for Dart 2 compile-time and runtime errors.
* Applicaion of `dartfmt --fix`.

## 0.9.0-beta+1

> NOTE: This code is considered production quality, but depends on angular:
Expand Down
4 changes: 2 additions & 2 deletions lib/angular_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export 'utils/async/async.dart';

/// A convenience list of all Directives exposed by this package.
@Deprecated('List the directives used by your app for smaller code size.')
const List<dynamic> materialDirectives = const [
const List<dynamic> materialDirectives = [
AutoDismissDirective,
AutoFocusDirective,
ButtonDirective,
Expand Down Expand Up @@ -324,6 +324,6 @@ const List<dynamic> materialDirectives = const [
];

/// A convenience list of all providers exposed by this package.
const List<dynamic> materialProviders = const [
const List<dynamic> materialProviders = [
datepickerBindings,
];
4 changes: 2 additions & 2 deletions lib/annotations/rtl_annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import 'package:angular/angular.dart';
/// This is used to only read the DOM once for an app to determine if the app
/// itself is RTL. Only use this for components whose RTL is not independant
/// of the application as a whole.
const rtlToken = const OpaqueToken('isRtl');
const rtlToken = OpaqueToken('isRtl');

const rtlProvider =
const Provider(rtlToken, useFactory: determineRtl, deps: const [Document]);
Provider(rtlToken, useFactory: determineRtl, deps: [Document]);

@Injectable()
bool determineRtl(Document document) =>
Expand Down
6 changes: 3 additions & 3 deletions lib/app_layout/material_drawer_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:angular_components/content/deferred_content_aware.dart';

// When deferred content should be removed. Needs to be longer than the longest
// animation.
const animationDuration = const Duration(milliseconds: 500);
const animationDuration = Duration(milliseconds: 500);

class MaterialDrawerBase implements DeferredContentAware, OnInit {
MaterialDrawerBase({bool visible = true}) : _visible = visible;
Expand All @@ -26,7 +26,7 @@ class MaterialDrawerBase implements DeferredContentAware, OnInit {

if (!_visible) {
// Wait until after the animation to remove the content
new Timer(animationDuration, () {
Timer(animationDuration, () {
// Make sure we are still not visible in case the drawer was toggled
// quickly before the animation was done.
if (!_visible) _visibleChange.add(_visible);
Expand All @@ -37,7 +37,7 @@ class MaterialDrawerBase implements DeferredContentAware, OnInit {
}
}

final _visibleChange = new StreamController<bool>.broadcast(sync: true);
final _visibleChange = StreamController<bool>.broadcast(sync: true);

/// Event fired when the visibility of the drawer changes.
///
Expand Down
4 changes: 2 additions & 2 deletions lib/app_layout/material_persistent_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import 'material_drawer_base.dart';
@Directive(
selector: 'material-drawer[persistent]',
exportAs: 'drawer',
providers: const [
const Provider(DeferredContentAware,
providers: [
Provider(DeferredContentAware,
useExisting: MaterialPersistentDrawerDirective),
],
visibility: Visibility.all, // Injected by child elements.
Expand Down
6 changes: 3 additions & 3 deletions lib/app_layout/material_stackable_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import 'package:angular_components/content/deferred_content_aware.dart';
/// Works with deferred content.
@Component(
selector: 'material-drawer[stackable]',
providers: const [
const Provider(DeferredContentAware,
providers: [
Provider(DeferredContentAware,
useExisting: MaterialStackableDrawerComponent),
],
templateUrl: 'material_stackable_drawer.html',
styleUrls: const ['material_stackable_drawer.scss.css'],
styleUrls: ['material_stackable_drawer.scss.css'],
visibility: Visibility.all, // Injected by child elements.
)
class MaterialStackableDrawerComponent
Expand Down
6 changes: 3 additions & 3 deletions lib/app_layout/material_temporary_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import 'material_drawer_base.dart';
@Component(
selector: 'material-drawer[temporary]',
exportAs: 'drawer',
providers: const [
const Provider(DeferredContentAware,
providers: [
Provider(DeferredContentAware,
useExisting: MaterialTemporaryDrawerComponent),
],
templateUrl: 'material_temporary_drawer.html',
styleUrls: const ['material_temporary_drawer.scss.css'],
styleUrls: ['material_temporary_drawer.scss.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
visibility: Visibility.all, // Injected by child elements.
)
Expand Down
2 changes: 1 addition & 1 deletion lib/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import 'package:build/build.dart';
import 'package:sass_builder/sass_builder.dart';

Builder scssBuilder(BuilderOptions options) =>
new SassBuilder(outputExtension: '.scss.css');
SassBuilder(outputExtension: '.scss.css');
2 changes: 1 addition & 1 deletion lib/button_decorator/button_decorator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ButtonDirective extends RootFocusable
@Output()
Stream<UIEvent> get trigger => _trigger.stream;

final _trigger = new StreamController<UIEvent>.broadcast(sync: true);
final _trigger = StreamController<UIEvent>.broadcast(sync: true);

String _hostTabIndex;
String _role;
Expand Down
6 changes: 3 additions & 3 deletions lib/content/deferred_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import 'deferred_content_aware.dart';
selector: '[deferredContent]',
)
class DeferredContentDirective implements OnDestroy {
final _disposer = new Disposer.oneShot();
final _placeholder = new DivElement();
final _disposer = Disposer.oneShot();
final _placeholder = DivElement();

ViewContainerRef _viewContainer;
EmbeddedViewRef _viewRef;
Expand Down Expand Up @@ -101,7 +101,7 @@ class DeferredContentDirective implements OnDestroy {
class CachingDeferredContentDirective implements OnDestroy {
ViewContainerRef _viewContainer;
TemplateRef _template;
final _disposer = new Disposer.oneShot();
final _disposer = Disposer.oneShot();
ViewRef _view;

// Keep around the current state.
Expand Down
2 changes: 1 addition & 1 deletion lib/dynamic_component/dynamic_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DynamicComponent implements OnDestroy, AfterChanges {
final SlowComponentLoader _slowComponentLoader;
final ComponentLoader _componentLoader;
final ChangeDetectorRef _changeDetectorRef;
final _onLoadController = new StreamController<ComponentRef>();
final _onLoadController = StreamController<ComponentRef>();

ViewContainerRef _viewContainerRef;
bool _loadDeferred = false;
Expand Down
10 changes: 4 additions & 6 deletions lib/focus/focus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract class ProjectedFocus implements Focusable {
if (delegate is Focusable) {
_resolvedFocusable = delegate;
} else {
_resolvedFocusable = new _FocusableElement(delegate);
_resolvedFocusable = _FocusableElement(delegate);
}
_resolvedFocusable.focus();
});
Expand Down Expand Up @@ -104,7 +104,7 @@ class FocusMoveEvent {
int keyCode = kbEvent.keyCode;
if (!_isNextKey(keyCode) && !_isPrevKey(keyCode)) return null;
int offset = _isNextKey(keyCode) ? 1 : -1;
return new FocusMoveEvent(item, offset, () {
return FocusMoveEvent(item, offset, () {
kbEvent.preventDefault();
});
}
Expand All @@ -124,7 +124,7 @@ class FocusMoveEvent {
selector: '[autoFocus]',
)
class AutoFocusDirective extends RootFocusable implements OnInit, OnDestroy {
final _disposer = new Disposer.oneShot();
final _disposer = Disposer.oneShot();

bool _autoFocus;
// These fields are not final to support nulling them out for easier memory
Expand Down Expand Up @@ -204,9 +204,7 @@ class AutoFocusDirective extends RootFocusable implements OnInit, OnDestroy {
@Directive(
selector: '[focusableElement]',
exportAs: 'focusableElement',
providers: const [
const Provider(Focusable, useExisting: FocusableDirective)
])
providers: [Provider(Focusable, useExisting: FocusableDirective)])
class FocusableDirective extends RootFocusable {
FocusableDirective(HtmlElement node) : super(node);
}
5 changes: 2 additions & 3 deletions lib/focus/focus_activable_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import 'package:angular_components/focus/focus.dart';
/// elements that should be focused either by index or [key].
@Directive(
selector: '[focusActivableItem]',
providers: const [
const Provider(FocusableActivateItem,
useExisting: FocusActivableItemDirective)
providers: [
Provider(FocusableActivateItem, useExisting: FocusActivableItemDirective)
],
)
class FocusActivableItemDirective extends RootFocusable
Expand Down
9 changes: 3 additions & 6 deletions lib/focus/focus_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import 'package:angular_components/focus/focus.dart';
/// by way of keyboard interaction.
@Directive(
selector: '[focusItem]',
providers: const [
const Provider(FocusableItem, useExisting: FocusItemDirective)
],
providers: [Provider(FocusableItem, useExisting: FocusItemDirective)],
)
class FocusItemDirective extends RootFocusable implements FocusableItem {
@HostBinding('attr.role')
Expand All @@ -28,14 +26,13 @@ class FocusItemDirective extends RootFocusable implements FocusableItem {
@HostBinding('attr.tabindex')
String tabIndex = '0';

final _focusMoveCtrl =
new StreamController<FocusMoveEvent>.broadcast(sync: true);
final _focusMoveCtrl = StreamController<FocusMoveEvent>.broadcast(sync: true);
@override
Stream<FocusMoveEvent> get focusmove => _focusMoveCtrl.stream;

@HostListener('keydown')
void keydown(KeyboardEvent event) {
var focusEvent = new FocusMoveEvent.fromKeyboardEvent(this, event);
var focusEvent = FocusMoveEvent.fromKeyboardEvent(this, event);
if (focusEvent != null) {
_focusMoveCtrl.add(focusEvent);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/focus/focus_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FocusListDirective implements OnDestroy {

@HostBinding('attr.role')
final String role;
final _disposer = new Disposer.multi();
final _disposer = Disposer.multi();
final _children = <FocusableItem>[];
int get _length => _children.length;

Expand Down
10 changes: 5 additions & 5 deletions lib/focus/focus_trap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import 'package:angular_components/utils/disposer/disposer.dart';
@Component(
selector: 'focus-trap',
templateUrl: 'focus_trap.html',
styleUrls: const ['focus_trap.scss.css'],
directives: const [FocusContentWrapper, AutoFocusDirective],
styleUrls: ['focus_trap.scss.css'],
directives: [FocusContentWrapper, AutoFocusDirective],
changeDetection: ChangeDetectionStrategy.OnPush,
)
class FocusTrapComponent implements OnDestroy {
final _disposer = new Disposer.oneShot();
final _disposer = Disposer.oneShot();

AutoFocusDirective _autoFocusDirective;
@ContentChild(AutoFocusDirective)
Expand All @@ -44,11 +44,11 @@ class FocusTrapComponent implements OnDestroy {

void focusFirst() {
_focusFirstInOrder(
new DomTreeIterator(_content.element, scope: _content.element));
DomTreeIterator(_content.element, scope: _content.element));
}

void focusLast() {
_focusFirstInOrder(new DomTreeIterator(_content.element,
_focusFirstInOrder(DomTreeIterator(_content.element,
scope: _content.element, reverse: true, wraps: true));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/forms/error_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ErrorFn replaceErrors(Map<String, String> overrides) =>

Map<String, dynamic> _replaceErrorsImpl(
Map<String, String> overrides, Map<String, dynamic> errors) {
final result = new Map<String, dynamic>.from(errors);
final result = Map<String, dynamic>.from(errors);
for (var error in errors.keys) {
if (overrides.containsKey(error)) result[error] = overrides[error];
}
Expand Down
8 changes: 4 additions & 4 deletions lib/framework_stabilizers/testability.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ abstract class AbstractTestability implements Testability {
return;
}

new Future(() {
Future(() {
if (newCallback != null) newCallback(false, name);
while (_callbacks.isNotEmpty) {
(_callbacks.removeLast())(true, name);
Expand Down Expand Up @@ -98,16 +98,16 @@ class NullTestability implements Testability {

@override
void whenStable(IsStableCallback fn) {
throw new UnsupportedError('not supported by NullTestability');
throw UnsupportedError('not supported by NullTestability');
}

@override
bool get isStable {
throw new UnsupportedError('not supported by NullTestability');
throw UnsupportedError('not supported by NullTestability');
}

@override
String get name {
throw new UnsupportedError('not supported by NullTestability');
throw UnsupportedError('not supported by NullTestability');
}
}
4 changes: 2 additions & 2 deletions lib/glyph/glyph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:angular_components/model/ui/icon.dart';
/// Icons that should be horizontally flipped when the direction is RTL.
///
/// Please add to this list as needed.
const List<String> _flippedIcons = const [
const List<String> _flippedIcons = [
'arrow_back',
'arrow_forward',
'chevron_left',
Expand Down Expand Up @@ -51,7 +51,7 @@ const List<String> _flippedIcons = const [
@Component(
selector: 'glyph',
templateUrl: 'glyph.html',
styleUrls: const ['glyph.scss.css'],
styleUrls: ['glyph.scss.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
)
class GlyphComponent {
Expand Down
4 changes: 2 additions & 2 deletions lib/highlighted_text/highlighted_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import 'package:angular_components/model/ui/highlighted_text_model.dart';
@Component(
selector: 'highlighted-text',
templateUrl: 'highlighted_text.html',
styleUrls: const ['highlighted_text.scss.css'],
directives: const [NgFor],
styleUrls: ['highlighted_text.scss.css'],
directives: [NgFor],
changeDetection: ChangeDetectionStrategy.OnPush,
)
class HighlightedTextComponent {
Expand Down
4 changes: 2 additions & 2 deletions lib/highlighted_text/highlighted_value.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import 'package:angular_components/model/ui/highlighted_text_model.dart';
@Component(
selector: 'highlight-value',
templateUrl: 'highlighted_text.html',
styleUrls: const ['highlighted_text.scss.css'],
directives: const [NgFor],
styleUrls: ['highlighted_text.scss.css'],
directives: [NgFor],
)
class HighlightedValueComponent implements RendersValue {
final HighlightProvider _highLighter;
Expand Down
Loading

0 comments on commit 2f9b64a

Please sign in to comment.