<commit_before>goog.provide('gmf.ThemeselectorController');
goog.provide('gmf.themeselectorDirective');

goog.require('gmf');
goog.require('gmf.ThemeManager');
goog.require('gmf.Themes');
goog.require('gmf.ThemesEventType');


/**
 * Note that this directive works with the {@link gmf.TreeManager}. Setting the
 * theme will update the "tree" object of this {@link gmf.TreeManager}.
 * Example:
 *
 *     <gmf-themeselector
 *         id="themes"
 *         data-header-title="Themes"
 *         gmf-themeselector-filter="::mainCtrl.filter">
 *     </gmf-themeselector>
 *
 * The theme selector can operate in a 'flush' or 'add' mode. For more information
 * about these modes, refer to the documentation of {@link gmf.TreeManager}.
 *
 * When used in 'flush' mode, the current theme can be shown as follows:
 *
 *     <b ng-if="!mainCtrl.gmfThemeManager.themeName" translate>Loading...</b>
 *     <b ng-if="mainCtrl.gmfThemeManager.themeName">{{mainCtrl.gmfThemeManager.themeName|translate}}</b>
 *
 * @htmlAttribute {Function} gmf-themeselector-filter The themes filter.
 * @return {angular.Directive} The directive specs.
 * @ngInject
 * @ngdoc directive
 * @ngname gmfThemeselector
 */
gmf.themeselectorDirective = function() {
  return {
    restrict: 'E',
    controller: 'gmfThemeselectorController',
    scope: {
      'filter': '=gmfThemeselectorFilter'
    },
    bindToController: true,
    controllerAs: 'tsCtrl',
    templateUrl: gmf.baseTemplateUrl + '/themeselector.html'
  };
};

gmf.module.directive('gmfThemeselector', gmf.themeselectorDirective);


/**
 * @param {!angular.Scope} $scope Angular scope.
 * @param {gmf.ThemeManager} gmfThemeManager Tree manager service.
 * @param {gmf.Themes} gmfThemes Themes service.
 * @constructor
 * @export
 * @ngInject<commit_msg>Easier to understand docs<commit_after>goog.provide('gmf.ThemeselectorController');
goog.provide('gmf.themeselectorDirective');

goog.require('gmf');
goog.require('gmf.ThemeManager');
goog.require('gmf.Themes');
goog.require('gmf.ThemesEventType');


/**
 * Note that this directive works with the {@link gmf.TreeManager}. Setting the
 * theme will update the "tree" object of this {@link gmf.TreeManager}.
 *
 * Example:
 *
 *      <a href class="btn btn-default btn-block btn-primary" data-toggle="dropdown">
 *          <span class="fa fa-grid"></span>
 *          <span translate>Theme:</span>
 *          <b ng-if="!mainCtrl.gmfThemeManager.themeName" translate>Loading...</b>
 *          <b ng-if="mainCtrl.gmfThemeManager.themeName">{{mainCtrl.gmfThemeManager.themeName|translate}}</b>
 *          <span class="caret"></span>
 *      </a>
 *      <gmf-themeselector
 *         id="themes"
 *         data-header-title="Themes"
 *         gmf-themeselector-filter="::mainCtrl.filter">
 *      </gmf-themeselector>
 *      <script>
 *        (function() {
 *          var module = angular.module('app');
 *          module.value('gmfTreeManagerModeFlush', true);
 *        })();
 *      </script>
 *
 * The theme selector can operate in a 'flush' (as above) or 'add' mode. For more information
 * about these modes, refer to the documentation of {@link gmf.TreeManager}.
 *
 * Example in 'add' mode:
 *
 *      <a href class="btn btn-default btn-block btn-primary" data-toggle="dropdown">
 *          <span class="fa fa-grid"></span>
 *          <span translate>Themes</span>
 *          <span class="caret"></span>
 *      </a>
 *      <gmf-themeselector
 *         id="themes"
 *         data-header-title="Themes"
 *         gmf-themeselector-filter="::mainCtrl.filter">
 *      </gmf-themeselector>
 *      <script>
 *        (function() {
 *          var module = angular.module('app');
 *          module.value('gmfTreeManagerModeFlush', false);
 *        })();
 *      </script>
 *
 * @htmlAttribute {Function} gmf-themeselector-filter The themes filter.
 * @return {angular.Directive} The directive specs.
 * @ngInject
 * @ngdoc directive
 * @ngname gmfThemeselector
 */
gmf.themeselectorDirective = function() {
  return {
    restrict: 'E',
    controller: 'gmfThemeselectorController',
    scope: {
      'filter': '=gmfThemeselectorFilter'
    },
    bindToController: true,
    controllerAs: 'tsCtrl',
    templateUrl: gmf.baseTemplateUrl + '/themeselector.html'
  };
};

gmf.module.directive('gmfThemeselector', gmf.themeselectorDirective);


/**
 * @param {!angular.Scope} $scope Angular scope.
 * @param {gmf.ThemeManager} gmfThemeManager Tree manager service.
 * @param {gmf.Themes} gmfThemes Themes service.
 * @constructor
 * @export
 * @ngInject
{'fraction_non_alphanumeric': 0.14940763492759981, 'fraction_numerical': 0.0, 'mean_word_length': 3.42621359223301, 'pattern_counts': {'":': 3, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4616696', 'n_tokens_mistral': 1496, 'n_tokens_neox': 1477, 'n_words': 304}