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
flemay
committed
Apr 18, 2015
0 parents
commit 7239a41
Showing
16 changed files
with
931 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
.npm |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Frederic Lemay | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
Semantic UI for Meteor | ||
====================== | ||
|
||
This package integrates [Semantic UI](http://semantic-ui.com) into Meteor and lets you configure what parts you need. | ||
|
||
The current version of this package integrates Semantic UI v1.12.0. See RELEASE-NOTES.md for more details. | ||
|
||
Installation | ||
------------ | ||
|
||
meteor add semantic:ui flemay:less-autoprefixer | ||
|
||
Usage | ||
----- | ||
|
||
1. create an empty `custom.semantic.json` file somewhere in your project. For example `/client/lib/semantic-ui/custom.semantic.json`. | ||
2. start meteor | ||
3. edit the file `custom.semantic.json` to select only the definitions and themes you want | ||
4. save the file and it will generate Semantic UI | ||
|
||
> Note: if you are happy with the default values you will need to remove `.custom.semantic.json` to generate Semantic UI. (see Generating Trigger) | ||
custom.semantic.json | ||
-------------------- | ||
|
||
`custom.semantic.json` is the most important file. If it is empty, `semantic:ui` will generate the content with all the definitions and themes. By default, it sets to true all definitions and the theme "default". | ||
|
||
``` | ||
{ | ||
"definitions": { | ||
"accordion": true, | ||
"ad": true, | ||
"api": true, | ||
... | ||
}, | ||
"themes": { | ||
"amazon": false, | ||
"basic": false, | ||
"bookish": false, | ||
"bootstrap3": false, | ||
"chubby": false, | ||
"classic": false, | ||
"default": true, | ||
... | ||
} | ||
``` | ||
|
||
Changing any value will trigger the package to regenerate the files/folders accordingly. | ||
|
||
Generated Structure | ||
------------------- | ||
|
||
This package generates the following structure based on `custom.semantic.json` | ||
|
||
``` | ||
+- definitions/ | ||
+- site/ | ||
+- themes/ | ||
|- .custom.semantic.json | ||
|- custom.semantic.json | ||
|- semantic.less | ||
|- theme.config.import.less | ||
|- theme.import.less | ||
``` | ||
|
||
The following table explains the generated files/folders and if they are editable without losing any changes when generating. | ||
|
||
File/Folder | Description | Generated | Editable | ||
--- | --- | --- | --- | ||
definitions/ | contains the `less` and `javascript` definitions for each component | always | no | ||
site/ | contains your current site's theme | only if it does not exist | yes | ||
themes/ | contains *pre-packaged themes* including Semantic's default theme | always | no | ||
.custom.semantic.json | copy of custom.semantic.json (see Generating Trigger) | always | no | ||
custom.semantic.json | contains definitions and themes to be included or not | only if the file is empty | yes | ||
semantic.less | imports the definitions | always | no | ||
theme.config.import.less | defines which theme to use per components | only if the file does not exist | yes | ||
theme.import.less | imports the right themes | always | no | ||
|
||
### site/ | ||
|
||
This folder contains your current site's theme. It is generated only when it does not exist. Therefore if you change `custom.semantic.json` to turn definitions/themes on/off, then it will not affect **site/**. You will either need to add/remove files in **site/** or remove the **site/** folder so it can be regenerated again. | ||
|
||
Generating Trigger | ||
------------------ | ||
|
||
Every time Meteor starts (or refreshes) it calls the package `semantic:ui` to generate Semantic UI. | ||
|
||
The package has a simple mechanism based on the difference of `custom.semantic.json` and `.custom.semantic.json` to avoid generating all the time the files and folders. | ||
|
||
Therefore if the file `.custom.semantic.json` does not exist or it is different than `custom.semantic.json` then it will generate Semantic UI. | ||
|
||
Dependencies | ||
------------ | ||
**[flemay:less-autoprefixer](https://atmospherejs.com/flemay/less-autoprefixer)**: Semantic UI needs autoprefixer to be compiled. | ||
|
||
**[semantic:ui-data](https://atmospherejs.com/semantic/ui-data)** is being used to get Semantic UI files. | ||
|
||
Contributing | ||
------------- | ||
|
||
Contributors are very welcome. | ||
|
||
License | ||
------- | ||
|
||
MIT license | ||
|
||
Credits and Acknowledgements | ||
---------------------------- | ||
|
||
**[nemo64:bootstrap](https://atmospherejs.com/nemo64/bootstrap)**: semantic:ui has been inspired by nemo64:bootstrap. It uses a very similar approach. |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Release Notes | ||
============= | ||
|
||
v1.0.0 - 2015-04-11 | ||
------------------- | ||
|
||
### First release | ||
- integrates Semantic UI version v1.12.0 |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
var _ = Npm.require('lodash'); | ||
|
||
var customSemanticData = {}; | ||
customSemanticData.data = {}; | ||
|
||
customSemanticData.filterDefinitions = function(strings, matcherFunc) { | ||
return filter(this.requiredDefinitionsNames(), strings, matcherFunc); | ||
}; | ||
|
||
customSemanticData.requiredDefinitionsNames = function() { | ||
var definitionsNames = _.keys(this.data.definitions); | ||
var that = this; | ||
return _.filter(definitionsNames, function(name) { | ||
return that.data.definitions[name]; | ||
}); | ||
}; | ||
|
||
customSemanticData.filterThemes = function(strings, matcherFunc) { | ||
return filter(this.requiredThemesNames(), strings, matcherFunc); | ||
}; | ||
|
||
var filter = function(names, strings, matcherFunc) { | ||
return _.filter(strings, function(s) { | ||
var match = _.find(names, function(name) { | ||
if (matcherFunc) { | ||
return matcherFunc(s, name); | ||
} else { | ||
return s.search(name) != -1; | ||
} | ||
}); | ||
return match; | ||
}); | ||
}; | ||
|
||
customSemanticData.requiredThemesNames = function() { | ||
var themesNames = _.keys(this.data.themes); | ||
var that = this; | ||
return _.filter(themesNames, function(name) { | ||
return that.data.themes[name]; | ||
}); | ||
}; | ||
|
||
customSemanticData.validate = function(definitionsData, themesData) { | ||
var throwError = function(name) { | ||
throw new Error('definition/theme "' + name + '"" does not exist. Please update your custom.semantic.json file.'); | ||
}; | ||
_.each(_.keys(this.data.definitions), function(definitionName) { | ||
if (!definitionsData.exists(definitionName)) { | ||
throwError(definitionName); | ||
} | ||
}); | ||
_.each(_.keys(this.data.themes), function(themeName) { | ||
if (!themesData.exists(themeName)) { | ||
throwError(themeName); | ||
} | ||
}); | ||
}; | ||
|
||
semanticUiPackage.customSemanticData = customSemanticData; |
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 |
---|---|---|
@@ -0,0 +1,134 @@ | ||
var _ = Npm.require('lodash'); | ||
|
||
var definitionsData = {}; | ||
|
||
definitionsData.data = [ | ||
|
||
{"name":"breadcrumb","less":"lib/semantic-ui/src/definitions/collections/breadcrumb.less"}, | ||
|
||
{"name":"form","less":"lib/semantic-ui/src/definitions/collections/form.less","js":"lib/semantic-ui/src/definitions/behaviors/form.js"}, | ||
|
||
{"name":"grid","less":"lib/semantic-ui/src/definitions/collections/grid.less"}, | ||
|
||
{"name":"menu","less":"lib/semantic-ui/src/definitions/collections/menu.less"}, | ||
|
||
{"name":"message","less":"lib/semantic-ui/src/definitions/collections/message.less"}, | ||
|
||
{"name":"table","less":"lib/semantic-ui/src/definitions/collections/table.less"}, | ||
|
||
{"name":"api","js":"lib/semantic-ui/src/definitions/behaviors/api.js"}, | ||
|
||
{"name":"colorize","js":"lib/semantic-ui/src/definitions/behaviors/colorize.js"}, | ||
|
||
{"name":"state","js":"lib/semantic-ui/src/definitions/behaviors/state.js"}, | ||
|
||
{"name":"visibility","js":"lib/semantic-ui/src/definitions/behaviors/visibility.js"}, | ||
|
||
{"name":"visit","js":"lib/semantic-ui/src/definitions/behaviors/visit.js"}, | ||
|
||
{"name":"reset","less":"lib/semantic-ui/src/definitions/globals/reset.less"}, | ||
|
||
{"name":"site","js":"lib/semantic-ui/src/definitions/globals/site.js","less":"lib/semantic-ui/src/definitions/globals/site.less"}, | ||
|
||
{"name":"button","less":"lib/semantic-ui/src/definitions/elements/button.less"}, | ||
|
||
{"name":"divider","less":"lib/semantic-ui/src/definitions/elements/divider.less"}, | ||
|
||
{"name":"flag","less":"lib/semantic-ui/src/definitions/elements/flag.less"}, | ||
|
||
{"name":"header","less":"lib/semantic-ui/src/definitions/elements/header.less"}, | ||
|
||
{"name":"icon","less":"lib/semantic-ui/src/definitions/elements/icon.less"}, | ||
|
||
{"name":"image","less":"lib/semantic-ui/src/definitions/elements/image.less"}, | ||
|
||
{"name":"input","less":"lib/semantic-ui/src/definitions/elements/input.less"}, | ||
|
||
{"name":"label","less":"lib/semantic-ui/src/definitions/elements/label.less"}, | ||
|
||
{"name":"list","less":"lib/semantic-ui/src/definitions/elements/list.less"}, | ||
|
||
{"name":"loader","less":"lib/semantic-ui/src/definitions/elements/loader.less"}, | ||
|
||
{"name":"rail","less":"lib/semantic-ui/src/definitions/elements/rail.less"}, | ||
|
||
{"name":"reveal","less":"lib/semantic-ui/src/definitions/elements/reveal.less"}, | ||
|
||
{"name":"segment","less":"lib/semantic-ui/src/definitions/elements/segment.less"}, | ||
|
||
{"name":"step","less":"lib/semantic-ui/src/definitions/elements/step.less"}, | ||
|
||
{"name":"accordion","js":"lib/semantic-ui/src/definitions/modules/accordion.js","less":"lib/semantic-ui/src/definitions/modules/accordion.less"}, | ||
|
||
{"name":"checkbox","js":"lib/semantic-ui/src/definitions/modules/checkbox.js","less":"lib/semantic-ui/src/definitions/modules/checkbox.less"}, | ||
|
||
{"name":"dimmer","js":"lib/semantic-ui/src/definitions/modules/dimmer.js","less":"lib/semantic-ui/src/definitions/modules/dimmer.less"}, | ||
|
||
{"name":"dropdown","js":"lib/semantic-ui/src/definitions/modules/dropdown.js","less":"lib/semantic-ui/src/definitions/modules/dropdown.less"}, | ||
|
||
{"name":"modal","js":"lib/semantic-ui/src/definitions/modules/modal.js","less":"lib/semantic-ui/src/definitions/modules/modal.less"}, | ||
|
||
{"name":"nag","js":"lib/semantic-ui/src/definitions/modules/nag.js","less":"lib/semantic-ui/src/definitions/modules/nag.less"}, | ||
|
||
{"name":"popup","js":"lib/semantic-ui/src/definitions/modules/popup.js","less":"lib/semantic-ui/src/definitions/modules/popup.less"}, | ||
|
||
{"name":"progress","js":"lib/semantic-ui/src/definitions/modules/progress.js","less":"lib/semantic-ui/src/definitions/modules/progress.less"}, | ||
|
||
{"name":"rating","js":"lib/semantic-ui/src/definitions/modules/rating.js","less":"lib/semantic-ui/src/definitions/modules/rating.less"}, | ||
|
||
{"name":"search","js":"lib/semantic-ui/src/definitions/modules/search.js","less":"lib/semantic-ui/src/definitions/modules/search.less"}, | ||
|
||
{"name":"shape","js":"lib/semantic-ui/src/definitions/modules/shape.js","less":"lib/semantic-ui/src/definitions/modules/shape.less"}, | ||
|
||
{"name":"sidebar","js":"lib/semantic-ui/src/definitions/modules/sidebar.js","less":"lib/semantic-ui/src/definitions/modules/sidebar.less"}, | ||
|
||
{"name":"sticky","js":"lib/semantic-ui/src/definitions/modules/sticky.js","less":"lib/semantic-ui/src/definitions/modules/sticky.less"}, | ||
|
||
{"name":"tab","js":"lib/semantic-ui/src/definitions/modules/tab.js","less":"lib/semantic-ui/src/definitions/modules/tab.less"}, | ||
|
||
{"name":"transition","js":"lib/semantic-ui/src/definitions/modules/transition.js","less":"lib/semantic-ui/src/definitions/modules/transition.less"}, | ||
|
||
{"name":"video","js":"lib/semantic-ui/src/definitions/modules/video.js","less":"lib/semantic-ui/src/definitions/modules/video.less"}, | ||
|
||
{"name":"ad","less":"lib/semantic-ui/src/definitions/views/ad.less"}, | ||
|
||
{"name":"card","less":"lib/semantic-ui/src/definitions/views/card.less"}, | ||
|
||
{"name":"comment","less":"lib/semantic-ui/src/definitions/views/comment.less"}, | ||
|
||
{"name":"feed","less":"lib/semantic-ui/src/definitions/views/feed.less"}, | ||
|
||
{"name":"item","less":"lib/semantic-ui/src/definitions/views/item.less"}, | ||
|
||
{"name":"statistic","less":"lib/semantic-ui/src/definitions/views/statistic.less"}, | ||
|
||
]; | ||
|
||
definitionsData.exists = function(name) { | ||
var sameName = function(definition) { | ||
return definition.name == name; | ||
}; | ||
return _.isUndefined(_.find(this.data, sameName)) ? false : true; | ||
}; | ||
|
||
definitionsData.lessFilePaths = function() { | ||
var definitionsWithLess = _.filter(this.data, function(d) { | ||
return d.less; | ||
}); | ||
return _.map(definitionsWithLess, function(d) { | ||
return d.less; | ||
}); | ||
}; | ||
|
||
definitionsData.jsFilePaths = function() { | ||
var definitionsWithJs = _.filter(this.data, function(d) { | ||
return d.js; | ||
}); | ||
return _.map(definitionsWithJs, function(d) { | ||
return d.js; | ||
}); | ||
}; | ||
|
||
definitionsData.semanticLessFile = 'lib/semantic-ui/src/semantic.less'; | ||
|
||
semanticUiPackage.definitionsData = definitionsData; |
Oops, something went wrong.