<commit_before>/**
 * @flow
 */

import React from 'react';
import createHash from 'murmurhash-js/murmurhash3_gc';
import injectStylesheet from 'style-loader/addStyles';

import {compileStyle, expand} from './compiler';

type Style = Object;
type StyleState = 'normal' | 'hover' | 'focus' | 'active' | 'disabled';
type StyleApplyStrategy = 'static' | 'dynamic' | 'dynamic-inline';

type StylePropSpec = {
  [propName: string]: PropSpec;
};

class PropSpec {
  name: string;
  state: StyleState;
  applyStrategy: StyleApplyStrategy;

  constructor(name, state, applyStrategy) {
    this.name = name;
    this.state = state;
    this.applyStrategy = applyStrategy;
  }
}

const STYLE_STATIC_VALUE_SET = {
  'display':        ['none', 'block', 'inline', 'inline-block', 'flex', 'inline-flex', 'table'],
  'position':       ['absolute', 'relative', 'static', 'fixed', 'sticky'],
  'overflow':       ['visible', 'hidden', 'scroll', 'auto'],
  'overflowX':      ['visible', 'hidden', 'scroll', 'auto'],
  'overflowY':      ['visible', 'hidden', 'scroll', 'auto'],
  'flexDirection':  ['row', 'row-reverse', 'column', 'column-reverse'],
  'flexWrap':       ['nowrap', 'wrap', 'wrap-reverse'],
  'alignContent':   ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch'],
  'alignItems':     ['flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
  'alignSelf':      ['auto', 'flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
  'float':          ['left', 'right', 'none', 'inline-start', 'inline-end'],
  'textAlign':      ['start', 'end', 'left', 'right', 'center', 'justify', 'match-parent'],
  'justifyContent': ['flex-start', 'flex-end', 'center', 'space-between', 'space-around'],
  'whiteSpace':     ['normal', 'pre', 'nowrap', 'pre-wrap', 'pre-line'],
  'visibility':     ['visible', 'hidden', 'collapse'],
  'textTransform':  ['none', 'capitalize', 'uppercase', 'lowercase', 'full-width'],
};

const STYLE_PROP_SPEC: StylePropSpec = {};

function defineDynamicStyleProp(spec, name) {
  let nameOnHover = `${name}OnHover`;
  let nameOnFocus = `${name}OnFocus`;
  let nameOnActive = `${name}OnActive`;
  let nameOnDisabled= `${name}OnDisabled`;
  Object.assign(spec, {
    [name]: new PropSpec(name, 'normal', 'dynamic-inline'),
    [nameOnHover]: new PropSpec(name, 'hover', 'dynamic'),
    [nameOnFocus]: new PropSpec(name, 'focus', 'dynamic'),
    [nameOnActive]: new PropSpec(name, 'active', 'dynamic'),
    [nameOnDisabled]: new PropSpec(name, 'disabled', 'dynamic'),
  });
}

function defineStaticStyleProp(spec, name) {
  let nameOnHover = `${name}OnHover`;
  let nameOnFocus = `${name}OnFocus`;
  let nameOnActive = `${name}OnActive`;
  let nameOnDisabled= `${name}OnDisabled`;
  Object.assign(spec, {
    [name]:         new PropSpec(name, 'normal', 'static'),
    [nameOnHover]:  new PropSpec(name, 'hover', 'static'),
    [nameOnFocus]:  new PropSpec(name, 'focus', 'static'),
    [nameOnActive]: new PropSpec(name, 'active', 'static'),
    [nameOnDisabled]: new PropSpec(name, 'disabled', 'dynamic'),
  });
}

defineDynamicStyleProp(STYLE_PROP_SPEC, 'margin');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginTop');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginRight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginBottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginLeft');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'padding');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingH');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingTop');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingRight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingBottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingLeft');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'border');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderTop');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderRight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderBottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderLeft');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'color');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'background');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'width');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'minWidth');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'maxWidth');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'height');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'minHeight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'maxHeight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'top');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'right');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'bottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'left');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontSize');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontWeight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontFamily');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontStyle');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'opacity');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexShrink');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexGrow');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexBasis');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexFlow');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'order');

defineStaticStyleProp(STYLE_PROP_SPEC, 'display');
defineStaticStyleProp(STYLE_PROP_SPEC, 'position');
defineStaticStyleProp(STYLE_PROP_SPEC, 'textAlign');
defineStaticStyleProp(STYLE_PROP_SPEC, 'overflow');
defineStaticStyleProp(STYLE_PROP_SPEC, 'overflowX');
defineStaticStyleProp(STYLE_PROP_SPEC, 'overflowY');
defineStaticStyleProp(STYLE_PROP_SPEC, 'float');
defineStaticStyleProp(STYLE_PROP_SPEC, 'flexDirection');<commit_msg>feat: add more props to <Element /><commit_after>/**
 * @flow
 */

import React from 'react';
import createHash from 'murmurhash-js/murmurhash3_gc';
import injectStylesheet from 'style-loader/addStyles';

import {compileStyle, expand} from './compiler';

type Style = Object;
type StyleState = 'normal' | 'hover' | 'focus' | 'active' | 'disabled';
type StyleApplyStrategy = 'static' | 'dynamic' | 'dynamic-inline';

type StylePropSpec = {
  [propName: string]: PropSpec;
};

class PropSpec {
  name: string;
  state: StyleState;
  applyStrategy: StyleApplyStrategy;

  constructor(name, state, applyStrategy) {
    this.name = name;
    this.state = state;
    this.applyStrategy = applyStrategy;
  }
}

const STYLE_STATIC_VALUE_SET = {
  'display':        ['none', 'block', 'inline', 'inline-block', 'flex', 'inline-flex', 'table'],
  'position':       ['absolute', 'relative', 'static', 'fixed', 'sticky'],
  'overflow':       ['visible', 'hidden', 'scroll', 'auto'],
  'overflowX':      ['visible', 'hidden', 'scroll', 'auto'],
  'overflowY':      ['visible', 'hidden', 'scroll', 'auto'],
  'flexDirection':  ['row', 'row-reverse', 'column', 'column-reverse'],
  'flexWrap':       ['nowrap', 'wrap', 'wrap-reverse'],
  'alignContent':   ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch'],
  'alignItems':     ['flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
  'alignSelf':      ['auto', 'flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
  'float':          ['left', 'right', 'none', 'inline-start', 'inline-end'],
  'textAlign':      ['start', 'end', 'left', 'right', 'center', 'justify', 'match-parent'],
  'justifyContent': ['flex-start', 'flex-end', 'center', 'space-between', 'space-around'],
  'whiteSpace':     ['normal', 'pre', 'nowrap', 'pre-wrap', 'pre-line'],
  'visibility':     ['visible', 'hidden', 'collapse'],
  'textTransform':  ['none', 'capitalize', 'uppercase', 'lowercase', 'full-width'],
};

const STYLE_PROP_SPEC: StylePropSpec = {};

function defineDynamicStyleProp(spec, name) {
  let nameOnHover = `${name}OnHover`;
  let nameOnFocus = `${name}OnFocus`;
  let nameOnActive = `${name}OnActive`;
  let nameOnDisabled= `${name}OnDisabled`;
  Object.assign(spec, {
    [name]: new PropSpec(name, 'normal', 'dynamic-inline'),
    [nameOnHover]: new PropSpec(name, 'hover', 'dynamic'),
    [nameOnFocus]: new PropSpec(name, 'focus', 'dynamic'),
    [nameOnActive]: new PropSpec(name, 'active', 'dynamic'),
    [nameOnDisabled]: new PropSpec(name, 'disabled', 'dynamic'),
  });
}

function defineStaticStyleProp(spec, name) {
  let nameOnHover = `${name}OnHover`;
  let nameOnFocus = `${name}OnFocus`;
  let nameOnActive = `${name}OnActive`;
  let nameOnDisabled= `${name}OnDisabled`;
  Object.assign(spec, {
    [name]:         new PropSpec(name, 'normal', 'static'),
    [nameOnHover]:  new PropSpec(name, 'hover', 'static'),
    [nameOnFocus]:  new PropSpec(name, 'focus', 'static'),
    [nameOnActive]: new PropSpec(name, 'active', 'static'),
    [nameOnDisabled]: new PropSpec(name, 'disabled', 'dynamic'),
  });
}

defineDynamicStyleProp(STYLE_PROP_SPEC, 'margin');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginTop');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginRight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginBottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'marginLeft');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'padding');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingH');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingTop');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingRight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingBottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'paddingLeft');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'border');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderTop');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderRight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderBottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'borderLeft');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'color');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'background');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'width');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'minWidth');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'maxWidth');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'height');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'minHeight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'maxHeight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'top');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'right');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'bottom');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'left');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontSize');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontWeight');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontFamily');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'fontStyle');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'opacity');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexShrink');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexGrow');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexBasis');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'flexFlow');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'order');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'boxShadow');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'textShadow');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'transition');
defineDynamicStyleProp(STYLE_PROP_SPEC, 'outline');

defineStaticStyleProp(STYLE_PROP_SPEC, 'display');
defineStaticStyleProp(STYLE_PROP_SPEC, 'position');
defineStaticStyleProp(STYLE_PROP_SPEC, 'textAlign');
defineStaticStyleProp(STYLE_PROP_SPEC, 'overflow');
defineStaticStyleProp(STYLE_PROP_SPEC, 'overflowX');
defineStaticStyleProp(STYLE_PROP_SPEC, 'overflowY');
defineStaticStyleProp(STYLE_PROP_SPEC, 'float');
defineStaticStyleProp(STYLE_PROP_SPEC, 'flexDirection');
{'fraction_non_alphanumeric': 0.1647163120567376, 'fraction_numerical': 0.0001773049645390071, 'mean_word_length': 7.981687898089172, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4461631', 'n_tokens_mistral': 3834, 'n_tokens_neox': 3640, 'n_words': 671}