Skip to content

Commit

Permalink
Rename Path to Node, move style sheet to Node
Browse files Browse the repository at this point in the history
  • Loading branch information
vovkasm committed Dec 21, 2016
1 parent bf309e6 commit 3b24102
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/stylable.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import hoistStatics from 'hoist-non-react-statics'

import { Signal } from './mini-signals'

class Path {
constructor (name, variant, parent) {
class Node {
constructor (name, variant, parent, styleSheet) {
this.name = name
this.variant = variant
this.parent = parent
this.styleSheet = styleSheet
this.changed = new Signal()
this.path = undefined
this.fullPath = undefined
this.resolvePath()
}
getStyleSheet () { return this.styleSheet }
setVariant (variant) {
this.variant = variant
this.resolvePath()
Expand Down Expand Up @@ -61,8 +63,7 @@ export default function stylable (name) {

constructor (props, ctx) {
super(props, ctx)
this.styleSheet = ctx.styleSheet
this.path = new Path(name, props.variant, ctx.styleSheetPath)
this.path = new Node(name, props.variant, ctx.styleSheetPath, ctx.styleSheet)
this.parentSubscription = undefined
this.state = { childProps: this.getChildProps(props) }
}
Expand Down Expand Up @@ -94,7 +95,7 @@ export default function stylable (name) {
}

getChildProps (props) {
const childProps = this.styleSheet.getProps(this.path.path, props, props.variant)
const childProps = this.path.getStyleSheet().getProps(this.path.path, props, props.variant)
delete childProps.variant
return childProps
}
Expand Down

0 comments on commit 3b24102

Please sign in to comment.