<commit_before>import frontMatter from 'front-matter';
import { getLoaderConfig } from 'loader-utils';
import HighlightJS from 'highlight.js';

import formatImport from './formatters/import';
import formatModule from './formatters/module';
import formatStatic from './formatters/static';
import StringReplacementCache from './string-replacement-cache';
import walkHtml from './process-html';

const MarkdownIt = (() => {
  // welcome, to the
  //
  //  d8b                        d8b
  //  ?88                        ?88
  //   88b                        88b
  //   888888b  d888b8b   d8888b  888  d88'
  //   88P `?8bd8P' ?88  d8P' `P  888bd8P'
  //  d88   88P88b  ,88b 88b     d88888b
  // d88'   88b`?88P'`88b`?888P'd88' `?88b,
  //
  // d88888P  d8888b   88bd88b  d8888b
  //    d8P' d8P' ?88  88P' ?8bd8b_,dP
  //  d8P'   88b  d88 d88   88P88b
  // d88888P'`?8888P'd88'   88b`?888P'
  //
  // Replace MarkdownIt's internal HTML regexes with JSX-friendly ones
  const markdownItHtmlRegexes = require('markdown-it/lib/common/html_re');
  Object.keys(markdownItHtmlRegexes).forEach((regexName) => {
    const regex = markdownItHtmlRegexes[regexName];
    // this adds support for the `.` character within tag names
    markdownItHtmlRegexes[regexName] = new RegExp(
      regex.source.replace(
        /\[A\-Za\-z\]\[A\-Za\-z0\-9\\-\]\*/g,
        '[A-Za-z][A-Za-z0-9\\.\\-]*'
      ),
      regex.flags
    );
  });

  return require('markdown-it');
})();

const ASSIGNMENT_COMMENT_PREFIX = '[mcl-assignment]:';

// const TsXML = {};

// const processChildNodes = (node, passElementProps) => {
//   if (node instanceof TsXML.CommentNode) {
//     const content = node.content.trim();

//     // Don't do anything to replaced assignment comments!
//     if (content.indexOf(ASSIGNMENT_COMMENT_PREFIX) !== 0) {
//       // Replace XML comment nodes with JSX style comment nodes
//       const oldNode = node;

//       node = new TsXML.TextNode();
//       node.content = `{/* ${content} */}`;

//       oldNode.parentNode.replaceChild(oldNode, node);
//     }
//   } else if (node instanceof TsXML.TextNode) {
//     // Wrap strings containing significant whitespace or curly braces
//     if (node.content && node.content.match(/^\s|{|}|\s$/)) {
//       node.content = `{${formatEscape(node.content)}}`;
//     }
//   } else if (node.tagName) {
//     // Pass through `elementProps` to tags
//     if (passElementProps) {
//       node.attrList[`{...elementProps['${node.tagName}']}`] = undefined;
//     }
//   }

//   if (node.childNodes) {
//     node.forEachChildNode((childNode) => {
//       processChildNodes(childNode, passElementProps);
//     });
//   }
// };

const DEFAULT_CONFIGURATION = {
  implicitlyImportReact: true,
  passElementProps: false,
  markdownItPlugins: []
};

module.exports = function(source) {
  // This loader is deterministic, and will
  // return the same thing for the same inputs!
  this.cacheable && this.cacheable();

  // Loads configuration from webpack config as well as loader query string
  const config = Object.assign({}, DEFAULT_CONFIGURATION, getLoaderConfig(this, 'markdownComponentLoader'));

  const invalidStatics = ['propTypes'];
  const imports = [];

  // Import React and PropTypes unless we've been asked otherwise
  if (config.implicitlyImportReact) {
    imports.push(formatImport('React', 'react'));
    imports.push(formatImport('PropTypes', 'prop-types'));
  }

  // Pull out imports & front-matter
  const { body: markdown, attributes: { imports: importMap, ...staticAttributes } } = frontMatter(source);

  // Add additional imports
  if (importMap) {
    Object.keys(importMap).forEach((name) => {
      imports.push(formatImport(name, importMap[name]));
    });
  }

  // Disallow passing `defaultProps` if we're passing our own
  if (config.passElementProps) {
    invalidStatics.push('defaultProps');
  }

  // Add additional statics
  const statics = Object.keys(staticAttributes).map((attribute) => {
    if (invalidStatics.indexOf(attribute) !== -1) {
      throw new Error(`You can't supply a \`${attribute}\` static! That name is reserved.`);
    }

    return formatStatic(attribute, staticAttributes[attribute]);
  });

  // Hold onto JSX properties and assignment expressions before converting
  const htmlTagIndexes = [];

  // Find all opening or void HTML tags
  walkHtml(
    markdown,
    (match, tagFragment, offset, string, tag) => {
      // Once we get a tag which is closing
      if (typeof tag.closeIndex === 'number') {
        // Push its start and end coordinates into our list
        if (typeof tag.contentIndex === 'number') {
          htmlTagIndexes.push([tag.openIndex, tag.contentIndex]);
        } else {
          htmlTagIndexes.push([tag.openIndex, tag.closeIndex]);
        }
      }
    }
  );

  let offsetForPropertyReplacements = 0;
  let markdownSansJsxProperties = markdown;

  // Then, within each HTML tag we found, replace any assignment expressions
  const jsxPropertyCache = new StringReplacementCache(
    /[\w]+={[^}]*}}?|{\s*\.\.\.[^}]*}/g
  );

  htmlTagIndexes.forEach(([start, end]) => {
    const startIndex = start + offsetForPropertyReplacements;
    const endIndex = end + offsetForPropertyReplacements;

    const tagWithNoReplacements = markdownSansJsxProperties.slice(startIndex, endIndex);
    const tagWithPropertyReplacements = jsxPropertyCache.load(tagWithNoReplacements);

    markdownSansJsxProperties = markdownSansJsxProperties.slice(0, startIndex) + tagWithPropertyReplacements + markdownSansJsxProperties.slice(endIndex);

    offsetForPropertyReplacements += tagWithPropertyReplacements.length - tagWithNoReplacements.length;
  });

  const assignmentExpressionCache = new StringReplacementCache(
    /{({\s*(?:<.*?>|.*?)\s*})}/g,
    (match, value) => value,
    (identityHash) => `<!-- ${ASSIGNMENT_COMMENT_PREFIX}${identityHash} -->`
  );

  const markdownSansAssignments = assignmentExpressionCache.load(markdownSansJsxProperties);

  // Configure Markdown renderer, highlight code snippets, and post-process
  let renderer = new MarkdownIt()
    .configure('commonmark')
    .enable(['smartquotes'])
    .set({
      // We need explicit line breaks
      breaks: true,
      typographer: config.typographer,
      highlight(code, languageHint) {
        let highlightedContent;

        HighlightJS.configure({ tabReplace: '  ' });

        // Try highlighting with a given hint
        if (languageHint && HighlightJS.getLanguage(languageHint)) {
          try {
            highlightedContent = HighlightJS.highlight(languageHint, code).value;
          } catch (err) {} // eslint-disable-line no-empty
        }

        // Highlight without a hint
        if (!highlightedContent) {
          try {
            highlightedContent = HighlightJS.highlightAuto(code).value;
          } catch (err) {} // eslint-disable-line no-empty
        }

        return highlightedContent
          .replace(/\n/g, '
')
          .replace(/<(!-- \[mcl-assignment\]:[^\s]+ --)>/, '<$1>');
      }
    });

  // Load MarkdownIt plugins
  if (config.markdownItPlugins && Array.isArray(config.markdownItPlugins)) {
    renderer = config.markdownItPlugins
      .reduce(
        (markdownRenderer, pluginDefinition) => (
          markdownRenderer.use(...(
            Array.isArray(pluginDefinition)
              ? pluginDefinition
              : [pluginDefinition]
          ))
        ),
        renderer
      );
  }

  const html = renderer.render(markdownSansAssignments) || '';

  // Unload caches so we've got our values back!
  const jsx = jsxPropertyCache.unload(assignmentExpressionCache.unload(
    html
      .replace(/\n/g, `\n        `) // Indent for pretty inspector output 🎉
      .replace(/\n\s*$/g, '')        // Remove the trailing blank line
  ));

  return formatModule(
    config,
    imports.join(''),
    statics.join(''),
    jsx
  );
};
<commit_msg>⏮ Keep going...<commit_after>import frontMatter from 'front-matter';
import { getLoaderConfig } from 'loader-utils';
import HighlightJS from 'highlight.js';

import formatImport from './formatters/import';
import formatModule from './formatters/module';
import formatStatic from './formatters/static';
import StringReplacementCache from './string-replacement-cache';
import walkHtml from './process-html';

const MarkdownIt = (() => {
  // welcome, to the
  //
  //  d8b                        d8b
  //  ?88                        ?88
  //   88b                        88b
  //   888888b  d888b8b   d8888b  888  d88'
  //   88P `?8bd8P' ?88  d8P' `P  888bd8P'
  //  d88   88P88b  ,88b 88b     d88888b
  // d88'   88b`?88P'`88b`?888P'd88' `?88b,
  //
  // d88888P  d8888b   88bd88b  d8888b
  //    d8P' d8P' ?88  88P' ?8bd8b_,dP
  //  d8P'   88b  d88 d88   88P88b
  // d88888P'`?8888P'd88'   88b`?888P'
  //
  // Replace MarkdownIt's internal HTML regexes with JSX-friendly ones
  const markdownItHtmlRegexes = require('markdown-it/lib/common/html_re');
  Object.keys(markdownItHtmlRegexes).forEach((regexName) => {
    const regex = markdownItHtmlRegexes[regexName];
    // this adds support for the `.` character within tag names
    markdownItHtmlRegexes[regexName] = new RegExp(
      regex.source.replace(
        /\[A\-Za\-z\]\[A\-Za\-z0\-9\\-\]\*/g,
        '[A-Za-z][A-Za-z0-9\\.\\-]*'
      ),
      regex.flags
    );
  });

  return require('markdown-it');
})();

// const ASSIGNMENT_COMMENT_PREFIX = '[mcl-assignment]:';

// const TsXML = {};

// const processChildNodes = (node, passElementProps) => {
//   if (node instanceof TsXML.CommentNode) {
//     const content = node.content.trim();

//     // Don't do anything to replaced assignment comments!
//     if (content.indexOf(ASSIGNMENT_COMMENT_PREFIX) !== 0) {
//       // Replace XML comment nodes with JSX style comment nodes
//       const oldNode = node;

//       node = new TsXML.TextNode();
//       node.content = `{/* ${content} */}`;

//       oldNode.parentNode.replaceChild(oldNode, node);
//     }
//   } else if (node instanceof TsXML.TextNode) {
//     // Wrap strings containing significant whitespace or curly braces
//     if (node.content && node.content.match(/^\s|{|}|\s$/)) {
//       node.content = `{${formatEscape(node.content)}}`;
//     }
//   } else if (node.tagName) {
//     // Pass through `elementProps` to tags
//     if (passElementProps) {
//       node.attrList[`{...elementProps['${node.tagName}']}`] = undefined;
//     }
//   }

//   if (node.childNodes) {
//     node.forEachChildNode((childNode) => {
//       processChildNodes(childNode, passElementProps);
//     });
//   }
// };

const DEFAULT_CONFIGURATION = {
  implicitlyImportReact: true,
  passElementProps: false,
  markdownItPlugins: []
};

module.exports = function(source) {
  // This loader is deterministic, and will
  // return the same thing for the same inputs!
  this.cacheable && this.cacheable();

  // Loads configuration from webpack config as well as loader query string
  const config = Object.assign({}, DEFAULT_CONFIGURATION, getLoaderConfig(this, 'markdownComponentLoader'));

  const invalidStatics = ['propTypes'];
  const imports = [];

  // Import React and PropTypes unless we've been asked otherwise
  if (config.implicitlyImportReact) {
    imports.push(formatImport('React', 'react'));
    imports.push(formatImport('PropTypes', 'prop-types'));
  }

  // Pull out imports & front-matter
  const { body: markdown, attributes: { imports: importMap, ...staticAttributes } } = frontMatter(source);

  // Add additional imports
  if (importMap) {
    Object.keys(importMap).forEach((name) => {
      imports.push(formatImport(name, importMap[name]));
    });
  }

  // Disallow passing `defaultProps` if we're passing our own
  if (config.passElementProps) {
    invalidStatics.push('defaultProps');
  }

  // Add additional statics
  const statics = Object.keys(staticAttributes).map((attribute) => {
    if (invalidStatics.indexOf(attribute) !== -1) {
      throw new Error(`You can't supply a \`${attribute}\` static! That name is reserved.`);
    }

    return formatStatic(attribute, staticAttributes[attribute]);
  });

  // Hold onto JSX properties and assignment expressions before converting
  const htmlTagIndexes = [];

  // Find all opening or void HTML tags
  walkHtml(
    markdown,
    (match, tagFragment, offset, string, tag) => {
      // Once we get a tag which is closing
      if (typeof tag.closeIndex === 'number') {
        // Push its start and end coordinates into our list
        if (typeof tag.contentIndex === 'number') {
          htmlTagIndexes.push([tag.openIndex, tag.contentIndex]);
        } else {
          htmlTagIndexes.push([tag.openIndex, tag.closeIndex]);
        }
      }
    }
  );

  let offsetForPropertyReplacements = 0;
  let markdownSansJsxProperties = markdown;

  // Then, within each HTML tag we found, replace any assignment expressions
  const jsxPropertyCache = new StringReplacementCache(
    /[\w]+={[^}]*}}?|{\s*\.\.\.[^}]*}/g
  );

  htmlTagIndexes.forEach(([start, end]) => {
    const startIndex = start + offsetForPropertyReplacements;
    const endIndex = end + offsetForPropertyReplacements;

    const tagWithNoReplacements = markdownSansJsxProperties.slice(startIndex, endIndex);
    const tagWithPropertyReplacements = jsxPropertyCache.load(tagWithNoReplacements);

    markdownSansJsxProperties = markdownSansJsxProperties.slice(0, startIndex) + tagWithPropertyReplacements + markdownSansJsxProperties.slice(endIndex);

    offsetForPropertyReplacements += tagWithPropertyReplacements.length - tagWithNoReplacements.length;
  });

  const assignmentExpressionCache = new StringReplacementCache(
    /{({\s*(?:<.*?>|.*?)\s*})}/g,
    (match, value) => value
  );

  const markdownSansAssignments = assignmentExpressionCache.load(markdownSansJsxProperties);

  // Configure Markdown renderer, highlight code snippets, and post-process
  let renderer = new MarkdownIt()
    .configure('commonmark')
    .enable(['smartquotes'])
    .set({
      // We need explicit line breaks
      breaks: true,
      typographer: config.typographer,
      highlight(code, languageHint) {
        let highlightedContent;

        HighlightJS.configure({ tabReplace: '  ' });

        // Try highlighting with a given hint
        if (languageHint && HighlightJS.getLanguage(languageHint)) {
          try {
            highlightedContent = HighlightJS.highlight(languageHint, code).value;
          } catch (err) {} // eslint-disable-line no-empty
        }

        // Highlight without a hint
        if (!highlightedContent) {
          try {
            highlightedContent = HighlightJS.highlightAuto(code).value;
          } catch (err) {} // eslint-disable-line no-empty
        }

        return highlightedContent
          .replace(/\n/g, '
');
      }
    });

  // Load MarkdownIt plugins
  if (config.markdownItPlugins && Array.isArray(config.markdownItPlugins)) {
    renderer = config.markdownItPlugins
      .reduce(
        (markdownRenderer, pluginDefinition) => (
          markdownRenderer.use(...(
            Array.isArray(pluginDefinition)
              ? pluginDefinition
              : [pluginDefinition]
          ))
        ),
        renderer
      );
  }

  const html = renderer.render(markdownSansAssignments) || '';

  // TODO: Walk over each element, replacing HTMLisms with JSXisms
  // (SEE commented out `processChildNodes`)

  // Unload caches so we've got our values back!
  const jsx = jsxPropertyCache.unload(assignmentExpressionCache.unload(
    html
      .replace(/\n/g, `\n        `) // Indent for pretty inspector output 🎉
      .replace(/\n\s*$/g, '')        // Remove the trailing blank line
  ));

  return formatModule(
    config,
    imports.join(''),
    statics.join(''),
    jsx
  );
};
<|endoftext|>


<commit_before>/**
 * full-select
 * A lightweight JS script for custom select creation.
 *
 * v0.0.1
 * (https://github.com/gionatan-lombardi/full-select)
 *
 * Copyright (c) 2016 Gionatan Lombardi
 * MIT License
 */

const defaultOptions = {
  containerClass: 'full-select-container',
  openerClass: 'full-select-opener',
  panelClass: 'full-select-panel',
  optionClass: 'full-select-option',
  optgroupClass: 'full-select-optgroup',
  scrollToSelected: true
}

function builder(select, cstOptions) {

  var isOpen = false;
  var containerClass = "fullSelect";

  // Custom Select Markup

  // Creates the container/wrapper
  var container = document.createElement("div");
  container.className = cstOptions.containerClass + " " + containerClass;

  // Creates the opener
  var opener = document.createElement("span");
  opener.className = cstOptions.openerClass;
  opener.setAttribute('tabindex', '0');
  opener.innerHTML = '' + ( select.selectedIndex !== -1 ? select.options[select.selectedIndex].text : '' ) + '';

  // Creates the panel
  // and injects the markup of the select inside
  // with some tag and attributes replacement
  var panel = document.createElement("div");
  panel.className = cstOptions.panelClass;
  panel.innerHTML = select.innerHTML
    .replace(/<optgroup/g, '
/g, 'div>')
    .replace(/<option/g, '
/g, 'div>')
    .replace(/value="/g, 'data-value="')
    .replace(/value='/g, 'data-value=\'');

  // Injects the container in the original DOM position of the select
  container.appendChild(opener);
  select.parentNode.replaceChild(container, select);
  container.appendChild(select);
  container.appendChild(panel);

  // Event Init

  document.addEventListener('click', handleEvent)

  // Private Fuctions

  function handleEvent(e) {

    // On click on the opener opens/closes the panel
    if (e.target === opener || opener.contains(e.target)) {
      if (isOpen) {
        close();
      } else {
        open();
      }
    } else {
      if (isOpen) {
        close();
      }
    }

  }

  function open() {

    // Closes all instances of plugin
    var openedFullSelect = document.querySelector("." + containerClass + " .is-open")
    if (openedFullSelect) {
      openedFullSelect.parentNode.fullSelect.close();
    }

    // Opens only the clicked one
    opener.classList.add('is-active');
    panel.classList.add('is-open');

    // TODO: Sets the selected option
    var selectedOption = ( select.selectedIndex !== -1 ? select.options[select.selectedIndex] : false )
    if (selectedOption) {
      panel.querySelector('div[data-value="' + selectedOption.value + '"]').classList.add('is-selected');
    }

    isOpen = true;

  }

  function close() {

    opener.classList.remove('is-active');
    panel.classList.remove('is-open');

    // TODO: remove focus
    // panel.querySelector('.has-focus').classList.remove('has-focus');

    isOpen = false;

  }

  // Public Exposed Methods
  // and stores the plugin in the HTMLElement
  return container.fullSelect = {
    getOptions: () => cstOptions,
    open: open,
    close: close,
    isOpen: () => isOpen
  };

}

export default function fullSelect(element, options) {

  // Overrides the default options with the ones provided by the user
  var options = Object.assign(defaultOptions, options);
  var nodeList = [];
  var selects = []

  return ( function init() {

    // The plugin is called on a single HTMLElement
    if (element && element instanceof HTMLElement && element.tagName.toUpperCase() === "SELECT") {
      nodeList.push(element)
    // The plugin is called on a selector
    } else if (element && typeof element === 'string') {
      let elementsList = document.querySelectorAll(element);
      for (let i = 0, l = elementsList.length; i < l; ++i) {
        if (elementsList[i] instanceof HTMLElement && elementsList[i].tagName.toUpperCase() === "SELECT") {
          nodeList.push(elementsList[i]);
        }
      }
    // The plugin is called on any HTMLElements list (NodeList, HTMLCollection, Array, etc.)
    } else if (element && element.length) {
      for (let i = 0, l = element.length; i < l; ++i) {
        if (element[i] instanceof HTMLElement && element[i].tagName.toUpperCase() === "SELECT")
          nodeList.push(element[i]);
      }
    }

    // Launches the plugin over every HTMLElement
    // And stores every plugin instance
    for (let i = 0, l = nodeList.length; i < l; ++i) {
      selects.push(builder(nodeList[i], options));
    }

    // Returns all plugin instances
    return selects;

  })()

}<commit_msg>panel creation rework<commit_after>/**
 * full-select
 * A lightweight JS script for custom select creation.
 *
 * v0.0.1
 * (https://github.com/gionatan-lombardi/full-select)
 *
 * Copyright (c) 2016 Gionatan Lombardi
 * MIT License
 */

const defaultOptions = {
  containerClass: 'full-select-container',
  openerClass: 'full-select-opener',
  panelClass: 'full-select-panel',
  optionClass: 'full-select-option',
  optgroupClass: 'full-select-optgroup',
  scrollToSelected: true
}

function builder(select, cstOptions) {

  var isOpen = false;
  var containerClass = "fullSelect";

  // Custom Select Markup

  // Creates the container/wrapper
  var container = document.createElement("div");
  container.className = cstOptions.containerClass + " " + containerClass;

  // Creates the opener
  var opener = document.createElement("span");
  opener.className = cstOptions.openerClass;
  opener.setAttribute('tabindex', '0');
  opener.innerHTML = '' + ( select.selectedIndex !== -1 ? select.options[select.selectedIndex].text : '' ) + '';

  // Creates the panel
  // and injects the markup of the select inside
  // with some tag and attributes replacement
  var panel = document.createElement("div");
  panel.className = cstOptions.panelClass;

  let panelContent = (function parseSelect(node){

    let cstList = [];

    for(let i=0, l=node.children.length; i<l; i++){
      if(node.children[i].tagName.toUpperCase() === "OPTGROUP"){
        let cstOptgroup = document.createElement("div");
        cstOptgroup.classList.add(cstOptions.optgroupClass);
        cstOptgroup.dataset.label = node.children[i].label;

        let subNodes = parseSelect(node.children[i]);
        for(let j=0, l=subNodes.length; j<l; j++){
          cstOptgroup.appendChild(subNodes[j]);
        }

        cstList.push(cstOptgroup);
      }else if(node.children[i].tagName.toUpperCase() === "OPTION"){
        var cstOption = document.createElement("div");
        cstOption.classList.add(cstOptions.optionClass);
        cstOption.textContent = node.children[i].text;
        cstOption.dataset.value = node.children[i].value;
        cstOption.fullSelectOriginalOption = node.children[i];
        if(node.children[i].selected)
          cstOption.classList.add('is-selected');
        cstList.push(cstOption);
      }
    }

    return cstList;

  })(select);

  for(let i=0, l=panelContent.length; i<l; i++){
    panel.appendChild(panelContent[i]);
  }

  // Injects the container in the original DOM position of the select
  container.appendChild(opener);
  select.parentNode.replaceChild(container, select);
  container.appendChild(select);
  container.appendChild(panel);

  // Event Init

  document.addEventListener('click', handleEvent)

  // Private Fuctions

  function handleEvent(e) {

    // On click on the opener opens/closes the panel
    if (e.target === opener || opener.contains(e.target)) {
      if (isOpen) {
        close();
      } else {
        open();
      }
    } else {
      if (isOpen) {
        close();
      }
    }

  }

  function open() {

    // Closes all instances of plugin
    var openedFullSelect = document.querySelector("." + containerClass + " .is-open")
    if (openedFullSelect) {
      openedFullSelect.parentNode.fullSelect.close();
    }

    // Opens only the clicked one
    opener.classList.add('is-active');
    panel.classList.add('is-open');

    isOpen = true;

  }

  function close() {

    opener.classList.remove('is-active');
    panel.classList.remove('is-open');

    // TODO: remove focus
    // panel.querySelector('.has-focus').classList.remove('has-focus');

    isOpen = false;

  }

  // Public Exposed Methods
  // and stores the plugin in the HTMLElement
  return container.fullSelect = {
    getOptions: () => cstOptions,
    open: open,
    close: close,
    isOpen: () => isOpen
  };

}

export default function fullSelect(element, options) {

  // Overrides the default options with the ones provided by the user
  var options = Object.assign(defaultOptions, options);
  var nodeList = [];
  var selects = []

  return ( function init() {

    // The plugin is called on a single HTMLElement
    if (element && element instanceof HTMLElement && element.tagName.toUpperCase() === "SELECT") {
      nodeList.push(element)
    // The plugin is called on a selector
    } else if (element && typeof element === 'string') {
      let elementsList = document.querySelectorAll(element);
      for (let i = 0, l = elementsList.length; i < l; ++i) {
        if (elementsList[i] instanceof HTMLElement && elementsList[i].tagName.toUpperCase() === "SELECT") {
          nodeList.push(elementsList[i]);
        }
      }
    // The plugin is called on any HTMLElements list (NodeList, HTMLCollection, Array, etc.)
    } else if (element && element.length) {
      for (let i = 0, l = element.length; i < l; ++i) {
        if (element[i] instanceof HTMLElement && element[i].tagName.toUpperCase() === "SELECT")
          nodeList.push(element[i]);
      }
    }

    // Launches the plugin over every HTMLElement
    // And stores every plugin instance
    for (let i = 0, l = nodeList.length; i < l; ++i) {
      selects.push(builder(nodeList[i], options));
    }

    // Returns all plugin instances
    return selects;

  })()

}<|endoftext|>


<commit_before>export function h(name, props) {
  var node
  var stack = []
  var children = []

  for (var i = arguments.length; i-- > 2; ) {
    stack.push(arguments[i])
  }

  while (stack.length) {
    if (Array.isArray((node = stack.pop()))) {
      for (i = node.length; i--; ) {
        stack.push(node[i])
      }
    } else if (null == node || true === node || false === node) {
    } else {
      children.push(node)
    }
  }

  return typeof name === "string"
    ? {
        name: name,
        props: props || {},
        children: children
      }
    : name(props || {}, children)
}

export function app(state, actions, view, container) {
  var patchLock
  var lifecycle = []
  var root = container && container.children[0]
  var node = vnode(root, [].map)

  repaint(init([], (state = copy(state)), (actions = copy(actions))))

  return actions

  function vnode(element, map) {
    return (
      element && {
        name: element.nodeName.toLowerCase(),
        props: {},
        children: map.call(element.childNodes, function(element) {
          return 3 === element.nodeType
            ? element.nodeValue
            : vnode(element, map)
        })
      }
    )
  }

  function render(next) {
    patchLock = !patchLock
    next = view(state, actions)

    if (container && !patchLock) {
      root = patch(container, root, node, (node = next))
    }

    while ((next = lifecycle.pop())) next()
  }

  function repaint() {
    if (!patchLock) {
      patchLock = !patchLock
      setTimeout(render)
    }
  }

  function copy(a, b) {
    var target = {}

    for (var i in a) target[i] = a[i]
    for (var i in b) target[i] = b[i]

    return target
  }

  function set(path, value, source, target) {
    if (path.length) {
      target[path[0]] =
        1 < path.length ? set(path.slice(1), value, source[path[0]], {}) : value
      return copy(source, target)
    }
    return value
  }

  function get(path, source) {
    for (var i = 0; i < path.length; i++) {
      source = source[path[i]]
    }
    return source
  }

  function init(path, slice, actions) {
    for (var key in actions) {
      typeof actions[key] === "function"
        ? (function(key, action) {
            actions[key] = function(data) {
              slice = get(path, state)

              if (typeof (data = action(data)) === "function") {
                data = data(slice, actions)
              }

              if (data && data !== slice && !data.then) {
                repaint((state = set(path, copy(slice, data), state, {})))
              }

              return data
            }
          })(key, actions[key])
        : init(
            path.concat(key),
            (slice[key] = slice[key] || {}),
            (actions[key] = copy(actions[key]))
          )
    }
  }

  function getKey(node) {
    return node && node.props ? node.props.key : null
  }

  function setElementProp(element, name, value, oldValue) {
    if (name === "key") {
    } else if (name === "style") {
      for (var i in copy(oldValue, value)) {
        element[name][i] = null == value || null == value[i] ? "" : value[i]
      }
    } else {
      try {
        element[name] = null == value ? "" : value
      } catch (_) {}

      if (typeof value !== "function") {
        if (null == value || false === value) {
          element.removeAttribute(name)
        } else {
          element.setAttribute(name, value)
        }
      }
    }
  }

  function createElement(node, isSVG, element) {
    if (typeof node === "string" || typeof node === "number") {
      element = document.createTextNode(node)
    } else {
      element = (isSVG = isSVG || "svg" === node.name)
        ? document.createElementNS("http://www.w3.org/2000/svg", node.name)
        : document.createElement(node.name)

      if (node.props.oncreate) {
        lifecycle.push(function() {
          node.props.oncreate(element)
        })
      }

      for (var i = 0; i < node.children.length; i++) {
        element.appendChild(createElement(node.children[i], isSVG))
      }

      for (var name in node.props) {
        setElementProp(element, name, node.props[name])
      }
    }
    return element
  }

  function updateElement(element, oldProps, props) {
    for (var name in copy(oldProps, props)) {
      if (
        props[name] !==
        ("value" === name || "checked" === name
          ? element[name]
          : oldProps[name])
      ) {
        setElementProp(element, name, props[name], oldProps[name])
      }
    }

    if (props.onupdate) {
      lifecycle.push(function() {
        props.onupdate(element, oldProps)
      })
    }
  }

  function removeChildren(element, node, props) {
    if ((props = node.props)) {
      for (var i = 0; i < node.children.length; i++) {
        removeChildren(element.childNodes[i], node.children[i])
      }

      if (props.ondestroy) {
        props.ondestroy(element)
      }
    }
    return element
  }

  function removeElement(parent, element, node, cb) {
    function done() {
      parent.removeChild(removeChildren(element, node))
    }

    if (node.props && (cb = node.props.onremove)) {
      cb(element, done)
    } else {
      done()
    }
  }

  function patch(parent, element, oldNode, node, isSVG, nextSibling) {
    if (node === oldNode) {
    } else if (null == oldNode) {
      element = parent.insertBefore(createElement(node, isSVG), element)
    } else if (node.name && node.name === oldNode.name) {
      updateElement(element, oldNode.props, node.props)

      var oldElements = []
      var oldKeyed = {}
      var newKeyed = {}

      for (var i = 0; i < oldNode.children.length; i++) {
        oldElements[i] = element.childNodes[i]

        var oldChild = oldNode.children[i]
        var oldKey = getKey(oldChild)

        if (null != oldKey) {
          oldKeyed[oldKey] = [oldElements[i], oldChild]
        }
      }

      var i = 0
      var j = 0

      while (j < node.children.length) {
        var oldChild = oldNode.children[i]
        var newChild = node.children[j]

        var oldKey = getKey(oldChild)
        var newKey = getKey(newChild)

        if (newKeyed[oldKey]) {
          i++
          continue
        }

        if (null == newKey) {
          if (null == oldKey) {
            patch(element, oldElements[i], oldChild, newChild, isSVG)
            j++
          }
          i++
        } else {
          var recyledNode = oldKeyed[newKey] || []

          if (oldKey === newKey) {
            patch(element, recyledNode[0], recyledNode[1], newChild, isSVG)
            i++
          } else if (recyledNode[0]) {
            patch(
              element,
              element.insertBefore(recyledNode[0], oldElements[i]),
              recyledNode[1],
              newChild,
              isSVG
            )
          } else {
            patch(element, oldElements[i], null, newChild, isSVG)
          }

          j++
          newKeyed[newKey] = newChild
        }
      }

      while (i < oldNode.children.length) {
        var oldChild = oldNode.children[i]
        if (null == getKey(oldChild)) {
          removeElement(element, oldElements[i], oldChild)
        }
        i++
      }

      for (var i in oldKeyed) {
        if (!newKeyed[oldKeyed[i][1].props.key]) {
          removeElement(element, oldKeyed[i][0], oldKeyed[i][1])
        }
      }
    } else if (node.name === oldNode.name) {
      element.nodeValue = node
    } else {
      element = parent.insertBefore(
        createElement(node, isSVG),
        (nextSibling = element)
      )
      removeElement(parent, nextSibling, oldNode)
    }
    return element
  }
}
<commit_msg>Refactor createElement for -1 bytes and +2 readability!<commit_after>export function h(name, props) {
  var node
  var stack = []
  var children = []

  for (var i = arguments.length; i-- > 2; ) {
    stack.push(arguments[i])
  }

  while (stack.length) {
    if (Array.isArray((node = stack.pop()))) {
      for (i = node.length; i--; ) {
        stack.push(node[i])
      }
    } else if (null == node || true === node || false === node) {
    } else {
      children.push(node)
    }
  }

  return typeof name === "string"
    ? {
        name: name,
        props: props || {},
        children: children
      }
    : name(props || {}, children)
}

export function app(state, actions, view, container) {
  var patchLock
  var lifecycle = []
  var root = container && container.children[0]
  var node = vnode(root, [].map)

  repaint(init([], (state = copy(state)), (actions = copy(actions))))

  return actions

  function vnode(element, map) {
    return (
      element && {
        name: element.nodeName.toLowerCase(),
        props: {},
        children: map.call(element.childNodes, function(element) {
          return 3 === element.nodeType
            ? element.nodeValue
            : vnode(element, map)
        })
      }
    )
  }

  function render(next) {
    patchLock = !patchLock
    next = view(state, actions)

    if (container && !patchLock) {
      root = patch(container, root, node, (node = next))
    }

    while ((next = lifecycle.pop())) next()
  }

  function repaint() {
    if (!patchLock) {
      patchLock = !patchLock
      setTimeout(render)
    }
  }

  function copy(a, b) {
    var target = {}

    for (var i in a) target[i] = a[i]
    for (var i in b) target[i] = b[i]

    return target
  }

  function set(path, value, source, target) {
    if (path.length) {
      target[path[0]] =
        1 < path.length ? set(path.slice(1), value, source[path[0]], {}) : value
      return copy(source, target)
    }
    return value
  }

  function get(path, source) {
    for (var i = 0; i < path.length; i++) {
      source = source[path[i]]
    }
    return source
  }

  function init(path, slice, actions) {
    for (var key in actions) {
      typeof actions[key] === "function"
        ? (function(key, action) {
            actions[key] = function(data) {
              slice = get(path, state)

              if (typeof (data = action(data)) === "function") {
                data = data(slice, actions)
              }

              if (data && data !== slice && !data.then) {
                repaint((state = set(path, copy(slice, data), state, {})))
              }

              return data
            }
          })(key, actions[key])
        : init(
            path.concat(key),
            (slice[key] = slice[key] || {}),
            (actions[key] = copy(actions[key]))
          )
    }
  }

  function getKey(node) {
    return node && node.props ? node.props.key : null
  }

  function setElementProp(element, name, value, oldValue) {
    if (name === "key") {
    } else if (name === "style") {
      for (var i in copy(oldValue, value)) {
        element[name][i] = null == value || null == value[i] ? "" : value[i]
      }
    } else {
      try {
        element[name] = null == value ? "" : value
      } catch (_) {}

      if (typeof value !== "function") {
        if (null == value || false === value) {
          element.removeAttribute(name)
        } else {
          element.setAttribute(name, value)
        }
      }
    }
  }

  function createElement(node, isSVG) {
    var element =
      typeof node === "string" || typeof node === "number"
        ? document.createTextNode(node)
        : (isSVG = isSVG || node.name === "svg")
          ? document.createElementNS("http://www.w3.org/2000/svg", node.name)
          : document.createElement(node.name)

    if (node.props) {
      if (node.props.oncreate) {
        lifecycle.push(function() {
          node.props.oncreate(element)
        })
      }

      for (var i = 0; i < node.children.length; i++) {
        element.appendChild(createElement(node.children[i], isSVG))
      }

      for (var name in node.props) {
        setElementProp(element, name, node.props[name])
      }
    }

    return element
  }

  function updateElement(element, oldProps, props) {
    for (var name in copy(oldProps, props)) {
      if (
        props[name] !==
        ("value" === name || "checked" === name
          ? element[name]
          : oldProps[name])
      ) {
        setElementProp(element, name, props[name], oldProps[name])
      }
    }

    if (props.onupdate) {
      lifecycle.push(function() {
        props.onupdate(element, oldProps)
      })
    }
  }

  function removeChildren(element, node, props) {
    if ((props = node.props)) {
      for (var i = 0; i < node.children.length; i++) {
        removeChildren(element.childNodes[i], node.children[i])
      }

      if (props.ondestroy) {
        props.ondestroy(element)
      }
    }
    return element
  }

  function removeElement(parent, element, node, cb) {
    function done() {
      parent.removeChild(removeChildren(element, node))
    }

    if (node.props && (cb = node.props.onremove)) {
      cb(element, done)
    } else {
      done()
    }
  }

  function patch(parent, element, oldNode, node, isSVG, nextSibling) {
    if (node === oldNode) {
    } else if (null == oldNode) {
      element = parent.insertBefore(createElement(node, isSVG), element)
    } else if (node.name && node.name === oldNode.name) {
      updateElement(element, oldNode.props, node.props)

      var oldElements = []
      var oldKeyed = {}
      var newKeyed = {}

      for (var i = 0; i < oldNode.children.length; i++) {
        oldElements[i] = element.childNodes[i]

        var oldChild = oldNode.children[i]
        var oldKey = getKey(oldChild)

        if (null != oldKey) {
          oldKeyed[oldKey] = [oldElements[i], oldChild]
        }
      }

      var i = 0
      var j = 0

      while (j < node.children.length) {
        var oldChild = oldNode.children[i]
        var newChild = node.children[j]

        var oldKey = getKey(oldChild)
        var newKey = getKey(newChild)

        if (newKeyed[oldKey]) {
          i++
          continue
        }

        if (null == newKey) {
          if (null == oldKey) {
            patch(element, oldElements[i], oldChild, newChild, isSVG)
            j++
          }
          i++
        } else {
          var recyledNode = oldKeyed[newKey] || []

          if (oldKey === newKey) {
            patch(element, recyledNode[0], recyledNode[1], newChild, isSVG)
            i++
          } else if (recyledNode[0]) {
            patch(
              element,
              element.insertBefore(recyledNode[0], oldElements[i]),
              recyledNode[1],
              newChild,
              isSVG
            )
          } else {
            patch(element, oldElements[i], null, newChild, isSVG)
          }

          j++
          newKeyed[newKey] = newChild
        }
      }

      while (i < oldNode.children.length) {
        var oldChild = oldNode.children[i]
        if (null == getKey(oldChild)) {
          removeElement(element, oldElements[i], oldChild)
        }
        i++
      }

      for (var i in oldKeyed) {
        if (!newKeyed[oldKeyed[i][1].props.key]) {
          removeElement(element, oldKeyed[i][0], oldKeyed[i][1])
        }
      }
    } else if (node.name === oldNode.name) {
      element.nodeValue = node
    } else {
      element = parent.insertBefore(
        createElement(node, isSVG),
        (nextSibling = element)
      )
      removeElement(parent, nextSibling, oldNode)
    }
    return element
  }
}
<|endoftext|>


<commit_before>const Discord = require('discord.js');
const config = require('./config.json');
const fs = require('fs');

const client = new Discord.Client({
  max_message_cache: 5,
});

const prefix = '🔨';

client.on('ready', () => {
  console.log('ready!');
});

function genLog(banner, banned, reason, channel, ban, owner) {
  fs.writeFileSync(`./out/${Date.now()}.json`, JSON.stringify({
    banner: banner.id,
    banned: banned.id,
    reason,
    messages: {
      channel,
      ban,
      owner,
    },
  }));
}

function hasPermission(member) {
  if (member.id === config.owner) {
    return true;
  }
  for (const role of member.roles) {
    if (config.roles.includes(role.name.toLowerCase())) {
      return true;
    }
  }
  return false;
}

function generateLolYouGotBanned(user, banner, owner, reason) {
  return [
    `Hey ${user.username},\n`,
    'you recently lost send message permissions in the discord.js help channel because a user with high authority' +
    `saw fit to do so. You may appeal to ${owner} if you wish.\n`,
    `Banner: ${banner.username}#${banner.discriminator} (${banner})`,
    `Reason: ${reason}\n`,
    'It is entirely possible this was a mistake, in this case please do contact ' +
    `${owner.username}#${owner.discriminator} ${owner} to clear this up.\n`,
    'Thank you.',
  ].join('\n');
}

function generateOwnerMessage(toBan, banner, reason) {
  return [
    `${toBan.username}#${toBan.discriminator} (${toBan}) was banned at ${Date.now()}`,
    `Banner: ${banner.username}#${banner.discriminator} (${banner}) `,
    `Reason: ${reason}`,
  ].join('\n');
}

client.on('message', message => {
  if (message.channel.id !== config.channel || !message.content.startsWith(prefix)) {
    return;
  }

  if (message.mentions.users.size === 0) {
    return;
  }

  if (!hasPermission(message.member)) {
    return message.reply('You don\'t have permission to do that...');
  }

  const banMessage = message.content.split(' ').slice(2).join(' ') || 'unspecified reason';
  const owner = client.users.get(config.owner);
  const toBan = message.mentions.users.array()[0];

  if (hasPermission(message.guild.member(toBan))) {
    return message.reply('You cannot ban this user');
  }

  if (message.channel.permissionsFor(toBan) && !message.channel.permissionsFor(toBan).hasPermission('SEND_MESSAGES')) {
    return message.reply('That user is already softbanned.');
  }

  message.channel.overwritePermissions(toBan, {
    SEND_MESSAGES: false,
  })
  .then(() => {
    const channMessage = `${toBan} has lost send permissions here and ${owner.username} has been notified.`;
    const bannedMessage = generateLolYouGotBanned(toBan, message.author, owner, banMessage);
    const ownerMessage = generateOwnerMessage(toBan, message.author, banMessage);
    genLog(message.author, toBan, banMessage, channMessage, bannedMessage, ownerMessage);
    message.channel.sendMessage(channMessage);
    toBan.sendMessage(bannedMessage);
    owner.sendMessage(ownerMessage);
  })
  .catch(e => {
    message.reply(`Couldn't ban - ${e}`);
  });
});

client.on('error', process.exit);

client.login(config.token);
<commit_msg>repress warnings<commit_after>const Discord = require('discord.js');
const config = require('./config.json');
const fs = require('fs');

const client = new Discord.Client({
  max_message_cache: 5,
});

const prefix = '🔨';

client.on('ready', () => {
  console.log('ready!');
});

function genLog(banner, banned, reason, channel, ban, owner) {
  fs.writeFileSync(`./out/${Date.now()}.json`, JSON.stringify({
    banner: banner.id,
    banned: banned.id,
    reason,
    messages: {
      channel,
      ban,
      owner,
    },
  }));
}

function hasPermission(member) {
  if (member.id === config.owner) {
    return true;
  }
  for (const role of member.roles) {
    if (config.roles.includes(role.name.toLowerCase())) {
      return true;
    }
  }
  return false;
}

function generateLolYouGotBanned(user, banner, owner, reason) {
  return [
    `Hey ${user.username},\n`,
    'you recently lost send message permissions in the discord.js help channel because a user with high authority' +
    `saw fit to do so. You may appeal to ${owner} if you wish.\n`,
    `Banner: ${banner.username}#${banner.discriminator} (${banner})`,
    `Reason: ${reason}\n`,
    'It is entirely possible this was a mistake, in this case please do contact ' +
    `${owner.username}#${owner.discriminator} ${owner} to clear this up.\n`,
    'Thank you.',
  ].join('\n');
}

function generateOwnerMessage(toBan, banner, reason) {
  return [
    `${toBan.username}#${toBan.discriminator} (${toBan}) was banned at ${Date.now()}`,
    `Banner: ${banner.username}#${banner.discriminator} (${banner}) `,
    `Reason: ${reason}`,
  ].join('\n');
}

client.on('message', message => {
  if (message.channel.id !== config.channel || !message.content.startsWith(prefix)) {
    return;
  }

  if (message.mentions.users.size === 0) {
    return;
  }

  if (!hasPermission(message.member)) {
    return;
  }

  const banMessage = message.content.split(' ').slice(2).join(' ') || 'unspecified reason';
  const owner = client.users.get(config.owner);
  const toBan = message.mentions.users.array()[0];

  if (hasPermission(message.guild.member(toBan))) {
    return message.reply('You cannot ban this user');
  }

  if (message.channel.permissionsFor(toBan) && !message.channel.permissionsFor(toBan).hasPermission('SEND_MESSAGES')) {
    return message.reply('That user is already softbanned.');
  }

  message.channel.overwritePermissions(toBan, {
    SEND_MESSAGES: false,
  })
  .then(() => {
    const channMessage = `${toBan} has lost send permissions here and ${owner.username} has been notified.`;
    const bannedMessage = generateLolYouGotBanned(toBan, message.author, owner, banMessage);
    const ownerMessage = generateOwnerMessage(toBan, message.author, banMessage);
    genLog(message.author, toBan, banMessage, channMessage, bannedMessage, ownerMessage);
    message.channel.sendMessage(channMessage);
    toBan.sendMessage(bannedMessage);
    owner.sendMessage(ownerMessage);
  })
  .catch(e => {
    message.reply(`Couldn't ban - ${e}`);
  });
});

client.on('error', process.exit);

client.login(config.token);
<|endoftext|>


<commit_before>import React from 'react'
import md5 from 'md5'
import querystring from 'query-string'
import isRetina from 'is-retina'
import PropTypes from 'prop-types'

class Gravatar extends React.Component {
  static displayName = 'Gravatar'
  static propTypes = {
    email: PropTypes.string,
    md5: PropTypes.string,
    size: PropTypes.number,
    rating: PropTypes.string,
    default: PropTypes.string,
    className: PropTypes.string,
    protocol: PropTypes.string,
    style: PropTypes.object,
  }
  static defaultProps = {
    size: 50,
    rating: 'g',
    default: 'retro',
    protocol: '//',
  }

  render() {
    const base = `${this.props.protocol}www.gravatar.com/avatar/`

    const query = querystring.stringify({
      s: this.props.size,
      r: this.props.rating,
      d: this.props.default,
    })

    const retinaQuery = querystring.stringify({
      s: this.props.size * 2,
      r: this.props.rating,
      d: this.props.default,
    })

    // Gravatar service currently trims and lowercases all registered emails
    const formattedEmail = ('' + this.props.email).trim().toLowerCase();

    let hash
    if (this.props.md5) {
      hash = this.props.md5
    } else if (typeof this.props.email === 'string') {
      hash = md5(formattedEmail, {encoding: "binary"})
    } else {
      console.warn(
        'Gravatar image can not be fetched. Either the "email" or "md5" prop must be specified.'
      )
      return (<script />)
    }

    const src = `${base}${hash}?${query}`
    const retinaSrc = `${base}${hash}?${retinaQuery}`

    let modernBrowser = true  // server-side, we render for modern browsers

    if (typeof window !== 'undefined') {
      // this is not NodeJS
      modernBrowser = 'srcset' in document.createElement('img')
    }

    let className = 'react-gravatar'
    if (this.props.className) {
      className = `${className} ${this.props.className}`
    }

    // Clone this.props and then delete Component specific props so we can
    // spread the rest into the img.
    let { ...rest } = this.props
    delete rest.md5
    delete rest.email
    delete rest.protocol
    delete rest.rating
    delete rest.size
    delete rest.style
    delete rest.className
    delete rest.default
    if (!modernBrowser && isRetina()) {
      return (
        <img
          alt={`Gravatar for ${formattedEmail}`}
          style={this.props.style}
          src={retinaSrc}
          height={this.props.size}
          width={this.props.size}
          {...rest}
          className={className}
        />
      )
    }
    return (
      <img
        alt={`Gravatar for ${formattedEmail}`}
        style={this.props.style}
        src={src}
        srcSet={`${retinaSrc} 2x`}
        height={this.props.size}
        width={this.props.size}
        {...rest}
        className={className}
      />
    )
  }
}

module.exports = Gravatar
<commit_msg>Support for configurable domain<commit_after>import React from 'react'
import md5 from 'md5'
import querystring from 'query-string'
import isRetina from 'is-retina'
import PropTypes from 'prop-types'

class Gravatar extends React.Component {
  static displayName = 'Gravatar'
  static propTypes = {
    email: PropTypes.string,
    md5: PropTypes.string,
    size: PropTypes.number,
    rating: PropTypes.string,
    default: PropTypes.string,
    className: PropTypes.string,
    protocol: PropTypes.string,
    domain: PropTypes.string,
    style: PropTypes.object,
  }
  static defaultProps = {
    size: 50,
    rating: 'g',
    default: 'retro',
    protocol: '//',
    domain: 'www.gravatar.com',
  }

  render() {
    const base = `${this.props.protocol}${this.props.domain}/avatar/`

    const query = querystring.stringify({
      s: this.props.size,
      r: this.props.rating,
      d: this.props.default,
    })

    const retinaQuery = querystring.stringify({
      s: this.props.size * 2,
      r: this.props.rating,
      d: this.props.default,
    })

    // Gravatar service currently trims and lowercases all registered emails
    const formattedEmail = ('' + this.props.email).trim().toLowerCase();

    let hash
    if (this.props.md5) {
      hash = this.props.md5
    } else if (typeof this.props.email === 'string') {
      hash = md5(formattedEmail, {encoding: "binary"})
    } else {
      console.warn(
        'Gravatar image can not be fetched. Either the "email" or "md5" prop must be specified.'
      )
      return (<script />)
    }

    const src = `${base}${hash}?${query}`
    const retinaSrc = `${base}${hash}?${retinaQuery}`

    let modernBrowser = true  // server-side, we render for modern browsers

    if (typeof window !== 'undefined') {
      // this is not NodeJS
      modernBrowser = 'srcset' in document.createElement('img')
    }

    let className = 'react-gravatar'
    if (this.props.className) {
      className = `${className} ${this.props.className}`
    }

    // Clone this.props and then delete Component specific props so we can
    // spread the rest into the img.
    let { ...rest } = this.props
    delete rest.md5
    delete rest.email
    delete rest.protocol
    delete rest.rating
    delete rest.size
    delete rest.style
    delete rest.className
    delete rest.default
    if (!modernBrowser && isRetina()) {
      return (
        <img
          alt={`Gravatar for ${formattedEmail}`}
          style={this.props.style}
          src={retinaSrc}
          height={this.props.size}
          width={this.props.size}
          {...rest}
          className={className}
        />
      )
    }
    return (
      <img
        alt={`Gravatar for ${formattedEmail}`}
        style={this.props.style}
        src={src}
        srcSet={`${retinaSrc} 2x`}
        height={this.props.size}
        width={this.props.size}
        {...rest}
        className={className}
      />
    )
  }
}

module.exports = Gravatar
<|endoftext|>


<commit_before>'use strict';

var React = require('react');
var Router = require('react-router');
var moment = require('moment');
var routes = require('./routes');

require('moment/locale/nb');

moment.locale('nb');

Router.run(routes, Router.HistoryLocation, function(Handler, state) {
  React.render(
    <Handler params={state.params} query={state.query} />,
    document.getElementById('app')
  );
});
<commit_msg>add accessibility reporter<commit_after>'use strict';

var React = require('react');
var Router = require('react-router');
var moment = require('moment');
var routes = require('./routes');

require('react-a11y')();
require('moment/locale/nb');

moment.locale('nb');

Router.run(routes, Router.HistoryLocation, function(Handler, state) {
  React.render(
    <Handler params={state.params} query={state.query} />,
    document.getElementById('app')
  );
});
<|endoftext|>


<commit_before>import { css } from 'styled-components';
import { pxToEm, pxToRem } from './convertors';

export {
  pxToEm,
  pxToRem
};

/**
 * Default media breakpoints
 * @type {Object}
 */
export const defaultBreakpoints = {
  huge: '1440px',
  large: '1170px',
  medium: '768px',
  small: '450px',
}

/**
 * Media query generator
 * @param {Object} [defaultBreakpoints] breakpoints - Map labels to breakpoint sizes
 * @return {Object} - Media generators for each breakpoint
 */
export function generateMedia(breakpoints = defaultBreakpoints) {
  return Object
    .keys(breakpoints)
    .reduce((acc, label) => {
      const size = breakpoints[label];

      acc.to[label] = (...args) => css`
        @media (max-width: ${size}) {
          ${css(...args)}
        }
      `;

      acc.from[label] = (...args) => css`
        @media (min-width: ${size}) {
          ${css(...args)}
        }
      `;

      return acc;
    },
    { to: {}, from: {} }
  );
}

/**
 * Media object with default breakpoints
 * @return {object} - Media generators for each size
 */

export default generateMedia();

/**
 * Usage: styled.div` ${media.from.medium`background: #000;`} `;
 * With this code, background for small and medium sizes will be `default` and for more than medium, will be `#000`
 */
<commit_msg>feat: add two new methods to access media<commit_after>import { css } from 'styled-components';
import { pxToEm, pxToRem } from './convertors';

export {
  pxToEm,
  pxToRem
};

/**
 * Default media breakpoints
 * @type {Object}
 */
export const defaultBreakpoints = {
  huge: '1440px',
  large: '1170px',
  medium: '768px',
  small: '450px',
}

/**
 * Media query generator
 * @param {Object} [defaultBreakpoints] breakpoints - Map labels to breakpoint sizes
 * @return {Object} - Media generators for each breakpoint
 */
export function generateMedia(breakpoints = defaultBreakpoints) {
  const lessThan = (breakpoint) => (...args) => css`
    @media (max-width: ${breakpoints[breakpoint]}) {
      ${css(...args)}
    }
  `;

  const greaterThan = (breakpoint) => (...args) => css`
    @media (min-width: ${breakpoints[breakpoint]}) {
      ${css(...args)}
    }
  `;

  const oldStyle = Object
    .keys(breakpoints)
    .reduce((acc, label) => {
      const size = breakpoints[label];

      acc.to[label] = (...args) => css`
        @media (max-width: ${size}) {
          ${css(...args)}
        }
      `;

      acc.from[label] = (...args) => css`
        @media (min-width: ${size}) {
          ${css(...args)}
        }
      `;

      return acc;
    },
    { to: {}, from: {} }
  );

  return Object.assign(
    {
      lessThan,
      greaterThan,
    },
    oldStyle,
  );
}

/**
 * Media object with default breakpoints
 * @return {object} - Media generators for each size
 */
export default generateMedia();

/**
 * Usage: styled.div` ${media.from.medium`background: #000;`} `;
 * With this code, background for small and medium sizes will be `default` and for more than medium, will be `#000`
 */
<|endoftext|>


<commit_before>const modules = {};
const shortcuts = {};

// modules
modules.Error = require('./Error');
modules.Util = require('./Util');
modules.Settings = require('./Settings');
modules.Input = require('./Input');
modules.Action = require('./Action');
modules.Tasks = require('./Tasks');
modules.Session = require('./Session');
modules.Handler = require('./Handler');
modules.Reader = require('./Reader');
modules.Writer = require('./Writer');
modules.Ext = require('./Ext');

// handler shortcuts
shortcuts.createHandler = modules.Handler.create.bind(modules.Handler);
shortcuts.registerHandler = modules.Handler.registerHandler.bind(modules.Handler);

// action shortcuts
shortcuts.createAction = modules.Action.create.bind(modules.Action);
shortcuts.registerAction = modules.Action.registerAction.bind(modules.Action);

// web handler shortcuts
const webHandler = modules.Ext.Handlers.Web;
shortcuts.webfyAction = webHandler.webfyAction.bind(webHandler);
shortcuts.addBeforeAction = webHandler.addBeforeAction.bind(webHandler);
shortcuts.addBeforeAuthAction = webHandler.addBeforeAuthAction.bind(webHandler);
shortcuts.middleware = webHandler.middleware.bind(webHandler);
shortcuts.restful = webHandler.restful.bind(webHandler);

Object.assign(module.exports, modules, shortcuts);
<commit_msg>added input shortcuts<commit_after>const modules = {};
const shortcuts = {};

// modules
modules.Error = require('./Error');
modules.Util = require('./Util');
modules.Settings = require('./Settings');
modules.Input = require('./Input');
modules.Action = require('./Action');
modules.Tasks = require('./Tasks');
modules.Session = require('./Session');
modules.Handler = require('./Handler');
modules.Reader = require('./Reader');
modules.Writer = require('./Writer');
modules.Ext = require('./Ext');

// input shortcuts
shortcuts.createInput = modules.Input.create.bind(modules.Input);
shortcuts.registerInput = modules.Input.registerInput.bind(modules.Input);
shortcuts.registerProperty = modules.Input.registerProperty.bind(modules.Input);

// handler shortcuts
shortcuts.createHandler = modules.Handler.create.bind(modules.Handler);
shortcuts.registerHandler = modules.Handler.registerHandler.bind(modules.Handler);

// action shortcuts
shortcuts.createAction = modules.Action.create.bind(modules.Action);
shortcuts.registerAction = modules.Action.registerAction.bind(modules.Action);

// web handler shortcuts
const webHandler = modules.Ext.Handlers.Web;
shortcuts.webfyAction = webHandler.webfyAction.bind(webHandler);
shortcuts.addBeforeAction = webHandler.addBeforeAction.bind(webHandler);
shortcuts.addBeforeAuthAction = webHandler.addBeforeAuthAction.bind(webHandler);
shortcuts.middleware = webHandler.middleware.bind(webHandler);
shortcuts.restful = webHandler.restful.bind(webHandler);

Object.assign(module.exports, modules, shortcuts);
<|endoftext|>


<commit_before>import React from 'react';
import {render} from 'react-dom';
import 'aframe';
import VirtualShowRoom from './VirtualShowRoom';

let config = {
    ...require('../config.json'),
    show: true,
    showOnlyProduct: false,
};

window.VirtualShowRoom = {
    show: () => doRender({...config, show: true}),
    hide: () => doRender({...config, show: false}),
    showOnlyProduct: () => doRender({...config, showOnlyProduct: true}),
    showAll: () => doRender({...config, showOnlyProduct: false})
}

console.info('config', config);

const doRender = config => render(<VirtualShowRoom config={config}/>, document.querySelector('#root'));

document.addEventListener('DOMContentLoaded', () => doRender(config));
<commit_msg>product selection<commit_after>import React from 'react';
import {render} from 'react-dom';
import 'aframe';
import VirtualShowRoom from './VirtualShowRoom';

let config = {
    ...require('../config.json'),
    show: true,
    showOnlyProduct: false,
};

window.VirtualShowRoom = {
    show: () => doRender({...config, show: true}),
    hide: () => doRender({...config, show: false}),
    showOnlyProduct: () => doRender({...config, showOnlyProduct: true}),
    showAll: () => doRender({...config, showOnlyProduct: false}),
    selectProduct: productIndex => doRender({...config, current: {...config.current, product: productIndex}}),
    unselectProduct: productIndex => doRender({...config, current: {...config.current, product: -1}})
}

console.info('config', config);

const doRender = config => render(<VirtualShowRoom config={config}/>, document.querySelector('#root'));

document.addEventListener('DOMContentLoaded', () => doRender(config));
<|endoftext|>


<commit_before>import CSSAnimation from './CSSAnimation';
import CSSAnimationGroup from './CSSAnimationGroup';

export { CSSAnimation, CSSAnimationGroup };
<commit_msg>Use fancy export syntax<commit_after>export { default as CSSAnimation } from './CSSAnimation';
export { default as CSSAnimationGroup } from './CSSAnimationGroup';
<|endoftext|>


<commit_before>import parser from 'minimist'
import pkginfo from 'pkginfo'
import path from 'path'
import { exec } from 'child_process'

class Commander {
  constructor() {
    this.details = {
      options: [],
      commands: []
    }

    this.option('help', 'Output usage information')
    this.command('help', 'Display help')
  }

  option (name, description, init, defaultValue) {
    let usage = []

    switch (name.constructor) {
      case String:
        usage[0] = name.charAt(0)
        usage[1] = name

        break
      case Array:
        usage = usage.concat(name)
        break
      default:
        throw new Error('Invalid name for option')
    }

    if (usage.length > 0 && usage[0].length > 1) {
      throw new Error('Short version of option is longer than 1 char')
    }

    let optionDetails = {
      defaultValue,
      usage,
      description
    }

    if (defaultValue) {
      let initFunction = typeof init === 'function'
      optionDetails.init = initFunction ? init : this.handleType(defaultValue)[1]
    }

    this.details.options.push(optionDetails)
    return this
  }

  command (usage, description) {
    this.details.commands.push({
      usage,
      description
    })

    return this
  }

  handleType (value) {
    const type = value.constructor

    switch (type) {
      case String:
        return ['[value]', toString]
        break
      case Array:
        return ['<list>']
        break
      case Number:
        return ['<n>', parseInt]
        break
      default:
        return false
    }
  }

  setProperties (option) {
    let value = false

    for (let name of option.usage) {
      let fromArgs = this.args[name]

      if (fromArgs) {
        value = fromArgs
      }
    }

    for (let name of option.usage) {
      let propVal = value || option.defaultValue,
          condition = true

      if (option.init) {
        if (option.init === toString) {
          condition = propVal.constructor === Number
        }

        if (condition) {
          propVal = option.init(propVal)
        }
      }

      if (propVal) this[name] = propVal
    }
  }

  generateDetails (kind) {
    const items = this.details[kind]
    let parts = []

    for (let item in items) {
      let usage = items[item].usage,
          initial = items[item].defaultValue

      if (usage.constructor === Array) {
        usage = `-${usage[0]}, --${usage[1]}`
        usage += initial ? ' ' + this.handleType(initial)[0] : ''
      }

      items[item].usage = usage
    }

    const longest = items.sort((a, b) => {
      return b.usage.length - a.usage.length
    })[0].usage.length

    for (let item of items) {
      let usage = item.usage,
          difference = longest - usage.length

      usage += ' '.repeat(difference)
      parts.push('  ' + usage + '  ' + item.description)
    }

    return parts
  }

  renderHelp () {
    const binary = path.basename(this.args._[0])

    let details = [
      '',
      `Usage: ${binary} [options] [command]`,
      '',
      '',
      'Commands:',
      ''
    ]

    const commands = this.generateDetails('commands'),
          options = this.generateDetails('options')

    details = details.concat(
      commands,
      [
        '',
        'Options:',
        ''
      ],
      options,
      ''
    )

    console.log(details.join('\n  '))
    process.exit()
  }

  runCommand (name) {
    const full = path.basename(this.args._[0]) + '-' + name

    let args = process.argv,
        i = 0

    while (i < 3) {
      args.shift()
      i++
    }

    console.log(args)

    let child = exec(full, args, {
      stdio: 'inherit',
      detached: true
    })

    child.on('error', err => {
      throw err
    })
  }

  parse (argv) {
    this.args = parser(argv.slice(1))
    const subCommand = this.args._[1] || false

    for (let command of this.details.commands) {
      if (command.usage !== subCommand) {
        continue
      }

      this.runCommand(subCommand)
      break
    }

    const parent = module.parent

    pkginfo(parent)
    const version = parent.exports.version

    if (version) {
      this.option('version', 'Output the version number', version)

      if (this.args.v || this.args.version) {
        console.log(version)
        process.exit()
      }
    }

    if (this.args._[1] == 'help' || this.args.h || this.args.help) {
      this.renderHelp()
    }

    for (let option of this.details.options) {
      this.setProperties(option)
    }

    const args = this.args
    args._.shift()

    this.raw = args
  }
}

export default new Commander
<commit_msg>Now able to run sub commands<commit_after>import parser from 'minimist'
import pkginfo from 'pkginfo'
import path from 'path'
import { spawn } from 'child_process'

class Commander {
  constructor() {
    this.details = {
      options: [],
      commands: []
    }

    this.option('help', 'Output usage information')
    this.command('help', 'Display help')
  }

  option (name, description, init, defaultValue) {
    let usage = []

    switch (name.constructor) {
      case String:
        usage[0] = name.charAt(0)
        usage[1] = name

        break
      case Array:
        usage = usage.concat(name)
        break
      default:
        throw new Error('Invalid name for option')
    }

    if (usage.length > 0 && usage[0].length > 1) {
      throw new Error('Short version of option is longer than 1 char')
    }

    let optionDetails = {
      defaultValue,
      usage,
      description
    }

    if (defaultValue) {
      let initFunction = typeof init === 'function'
      optionDetails.init = initFunction ? init : this.handleType(defaultValue)[1]
    }

    this.details.options.push(optionDetails)
    return this
  }

  command (usage, description) {
    this.details.commands.push({
      usage,
      description
    })

    return this
  }

  handleType (value) {
    const type = value.constructor

    switch (type) {
      case String:
        return ['[value]', toString]
        break
      case Array:
        return ['<list>']
        break
      case Number:
        return ['<n>', parseInt]
        break
      default:
        return false
    }
  }

  setProperties (option) {
    let value = false

    for (let name of option.usage) {
      let fromArgs = this.args[name]

      if (fromArgs) {
        value = fromArgs
      }
    }

    for (let name of option.usage) {
      let propVal = value || option.defaultValue,
          condition = true

      if (option.init) {
        if (option.init === toString) {
          condition = propVal.constructor === Number
        }

        if (condition) {
          propVal = option.init(propVal)
        }
      }

      if (propVal) this[name] = propVal
    }
  }

  generateDetails (kind) {
    const items = this.details[kind]
    let parts = []

    for (let item in items) {
      let usage = items[item].usage,
          initial = items[item].defaultValue

      if (usage.constructor === Array) {
        usage = `-${usage[0]}, --${usage[1]}`
        usage += initial ? ' ' + this.handleType(initial)[0] : ''
      }

      items[item].usage = usage
    }

    const longest = items.sort((a, b) => {
      return b.usage.length - a.usage.length
    })[0].usage.length

    for (let item of items) {
      let usage = item.usage,
          difference = longest - usage.length

      usage += ' '.repeat(difference)
      parts.push('  ' + usage + '  ' + item.description)
    }

    return parts
  }

  renderHelp () {
    const binary = path.basename(this.args._[0])

    let details = [
      '',
      `Usage: ${binary} [options] [command]`,
      '',
      '',
      'Commands:',
      ''
    ]

    const commands = this.generateDetails('commands'),
          options = this.generateDetails('options')

    details = details.concat(
      commands,
      [
        '',
        'Options:',
        ''
      ],
      options,
      ''
    )

    console.log(details.join('\n  '))
    process.exit()
  }

  runCommand (name) {
    const full = path.basename(this.args._[0]) + '-' + name

    let args = process.argv,
        i = 0

    while (i < 3) {
      args.shift()
      i++
    }

    let child = spawn(full, args, {
      stdio: 'inherit',
      detached: true
    })

    child.on('error', err => {
      throw err
    })
  }

  parse (argv) {
    this.args = parser(argv.slice(1))
    const subCommand = this.args._[1] || false

    for (let command of this.details.commands) {
      if (command.usage !== subCommand) {
        continue
      }

      this.runCommand(subCommand)
      break
    }

    const parent = module.parent

    pkginfo(parent)
    const version = parent.exports.version

    if (version) {
      this.option('version', 'Output the version number', version)

      if (this.args.v || this.args.version) {
        console.log(version)
        process.exit()
      }
    }

    if (this.args._[1] == 'help' || this.args.h || this.args.help) {
      this.renderHelp()
    }

    for (let option of this.details.options) {
      this.setProperties(option)
    }

    const args = this.args
    args._.shift()

    this.raw = args
  }
}

export default new Commander
<|endoftext|>


<commit_before>import './css'

import Vue from 'vue'
import Vuetify from 'vuetify'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
import VueI18n from 'vue-i18n'

import stores from '~stores/index'
import routes from './routes'
import { getSystemLangs } from '~utils/lang'

Vue.use(Vuetify)
Vue.use(Vuex)
Vue.use(VueRouter)
Vue.use(VueI18n)

const store = new Vuex.Store(stores)
const router = new VueRouter({ routes, mode: 'history' })

const messages = getSystemLangs()
const i18n = new VueI18n({ locale: 'en', messages })

const app = new Vue({ store, router, i18n })
app.$mount('#ajkLmeno')
<commit_msg>register service worker (will work only on production), and redirect for more score on lighthouse<commit_after>import './css'

import Vue from 'vue'
import Vuetify from 'vuetify'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
import VueI18n from 'vue-i18n'

import stores from '~stores/index'
import routes from './routes'
import { getSystemLangs } from '~utils/lang'

Vue.use(Vuetify)
Vue.use(Vuex)
Vue.use(VueRouter)
Vue.use(VueI18n)

const store = new Vuex.Store(stores)
const router = new VueRouter({ routes, mode: 'history' })

const messages = getSystemLangs()
const i18n = new VueI18n({ locale: 'en', messages })

const app = new Vue({ store, router, i18n })
app.$mount('#ajkLmeno')

const baseUrl = document.querySelector('base').getAttribute('href')

if (window.location.hostname !== 'localhost' && window.location.protocol !== 'https:') {
  window.location.href = baseUrl
}

// register service worker
if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register(baseUrl + 'sw.js')
}
<|endoftext|>


<commit_before>import Avatar, { AvatarStack } from './components/avatar';
import Badge from './components/badge';
import Banner from './components/banner';
import Box from './components/box';
import Button, { ButtonGroup, IconButton } from './components/button';
import {
  Heading1,
  Heading2,
  Heading3,
  Heading4,
  Monospaced,
  TextBody,
  TextDisplay,
  TextSmall,
} from './components/typography';
import Bullet from './components/bullet';
import Checkbox from './components/checkbox';
import CompactMessage from './components/compactMessage';
import Counter from './components/counter';
import DataGrid from './components/datagrid';
import { DatePicker, DatePickerRange, DatePickerInput, DatePickerInputRange } from './components/datepicker';
import Dialog from './components/dialog';
import Icon from './components/icon';
import Input, { InputBase, NumericInput, Textarea } from './components/input';
import Menu, { IconMenu, MenuItem, MenuDivider } from './components/menu';
import Link from './components/link';
import Message from './components/message';
import Overlay from './components/overlay';
import LoadingBar from './components/loadingBar';
import LoadingMolecule from './components/loadingMolecule';
import LoadingSpinner from './components/loadingSpinner';
import Pagination from './components/pagination';
import Popover from './components/popover';
import { RadioButton, RadioGroup } from './components/radio';
import Section from './components/section';
import Select, { AsyncSelect } from './components/select';
import { Island, IslandGroup } from './components/island';
import StatusBullet from './components/statusBullet';
import StatusLabel from './components/statusLabel';
import { IconTab, TitleTab, TabGroup } from './components/tab';
import Tag from './components/tag';
import { Toast, ToastContainer } from './components/toast';
import Toggle from './components/toggle';
import ValidationText, { ErrorText, HelpText } from './components/validationText';
import Label from './components/label';
import Tooltip from './components/tooltip';
import QTip from './components/qTip';
import ProgressTracker from './components/progressTracker';

import { COLOR, COLORS, TINTS, colorsWithout, tintsWithout } from './constants';

export {
  Avatar,
  AvatarStack,
  AsyncSelect,
  Badge,
  Banner,
  InputBase,
  Box,
  Bullet,
  Button,
  ButtonGroup,
  Checkbox,
  CompactMessage,
  Counter,
  DataGrid,
  DatePicker,
  DatePickerInput,
  DatePickerRange,
  DatePickerInputRange,
  Dialog,
  ErrorText,
  Heading1,
  Heading2,
  Heading3,
  Heading4,
  HelpText,
  Icon,
  IconButton,
  IconMenu,
  IconTab,
  Input,
  Island,
  IslandGroup,
  Label,
  Link,
  LoadingBar,
  LoadingMolecule,
  LoadingSpinner,
  Menu,
  MenuItem,
  MenuDivider,
  Message,
  Monospaced,
  NumericInput,
  Overlay,
  Pagination,
  Popover,
  ProgressTracker,
  RadioButton,
  RadioGroup,
  Section,
  Select,
  StatusBullet,
  StatusLabel,
  TextBody,
  TextDisplay,
  TextSmall,
  TabGroup,
  Tag,
  Textarea,
  TitleTab,
  Toast,
  ToastContainer,
  Toggle,
  Tooltip,
  ValidationText,
  QTip,
  COLOR,
  COLORS,
  TINTS,
  colorsWithout,
  tintsWithout,
};
<commit_msg>Export DialogBase<commit_after>import Avatar, { AvatarStack } from './components/avatar';
import Badge from './components/badge';
import Banner from './components/banner';
import Box from './components/box';
import Button, { ButtonGroup, IconButton } from './components/button';
import {
  Heading1,
  Heading2,
  Heading3,
  Heading4,
  Monospaced,
  TextBody,
  TextDisplay,
  TextSmall,
} from './components/typography';
import Bullet from './components/bullet';
import Checkbox from './components/checkbox';
import CompactMessage from './components/compactMessage';
import Counter from './components/counter';
import DataGrid from './components/datagrid';
import { DatePicker, DatePickerRange, DatePickerInput, DatePickerInputRange } from './components/datepicker';
import Dialog, { DialogBase } from './components/dialog';
import Icon from './components/icon';
import Input, { InputBase, NumericInput, Textarea } from './components/input';
import Menu, { IconMenu, MenuItem, MenuDivider } from './components/menu';
import Link from './components/link';
import Message from './components/message';
import Overlay from './components/overlay';
import LoadingBar from './components/loadingBar';
import LoadingMolecule from './components/loadingMolecule';
import LoadingSpinner from './components/loadingSpinner';
import Pagination from './components/pagination';
import Popover from './components/popover';
import { RadioButton, RadioGroup } from './components/radio';
import Section from './components/section';
import Select, { AsyncSelect } from './components/select';
import { Island, IslandGroup } from './components/island';
import StatusBullet from './components/statusBullet';
import StatusLabel from './components/statusLabel';
import { IconTab, TitleTab, TabGroup } from './components/tab';
import Tag from './components/tag';
import { Toast, ToastContainer } from './components/toast';
import Toggle from './components/toggle';
import ValidationText, { ErrorText, HelpText } from './components/validationText';
import Label from './components/label';
import Tooltip from './components/tooltip';
import QTip from './components/qTip';
import ProgressTracker from './components/progressTracker';

import { COLOR, COLORS, TINTS, colorsWithout, tintsWithout } from './constants';

export {
  Avatar,
  AvatarStack,
  AsyncSelect,
  Badge,
  Banner,
  InputBase,
  Box,
  Bullet,
  Button,
  ButtonGroup,
  Checkbox,
  CompactMessage,
  Counter,
  DataGrid,
  DatePicker,
  DatePickerInput,
  DatePickerRange,
  DatePickerInputRange,
  Dialog,
  DialogBase,
  ErrorText,
  Heading1,
  Heading2,
  Heading3,
  Heading4,
  HelpText,
  Icon,
  IconButton,
  IconMenu,
  IconTab,
  Input,
  Island,
  IslandGroup,
  Label,
  Link,
  LoadingBar,
  LoadingMolecule,
  LoadingSpinner,
  Menu,
  MenuItem,
  MenuDivider,
  Message,
  Monospaced,
  NumericInput,
  Overlay,
  Pagination,
  Popover,
  ProgressTracker,
  RadioButton,
  RadioGroup,
  Section,
  Select,
  StatusBullet,
  StatusLabel,
  TextBody,
  TextDisplay,
  TextSmall,
  TabGroup,
  Tag,
  Textarea,
  TitleTab,
  Toast,
  ToastContainer,
  Toggle,
  Tooltip,
  ValidationText,
  QTip,
  COLOR,
  COLORS,
  TINTS,
  colorsWithout,
  tintsWithout,
};
<|endoftext|>


<commit_before>export { default as media } from './src/styled/media';
export { default as Container } from './src/Container';
export { default as Row } from './src/Row';
export { default as Col } from './src/Col';
<commit_msg>index bugfix<commit_after>export { default as media } from './styled/media';
export { default as Container } from './Container';
export { default as Row } from './Row';
export { default as Col } from './Col';
<|endoftext|>