Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
878e3fb
commit 4f3fac4
Showing
7 changed files
with
220 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,17 @@ | ||
*For support questions you might try tweeting me [@lostgrid](https://twitter.com/lostgrid) first.* | ||
_For support questions you might try tweeting me [@lostgrid](https://twitter.com/lostgrid) first._ | ||
|
||
----- | ||
--- | ||
|
||
**Is this a feature request or a bug report?** | ||
|
||
|
||
|
||
**What is the current behavior?** | ||
|
||
|
||
|
||
**If it's a bug please provide the steps to reproduce it and maybe some code samples.** | ||
|
||
|
||
|
||
**What is the desired behavior?** | ||
|
||
|
||
|
||
**What's the motivation or use-case behind changing the behavior?** | ||
|
||
|
||
|
||
**What version of LostGrid, browser and browser version are affected by this issue? Did this happen in previous versions?** | ||
|
||
|
||
|
||
**Anything else?** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
**What kind of change is this? (Bug Fix, Feature...)** | ||
|
||
|
||
**What is the current behavior (You can also link to an issue)** | ||
|
||
|
||
**What is the new behavior this introduces (if any)** | ||
|
||
|
||
**Does this introduce any breaking changes?** | ||
|
||
|
||
**Does the PR fulfill these requirements?** | ||
|
||
- [ ] Tests for the changes have been added | ||
- [ ] Docs have been added or updated | ||
|
||
|
||
**Other Comments** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
module.exports = function lostFlexContainerDecl(css) { | ||
css.walkDecls('lost-flex-container', function lostFlexContainerFunction( | ||
decl | ||
) { | ||
decl.cloneBefore({ | ||
prop: 'display', | ||
value: 'flex', | ||
}); | ||
|
||
if (decl.value === 'column') { | ||
decl.cloneBefore({ | ||
prop: 'flex-flow', | ||
value: 'column nowrap', | ||
}); | ||
} else { | ||
css.walkDecls( | ||
'lost-flex-container', | ||
function lostFlexContainerFunction(decl) { | ||
decl.cloneBefore({ | ||
prop: 'flex-flow', | ||
value: 'row wrap', | ||
prop: 'display', | ||
value: 'flex', | ||
}); | ||
} | ||
|
||
decl.remove(); | ||
}); | ||
if (decl.value === 'column') { | ||
decl.cloneBefore({ | ||
prop: 'flex-flow', | ||
value: 'column nowrap', | ||
}); | ||
} else { | ||
decl.cloneBefore({ | ||
prop: 'flex-flow', | ||
value: 'row wrap', | ||
}); | ||
} | ||
|
||
decl.remove(); | ||
} | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,123 @@ | ||
var lgUtils = require('./core/lg-utilities'); | ||
|
||
module.exports = function lostMasonryColumnDecl(css, settings) { | ||
css.walkDecls('lost-masonry-column', function lostMasonryColumnFunction( | ||
decl | ||
) { | ||
var declArr = []; | ||
var lostMasonryColumn; | ||
var lostMasonryColumnRounder = settings.rounder; | ||
var lostMasonryColumnFlexbox = settings.flexbox; | ||
var lostMasonryColumnGutter = settings.gutter; | ||
var lostMasonryColumnGutterUnit; | ||
css.walkDecls( | ||
'lost-masonry-column', | ||
function lostMasonryColumnFunction(decl) { | ||
var declArr = []; | ||
var lostMasonryColumn; | ||
var lostMasonryColumnRounder = settings.rounder; | ||
var lostMasonryColumnFlexbox = settings.flexbox; | ||
var lostMasonryColumnGutter = settings.gutter; | ||
var lostMasonryColumnGutterUnit; | ||
|
||
function cloneAllBefore(props) { | ||
Object.keys(props).forEach(function traverseProps(prop) { | ||
decl.cloneBefore({ | ||
prop: prop, | ||
value: props[prop], | ||
function cloneAllBefore(props) { | ||
Object.keys(props).forEach(function traverseProps(prop) { | ||
decl.cloneBefore({ | ||
prop: prop, | ||
value: props[prop], | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
const sanitizedDecl = lgUtils.glueFractionMembers(decl.value); | ||
declArr = sanitizedDecl.split(' '); | ||
lostMasonryColumn = declArr[0]; | ||
const sanitizedDecl = lgUtils.glueFractionMembers(decl.value); | ||
declArr = sanitizedDecl.split(' '); | ||
lostMasonryColumn = declArr[0]; | ||
|
||
if (declArr[1] !== undefined && declArr[1].search(/^\d/) !== -1) { | ||
lostMasonryColumnGutter = declArr[1]; | ||
} | ||
if (declArr[1] !== undefined && declArr[1].search(/^\d/) !== -1) { | ||
lostMasonryColumnGutter = declArr[1]; | ||
} | ||
|
||
if (declArr.indexOf('flex') !== -1) { | ||
lostMasonryColumnFlexbox = 'flex'; | ||
} | ||
if (declArr.indexOf('flex') !== -1) { | ||
lostMasonryColumnFlexbox = 'flex'; | ||
} | ||
|
||
if (declArr.indexOf('no-flex') !== -1) { | ||
lostMasonryColumnFlexbox = 'no-flex'; | ||
} | ||
if (declArr.indexOf('no-flex') !== -1) { | ||
lostMasonryColumnFlexbox = 'no-flex'; | ||
} | ||
|
||
decl.parent.nodes.forEach(function lostMasonryColumnRounderFunction( | ||
declaration | ||
) { | ||
if (declaration.prop === 'lost-masonry-column-rounder') { | ||
lostMasonryColumnRounder = declaration.value; | ||
decl.parent.nodes.forEach(function lostMasonryColumnRounderFunction( | ||
declaration | ||
) { | ||
if (declaration.prop === 'lost-masonry-column-rounder') { | ||
lostMasonryColumnRounder = declaration.value; | ||
|
||
declaration.remove(); | ||
} | ||
}); | ||
declaration.remove(); | ||
} | ||
}); | ||
|
||
decl.parent.nodes.forEach(function lostMasonryColumnGutterFunction( | ||
declaration | ||
) { | ||
if (declaration.prop === 'lost-masonry-column-gutter') { | ||
lostMasonryColumnGutter = declaration.value; | ||
decl.parent.nodes.forEach(function lostMasonryColumnGutterFunction( | ||
declaration | ||
) { | ||
if (declaration.prop === 'lost-masonry-column-gutter') { | ||
lostMasonryColumnGutter = declaration.value; | ||
|
||
declaration.remove(); | ||
} | ||
}); | ||
decl.parent.nodes.forEach(function lostMasonryColumnFlexboxFunction( | ||
declaration | ||
) { | ||
if (declaration.prop === 'lost-masonry-column-flexbox') { | ||
if (declaration.value === 'flex') { | ||
lostMasonryColumnFlexbox = 'flex'; | ||
declaration.remove(); | ||
} | ||
}); | ||
decl.parent.nodes.forEach(function lostMasonryColumnFlexboxFunction( | ||
declaration | ||
) { | ||
if (declaration.prop === 'lost-masonry-column-flexbox') { | ||
if (declaration.value === 'flex') { | ||
lostMasonryColumnFlexbox = 'flex'; | ||
} | ||
|
||
declaration.remove(); | ||
declaration.remove(); | ||
} | ||
}); | ||
|
||
if (lostMasonryColumnGutter !== '0') { | ||
lostMasonryColumnGutterUnit = lostMasonryColumnGutter | ||
.match(/\D/g) | ||
.join(''); | ||
} else { | ||
lostMasonryColumnGutterUnit = ''; | ||
} | ||
}); | ||
|
||
if (lostMasonryColumnGutter !== '0') { | ||
lostMasonryColumnGutterUnit = lostMasonryColumnGutter | ||
.match(/\D/g) | ||
.join(''); | ||
} else { | ||
lostMasonryColumnGutterUnit = ''; | ||
} | ||
if (lostMasonryColumnFlexbox === 'flex') { | ||
decl.cloneBefore({ | ||
prop: 'flex', | ||
value: '0 0 auto', | ||
}); | ||
} else { | ||
decl.cloneBefore({ | ||
prop: 'float', | ||
value: 'left', | ||
}); | ||
} | ||
|
||
if (lostMasonryColumnFlexbox === 'flex') { | ||
decl.cloneBefore({ | ||
prop: 'flex', | ||
value: '0 0 auto', | ||
}); | ||
} else { | ||
decl.cloneBefore({ | ||
prop: 'float', | ||
value: 'left', | ||
}); | ||
} | ||
if (lostMasonryColumnGutter !== '0') { | ||
cloneAllBefore({ | ||
width: | ||
'calc(' + | ||
lostMasonryColumnRounder + | ||
'% * ' + | ||
lostMasonryColumn + | ||
' - ' + | ||
lostMasonryColumnGutter + | ||
')', | ||
'margin-left': | ||
parseInt(lostMasonryColumnGutter, 10) / 2 + | ||
lostMasonryColumnGutterUnit, | ||
'margin-right': | ||
parseInt(lostMasonryColumnGutter, 10) / 2 + | ||
lostMasonryColumnGutterUnit, | ||
}); | ||
} else { | ||
cloneAllBefore({ | ||
width: | ||
'calc(' + | ||
lostMasonryColumnRounder + | ||
'% * ' + | ||
lostMasonryColumn + | ||
')', | ||
'margin-left': parseInt(lostMasonryColumnGutter, 10) / 2, | ||
'margin-right': parseInt(lostMasonryColumnGutter, 10) / 2, | ||
}); | ||
} | ||
|
||
if (lostMasonryColumnGutter !== '0') { | ||
cloneAllBefore({ | ||
width: | ||
'calc(' + | ||
lostMasonryColumnRounder + | ||
'% * ' + | ||
lostMasonryColumn + | ||
' - ' + | ||
lostMasonryColumnGutter + | ||
')', | ||
'margin-left': | ||
parseInt(lostMasonryColumnGutter, 10) / 2 + | ||
lostMasonryColumnGutterUnit, | ||
'margin-right': | ||
parseInt(lostMasonryColumnGutter, 10) / 2 + | ||
lostMasonryColumnGutterUnit, | ||
}); | ||
} else { | ||
cloneAllBefore({ | ||
width: | ||
'calc(' + lostMasonryColumnRounder + '% * ' + lostMasonryColumn + ')', | ||
'margin-left': parseInt(lostMasonryColumnGutter, 10) / 2, | ||
'margin-right': parseInt(lostMasonryColumnGutter, 10) / 2, | ||
}); | ||
decl.remove(); | ||
} | ||
|
||
decl.remove(); | ||
}); | ||
); | ||
}; |
Oops, something went wrong.