// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:html';

import 'package:angular/angular.dart';
import 'package:angular_components/focus/focus.dart';

/// This directive is used to [ViewChild] focusable element in your view.
///
/// Assign a [key] in order to filter items from a [QueryList].
@Directive(
  selector: '[focusActivableItem]',
  providers: const [
    const Provider(FocusableActivateItem,
        useExisting: FocusActivableItemDirective)
  ],
  // TODO(google): Change to `Visibility.local` to reduce code size.
  visibility: Visibility.all,
)
class FocusActivableItemDirective extends RootFocusable
    implements FocusableActivateItem {
  /// Key to assign to the focusable item.
  @Input('focusActivableItem')
  @override
  String key;

  FocusActivableItemDirective(HtmlElement root) : super(root);
}

/// A focusable component with a matching [key].
abstract class FocusableActivateItem implements Focusable {
  String get key;
}

// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:html';

import 'package:angular/angular.dart';
import 'package:angular_components/focus/focus.dart';

/// This directive is used to [ViewChild] focusable element in your view.
///
/// Assign a [key] in order to filter items from a [QueryList].
@Directive(
  selector: '[focusActivableItem]',
  providers: const [
    const Provider(FocusableActivateItem,
        useExisting: FocusActivableItemDirective)
  ],
)
class FocusActivableItemDirective extends RootFocusable
    implements FocusableActivateItem {
  /// Key to assign to the focusable item.
  @Input('focusActivableItem')
  @override
  String key;

  FocusActivableItemDirective(HtmlElement root) : super(root);
}

/// A focusable component with a matching [key].
abstract class FocusableActivateItem implements Focusable {
  String get key;
}

Remove visibility.all from @Component annotations. This is potentially BREAKING change.
Remove visibility.all from @Component annotations. This is potentially BREAKING
change.

Please review carefully. Breakage will only be caught if the code is covered by
tests. Reject this change if you believe it breaks you.

If the component needs to be injected anywhere in the app, you can get a
runtime exception after this change. This should be caught by tests using your
components, and fixing the issue should be trivial, as the exceptions have good
error messages, such as "No provider found for FooComponent".

PiperOrigin-RevId: 190727962
