<commit_before><link rel="import" href="full-calendar-month-view-day.html">
<link rel="import" href="full-calendar-month-view-item.html">
<link rel="import" href="../full-calendar-behavior.html">

<dom-module id="full-calendar-month-view">
  <template>
    <style>
      :host {
        display: block;
      }

      #calendarArea {
        position: relative;
        @apply(--layout-fit);
        @apply(--layout-vertical);
      }

      .week-item {
        display: block;
        @apply(--layout-flex);
        @apply(--layout-horizontal);
      }

      .week-item > full-calendar-month-view-day {
        @apply(--layout-flex);
      }

      full-calendar-month-view-day {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          border-top-style: none;
          border-left-style: none;
          color: #d5d5d5;
        };
      }

      .week-item:first-child full-calendar-month-view-day {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          border-left-style: none;
          color: #d5d5d5;
        };
      }

      .week-item full-calendar-month-view-day:first-child {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          border-top-style: none;
          color: #d5d5d5;
        };
      }

      .week-item:first-child full-calendar-month-view-day:first-child {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          color: #d5d5d5;
        };
      }
    </style>

    <full-calendar-events id="eventStore"
      on-full-calendar-events-added="_eventsAdded">
    </full-calendar-events>

    <div id="calendarArea">
      <template is="dom-repeat" items="[[_weekList]]" as="week" index-as="y">
        <div class="week-item" week$="[[week.id]]">
          <template is="dom-repeat" items=[[week.days]] as="day" index-as="x">
            <full-calendar-month-view-day
              coords$="[[_printCoords(x, y)]]"
              date$="[[_printDate(day)]]"
              label="[[day.label]]">
            </full-calendar-month-view-day>
          </template>
        </div>
      </template>
    </div>
  </template>

  <script>
    Polymer({
      is: 'full-calendar-month-view',

      properties: {

        /**
         * Year to show
         */
        year: {
          type: Number,
          value: function() {
            return moment().get('year');
          }
        },

        /**
         * Month to show
         */
        month: {
          type: Number,
          value: function() {
            return moment().get('month');
          }
        },

        /**
         * First day of the week. Monday on default.
         */
        firstWeekDay: {
          type: Number,
          value: 1
        }
      },

      behaviors: [
        Polymer.FullCalendarBehavior
      ],

      observers: [
        '_dateChanged(month, year, firstWeekDay)'
      ],

      _dateChanged: function(month, year) {
        this._fillList(month, year);
      },

      _fillList: function(month, year) {
        this._weekList = this.getWeekList(month, year);
      },

      _printCoords: function(x, y) {
        return x + ':' + y;
      },

      _printDate: function(day) {
        return day.label + ':' + day.moment.get('month');
      },

      /**
       * Generates a matrix for the calendar grid.
       * True stands for a free row.
       * [
       * 	 week0: [
       * 	 	 day0: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day1: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day2: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day3: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day4: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day5: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day6: [ row0: true, row1: true, row2: true, row3: true ]
       * 	 ],
       * 	 ...
       * ]
       */
      _resetMatrix: function() {
        this._rows = 4;
        this._matrix = [];
        for (var i = 0; i < this._weekList.length; i++) {
          var weekMatrix = [];
          for (var d = 0, ld = this._weekList[i].days.length; d < ld; ++d) {
            var rowMatrix = [];
            for (var r = 0; r < this._rows; ++r) {
              rowMatrix.push(true);
            }
            weekMatrix.push(rowMatrix);<commit_msg>Always have 6 weeks to keep consistent height.<commit_after><link rel="import" href="full-calendar-month-view-day.html">
<link rel="import" href="full-calendar-month-view-item.html">
<link rel="import" href="../full-calendar-behavior.html">

<dom-module id="full-calendar-month-view">
  <template>
    <style>
      :host {
        display: block;
      }

      #calendarArea {
        position: relative;
        @apply(--layout-fit);
        @apply(--layout-vertical);
      }

      .week-item {
        display: block;
        @apply(--layout-flex);
        @apply(--layout-horizontal);
      }

      .week-item > full-calendar-month-view-day {
        @apply(--layout-flex);
      }

      full-calendar-month-view-day {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          border-top-style: none;
          border-left-style: none;
          color: #d5d5d5;
        };
      }

      .week-item:first-child full-calendar-month-view-day {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          border-left-style: none;
          color: #d5d5d5;
        };
      }

      .week-item full-calendar-month-view-day:first-child {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          border-top-style: none;
          color: #d5d5d5;
        };
      }

      .week-item:first-child full-calendar-month-view-day:first-child {
        --full-calendar-month-view-day-cell-bg: {
          border: solid 1px #d5d5d5;
          color: #d5d5d5;
        };
      }

      .non-active {
        background: #e9e9e9;
      }
    </style>

    <full-calendar-events id="eventStore"
      on-full-calendar-events-added="_eventsAdded">
    </full-calendar-events>

    <div id="calendarArea">
      <template is="dom-repeat" items="[[_weekList]]" as="week" index-as="y">
        <div class="week-item" week$="[[week.id]]">
          <template is="dom-repeat" items=[[week.days]] as="day" index-as="x">
            <full-calendar-month-view-day
              class$="[[_calcClass(day)]]"
              coords$="[[_printCoords(x, y)]]"
              date$="[[_printDate(day)]]"
              label="[[day.label]]">
            </full-calendar-month-view-day>
          </template>
        </div>
      </template>
    </div>
  </template>

  <script>
    Polymer({
      is: 'full-calendar-month-view',

      properties: {

        /**
         * Year to show
         */
        year: {
          type: Number,
          value: function() {
            return moment().get('year');
          }
        },

        /**
         * Month to show
         */
        month: {
          type: Number,
          value: function() {
            return moment().get('month');
          }
        },

        /**
         * First day of the week. Monday on default.
         */
        firstWeekDay: {
          type: Number,
          value: 1
        }
      },

      behaviors: [
        Polymer.FullCalendarBehavior
      ],

      observers: [
        '_dateChanged(month, year, firstWeekDay)'
      ],

      _dateChanged: function(month, year) {
        this._fillList(month, year);
      },

      _fillList: function(month, year) {
        this._weekList = this.getWeekList(month, year);
      },

      _printCoords: function(x, y) {
        return x + ':' + y;
      },

      _printDate: function(day) {
        return day.label + ':' + day.moment.get('month');
      },

      _calcClass: function(day) {
        if (day.moment.get('month') != this.month) {
          return 'non-active';
        }
      },

      /**
       * Generates a matrix for the calendar grid.
       * True stands for a free row.
       * [
       * 	 week0: [
       * 	 	 day0: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day1: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day2: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day3: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day4: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day5: [ row0: true, row1: true, row2: true, row3: true ],
       * 	 	 day6: [ row0: true, row1: true, row2: true, row3: true ]
       * 	 ],
       * 	 ...
       * ]
       */
      _resetMatrix: function() {
        this._rows = 4;
        this._matrix = [];
        for (var i = 0; i < this._weekList.length; i++) {
          var weekMatrix = [];
          for (var d = 0, ld = this._weekList[i].days.length; d < ld; ++d) {
            var rowMatrix = [];
            for (var r = 0; r < this._rows; ++r) {
              rowMatrix.push(true);
            }
            weekMatrix.push(rowMatrix);
{'fraction_non_alphanumeric': 0.15770570309098825, 'fraction_numerical': 0.01545494122768829, 'mean_word_length': 1.5891800507185123, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 47, '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': '4319681', 'n_tokens_mistral': 3089, 'n_tokens_neox': 2985, 'n_words': 577}