<commit_before>'use strict'

// dialog related modules
import events from './component/events'
import emitter from './module/emitter'
import controller from './component/controller'
import attach from './module/attach'
import insert from './component/insert'
import event from './element/event.js'
import css from './module/css'

import Layout from './layout'

let defaults = {
  prefix: 'material',
  class: 'dialog',
  events: [
    ['wrapper.click', 'close']
  ]
}

class Dialog {
  /**
   * Constructor
   * @param  {Object} options - Component options
   * @return {Object} Class instance
   */
  constructor(options) {
    this.options = Object.assign({}, defaults, options || {})
    this.init()
    this.build()
    this.attach()

    this.wrapper.style.display = 'none'

    return this
  }

  /**
   * Constructor
   * @param  {Object} options The class options
   * @return {Object} This class instance
   */
  init() {
    // init options and merge options to defaults

    // implement modules
    Object.assign(this, events, emitter, attach, insert)

    this.controller = controller

    return this
  }

  /**
   * build the component using the super method
   * @return {Object} The class instance
   */
  build() {
    var tag = this.options.tag || 'div'
    // this.wrapper = new Element(this.options.element);
    this.wrapper = document.createElement(tag)

    css.add(this.wrapper, 'material-dialog')
    if (this.options.css) {
      css.add(this.wrapper, this.options.css)
    }

    this.surface = document.createElement(tag)

    css.add(this.surface, 'dialog-surface')

    this.insertElement(this.surface, this.wrapper)

    this.options.layout.wrapper = this.surface
    this.layout = new Layout(this.options.layout)

    event.add(this.surface, 'click', function(ev) {
      ev.stopPropagation()
    })

    // this.wrapper = element.createElement(tag);
  }

  close() {
    css.add(this.wrapper, 'dialog-closing')

    var delayMillis = 200 // 1 second
    setTimeout(() => {
      this.wrapper.style.display = 'none'
      css.remove(this.wrapper, 'dialog-closing')
      css.remove(this.wrapper, 'dialog-show')
    }, delayMillis)
  }

  show() {
    this.wrapper.style.display = 'flex'
    // css.add(this.wrapper, 'dialog-showing');

    var delayMillis = 100 // 1 second

    setTimeout(() => {
      css.add(this.wrapper, 'dialog-show')
      // css.remove(this.wrapper, 'dialog-showing');
    }, delayMillis)
  }
}

export default Dialog<commit_msg>update dialog related to the layout update<commit_after>'use strict'

// dialog related modules
import events from './component/events'
import emitter from './module/emitter'
import controller from './component/controller'
import attach from './module/attach'
import insert from './component/insert'
import event from './element/event.js'
import css from './module/css'

import Layout from './layout'

let defaults = {
  prefix: 'material',
  class: 'dialog',
  events: [
    ['wrapper.click', 'close']
  ]
}

class Dialog {
  /**
   * Constructor
   * @param  {Object} options - Component options
   * @return {Object} Class instance
   */
  constructor(options) {
    this.options = Object.assign({}, defaults, options || {})
    this.init()
    this.build()
    this.attach()

    this.wrapper.style.display = 'none'

    return this
  }

  /**
   * Constructor
   * @param  {Object} options The class options
   * @return {Object} This class instance
   */
  init() {
    // init options and merge options to defaults

    // implement modules
    Object.assign(this, events, emitter, attach, insert)

    this.controller = controller

    return this
  }

  /**
   * build the component using the super method
   * @return {Object} The class instance
   */
  build() {
    var tag = this.options.tag || 'div'
    // this.wrapper = new Element(this.options.element);
    this.wrapper = document.createElement(tag)

    css.add(this.wrapper, 'material-dialog')
    if (this.options.css) {
      css.add(this.wrapper, this.options.css)
    }

    this.surface = document.createElement(tag)

    css.add(this.surface, 'dialog-surface')

    this.insertElement(this.surface, this.wrapper)

    this.options.layout.wrapper = this.surface
    this.layout = new Layout(this.options.layout, this.surface)

    event.add(this.surface, 'click', function(ev) {
      ev.stopPropagation()
    })

    // this.wrapper = element.createElement(tag);
  }

  close() {
    css.add(this.wrapper, 'dialog-closing')

    var delayMillis = 200 // 1 second
    setTimeout(() => {
      this.wrapper.style.display = 'none'
      css.remove(this.wrapper, 'dialog-closing')
      css.remove(this.wrapper, 'dialog-show')
    }, delayMillis)
  }

  show() {
    this.wrapper.style.display = 'flex'
    // css.add(this.wrapper, 'dialog-showing');

    var delayMillis = 100 // 1 second

    setTimeout(() => {
      css.add(this.wrapper, 'dialog-show')
      // css.remove(this.wrapper, 'dialog-showing');
    }, delayMillis)
  }
}

export default Dialog
{'fraction_non_alphanumeric': 0.142316125174407, 'fraction_numerical': 0.0031891568666533787, 'mean_word_length': 2.874903474903475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1491754', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1498, 'n_words': 368}