Skip to content
This repository has been archived by the owner on Nov 12, 2017. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
#227 moved all dom modules and utils to packages
  • Loading branch information
rofrischmann committed Mar 1, 2016
1 parent 4e9f545 commit 25d6f5b
Show file tree
Hide file tree
Showing 27 changed files with 526 additions and 592 deletions.
403 changes: 403 additions & 0 deletions .esformatter

Large diffs are not rendered by default.

518 changes: 0 additions & 518 deletions package.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/react-look-native/LICENSE

This file was deleted.

59 changes: 59 additions & 0 deletions packages/react-look/docs/Docs.md
@@ -0,0 +1,59 @@
# Documentation

**The docs reference Version 1.0**.<br>
For legacy documentation please check [this](https://github.com/rofrischmann/react-look/tree/9a7261b16f9a06e8cd7e64773d19714fd4181219).

The following documentation pages will hopefully solve all your remaining questions and clear out the usage and intention of Look.<br>
If there's still something I forgot please let me know and don't be shy to ask. You may also create an issue so I can update the docs immediately.

## Table of contents

1. [Getting Started](GettingStarted.md)
* 1.1. [Installation](GettingStarted.md#1-installation)
* 1.2. [First Component](GettingStarted.md#2-first-component)
* 1.3. [Stateless Components](GettingStarted.md#3-stateless-components)
* 1.4. [Pseudo classes](GettingStarted.md#4-pseudo-classes)
* 1.5. [Media queries](GettingStarted.md#5-media-queries)
* 1.6. [Mixins & Plugins](GettingStarted.md#6-mixins--plugins)
* 1.7. [Fallback values](GettingStarted.md#7-fallback-values)
* 1.8. [Vendor prefixes](GettingStarted.md#8-vendor-prefixes)
* 1.9. [Server-side rendering](GettingStarted.md#9-server-side-rendering)
* 1.10. [DevTools](GettingStarted.md#10-devtools)
2. [API Reference](api/)
* **2.1. [look](api/Look.md)**
* **2.2. [StyleSheet](api/StyleSheet.md)**
* [create](api/StyleSheet.md#createstyles)
* [combineStyles](api/StyleSheet.md#combinestylesstyles)
* [toCSS](api/StyleSheet.md#tocssstyles--scope) <img src="../../../res/deprecated-badge.png" height=15>
* [addCSS](api/StyleSheet.md#addcssstyles--scope)
* [keyframes](api/StyleSheet.md#keyframesframes--name)
* [font](api/StyleSheet.md#fontfontfamily-files--properties)
* **2.3. [LookRoot](api/LookRoot.md)**
* **2.4. [StyleContainer](api/StyleContainer.md)**
3. Registry
* **3.1. [Plugins](Plugins.md)**
* [Fallback Value](plugins/FallbackValue.md)
* [Mixin](plugins/Mixin.md)
* [Prefixer](plugins/Prefixer.md)
* [Stateful Value](plugins/StatefulValue.md)
* [Stateful Selector](plugins/StatefulSelector.md)
* **3.1.1 [DevTools](Plugins.md#developertools)**
* [Friendly ClassName](plugins/FriendlyClassName.md)
* [Linter](plugins/Linter.md)
* [Style Logger](plugins/StyleLogger.md)
* **3.2 [Mixins](Mixins.md)**
* [Contains](Mixins.md#contains)
* [Extend](Mixins.md#extend)
* [Extract CSS](Mixins.md#extract-css)
* [Platform Queries](Mixins.md#platform-queries)
* [Stateful Conditions](Mixins.md#stateful-conditions)
* [Substr](Mixins.md#substr)
4. [Guides](guides/)
* 4.1. [Upgrading Look](guides/upgradeLook.md)
* 4.2. [Configuring Look](guides/configureLook.md)
* 4.3. [Build your own: Mixin](guides/customMixin.md)
* 4.4. [Build your own: Plugin](guides/customPlugin.md)
5. [FAQ](FAQ.md)
6. Under The Hood *(incomplete)*
* 6.1. How does Look work?
* 6.2. How does StyleSheet.create work?
@@ -1,7 +1,8 @@
import _ from 'lodash'
import { Component, PropTypes } from 'react'

import StyleContainer from './StyleContainer'
import resolveStyles from '../../core/dom/resolver'
import _ from 'lodash'
import resolveStyles from '../core/resolver'

const contextType = { _lookConfig: PropTypes.object }
/**
Expand Down
@@ -1,8 +1,9 @@
import _ from 'lodash'
import prefixer from '../../utils/prefixer'
import { toCSS } from 'inline-style-transformer'
import generateHashCode from '../../utils/generateHashCode'
import sortObject from '../../utils/sortObject'

import generateHashCode from '../utils/generateHashCode'
import sortObject from '../../../common/utils/sortObject'
import prefixer from '../utils/prefixer'

/**
* Abstract helper to add new styles to a Map/Set
Expand Down
@@ -1,8 +1,9 @@
import StyleContainer from './StyleContainer'
import renderStaticStyles from '../../core/dom/renderer'
import getFontFormat from '../../utils/getFontFormat'
import _ from 'lodash'

import StyleContainer from './StyleContainer'
import renderStaticStyles from '../core/renderer'
import getFontFormat from '../utils/getFontFormat'

let keyframe = 0

export default {
Expand Down
@@ -1,9 +1,10 @@
import StyleContainer from '../../api/dom/StyleContainer'
import sortPseudoClasses from '../../utils/sortPseudoClasses'
import isMediaQuery from '../../utils/isMediaQuery'
import isPseudo from '../../utils/isPseudo'
import _ from 'lodash'

import StyleContainer from '../api/StyleContainer'
import sortPseudoClasses from '../utils/sortPseudoClasses'
import isMediaQuery from '../utils/isMediaQuery'
import isPseudo from '../utils/isPseudo'

/**
* Extracts all possible dynamic styles out of a style object
* To be able to render all other (static) styles directly to CSS
Expand Down
@@ -1,11 +1,11 @@
import { cloneElement } from 'react'
import { resolvePlugins, resolveChildren, resolveProps, isLookEnhanced } from '../resolver'
import extractCSS from '../../mixins/dom/extractCSS'
import renderStaticStyles from './renderer'
import StyleContainer from '../../api/dom/StyleContainer'
import assignStyles from 'assign-styles'
import _ from 'lodash'
import { cloneElement } from 'react'

import { resolvePlugins, resolveChildren, resolveProps, isLookEnhanced } from '../../../common/core/resolver'
import renderStaticStyles from './renderer'
import extractCSS from '../mixins/extractCSS'
import StyleContainer from '../api/StyleContainer'

/**
* Resolves provided styles into style objects
Expand Down
36 changes: 18 additions & 18 deletions modules/dom.js → packages/react-look/modules/index.js
@@ -1,30 +1,30 @@
// Plugins
import prefixer from './plugins/dom/prefixer'
import staticPrefixer from './plugins/dom/staticPrefixer'
import fallbackValue from './plugins/dom/fallbackValue'
import statefulValue from './plugins/statefulValue'
import statefulSelector from './plugins/dom/statefulSelector'
import mixin from './plugins/mixin'
import prefixer from './plugins/prefixer'
import staticPrefixer from './plugins/staticPrefixer'
import fallbackValue from './plugins/fallbackValue'
import statefulValue from '../../common/plugins/statefulValue'
import statefulSelector from './plugins/statefulSelector'
import mixin from '../../common/plugins/mixin'

// Dev tools
import styleLogger from './plugins/styleLogger'
import linter from './plugins/dom/linter'
import friendlyClassName from './plugins/dom/friendlyClassName'
import styleLogger from '../../common/plugins/styleLogger'
import linter from './plugins/linter'
import friendlyClassName from './plugins/friendlyClassName'

// Mixins
import { equal, unEqual, greater, less, greaterThan, lessThan } from './mixins/condition'
import contains from './mixins/contains'
import extend from './mixins/extend'
import substr from './mixins/dom/substr'
import extractCSS from './mixins/dom/extractCSS'
import platformQuery from './mixins/dom/platformQuery'
import { equal, unEqual, greater, less, greaterThan, lessThan } from '../../common/mixins/condition'
import contains from '../../common/mixins/contains'
import extend from '../../common/mixins/extend'
import substr from './mixins/substr'
import extractCSS from './mixins/extractCSS'
import platformQuery from './mixins/platformQuery'

// Presets
import domPreset from './presets/react-dom'

import Enhancer from './core/enhancer'
import StyleSheet from './api/dom/StyleSheet'
import LookRoot from './api/dom/LookRoot'
import Enhancer from '../../common/core/enhancer'
import StyleSheet from './api/StyleSheet'
import LookRoot from './api/LookRoot'

// Resolving annotations
// If not passing arguments it just wraps the Component
Expand Down
@@ -1,4 +1,4 @@
import prefixer from '../../utils/prefixer'
import prefixer from '../utils/prefixer'

// Allows the use of platform queries supported by browser information
// provided by the inline-style-prefixer
Expand Down
@@ -1,7 +1,8 @@
import { createElement } from 'react'
import getPseudoExpression from '../../utils/getPseudoExpression'
import _ from 'lodash'

import getPseudoExpression from '../../../common/utils/getPseudoExpression'

// Evaluates if a element contains a given string
export default ({ property, value, newProps }) => {
let children = newProps.children
Expand Down
@@ -1,7 +1,8 @@
import camelToDashCase from '../../utils/camelToDashCase'
import assignStyles from 'assign-styles'
import _ from 'lodash'

import camelToDashCase from '../utils/camelToDashCase'

/**
* Resolves alternative values provided as an Array
*/
Expand Down
@@ -1,4 +1,4 @@
import getChildType from '../../utils/getChildType'
import getChildType from '../../../common/utils/getChildType'

const classNameTemplate = (Component, element, className) => {
return Component.constructor.displayName + '-' + getChildType(element) + '--' + className
Expand Down
@@ -1,5 +1,6 @@
import Linter from 'inline-style-linter'
import getChildType from '../../utils/getChildType'

import getChildType from '../../../common/utils/getChildType'

export default function linter({ styles, Component, element, config: { linter } }) {
const warnings = new Linter(linter).lint(styles)
Expand Down
@@ -1,4 +1,4 @@
import prefixer from '../../utils/prefixer'
import prefixer from '../utils/prefixer'

/*
* Adds vendor-prefixes to properties in need of
Expand Down
@@ -1,21 +1,21 @@
// Plugins
import mixin from '../plugins/mixin'
import statefulValue from '../plugins/statefulValue'
import statefulSelector from '../plugins/dom/statefulSelector'
import staticPrefixer from '../plugins/dom/staticPrefixer'
import fallbackValue from '../plugins/dom/fallbackValue'
import mixin from '../../../common/plugins/mixin'
import statefulValue from '../../../common/plugins/statefulValue'
import statefulSelector from '../plugins/statefulSelector'
import staticPrefixer from '../plugins/staticPrefixer'
import fallbackValue from '../plugins/fallbackValue'

// CSS extraction
import extractCSS from '../mixins/dom/extractCSS'
import platformQuery from '../mixins/dom/platformQuery'
import extractCSS from '../mixins/extractCSS'
import platformQuery from '../mixins/platformQuery'

// Conditions
import { equal, unEqual, greater, less, greaterThan, lessThan } from '../mixins/condition'
import { equal, unEqual, greater, less, greaterThan, lessThan } from '../../../common/mixins/condition'

// Other
import contains from '../mixins/contains'
import substr from '../mixins/dom/substr'
import extend from '../mixins/extend'
import contains from '../../../common/mixins/contains'
import substr from '../mixins/substr'
import extend from '../../../common/mixins/extend'

export default {
plugins: [
Expand Down
File renamed without changes.
Expand Up @@ -9,7 +9,11 @@ let prefixer
*/
export default userAgent => {
if (!prefixer) {
prefixer = new Prefixer({ userAgent: userAgent })
if (userAgent !== undefined) {
prefixer = new Prefixer({ userAgent: userAgent })
} else {
prefixer = new Prefixer()
}
}
// replace userAgent if config provides alternative one
if (prefixer._userAgent !== userAgent && userAgent !== undefined) {
Expand Down

0 comments on commit 25d6f5b

Please sign in to comment.