// 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 'package:angular/angular.dart';
import 'package:angular_components/content/deferred_content_aware.dart';

import 'material_drawer_base.dart';

/// A persistent drawer that can be pinned open or closed.
///
/// Need to include package:angular_components/app_layout/layout.scss.css
/// in the list of styleUrls of the containing component.
///
/// Works with deferred content.
/// __Example usage:__
///     <material-drawer persistent #drawer="drawer">
///         ... content here ...
///     </material-drawer>
///     <material-button (trigger)="drawer.toggle()">
///       Toggle Drawer
///     </material-button>
@Directive(
  selector: 'material-drawer[persistent]',
  exportAs: 'drawer',
  providers: const [
    const Provider(DeferredContentAware,
        useExisting: MaterialPersistentDrawerDirective),
  ],
  host: const {
    '[class.mat-drawer-collapsed]': '!visible',
    '[class.mat-drawer-expanded]': 'visible',
  },
  // TODO(google): Change to `Visibility.local` to reduce code size.
  visibility: Visibility.all,
)
class MaterialPersistentDrawerDirective extends MaterialDrawerBase {
  MaterialPersistentDrawerDirective() : super();
}

// 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 'package:angular/angular.dart';
import 'package:angular_components/content/deferred_content_aware.dart';

import 'material_drawer_base.dart';

/// A persistent drawer that can be pinned open or closed.
///
/// Need to include package:angular_components/app_layout/layout.scss.css
/// in the list of styleUrls of the containing component.
///
/// Works with deferred content.
/// __Example usage:__
///     <material-drawer persistent #drawer="drawer">
///         ... content here ...
///     </material-drawer>
///     <material-button (trigger)="drawer.toggle()">
///       Toggle Drawer
///     </material-button>
@Directive(
  selector: 'material-drawer[persistent]',
  exportAs: 'drawer',
  providers: const [
    const Provider(DeferredContentAware,
        useExisting: MaterialPersistentDrawerDirective),
  ],
  host: const {
    '[class.mat-drawer-collapsed]': '!visible',
    '[class.mat-drawer-expanded]': 'visible',
  },
  visibility: Visibility.all, // Injected by child elements.
)
class MaterialPersistentDrawerDirective extends MaterialDrawerBase {
  MaterialPersistentDrawerDirective() : super();
}

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: 189922359
