diff --git a/gulp/js/default.js b/gulp/js/default.js index fda2159b..b6c66abd 100644 --- a/gulp/js/default.js +++ b/gulp/js/default.js @@ -12,7 +12,8 @@ var taskName = 'js', taskConfig = { src: [ './source/assets/js/main.js', - './source/assets/js/head.js' + './source/assets/js/head.js', + './source/preview/assets/js/preview.js' ], devSrc: [ './source/assets/js/dev.js' diff --git a/helpers/handlebars.js b/helpers/handlebars.js index 4a986604..895bb148 100644 --- a/helpers/handlebars.js +++ b/helpers/handlebars.js @@ -91,15 +91,6 @@ helpers.dynamicPartial = function(name, partialData, options) { return new Handlebars.SafeString(output); }; -// Module preview -helpers.hasVariants = function(variants, options) { - if (Object.keys(variants).length > 1) { - return options.fn(this); - } else { - return options.inverse(this); - } -}; - // Register helpers Handlebars.registerHelper(helpers); diff --git a/source/data/default.data.js b/source/data/default.data.js index 7c396206..864b26c6 100644 --- a/source/data/default.data.js +++ b/source/data/default.data.js @@ -1,14 +1,49 @@ 'use strict'; var util = require('gulp-util'), + tree = require('./tree.data.js'), data = { meta: { - project: 'Estático' + project: 'Estático', + client: { + name: 'Unic AG', + url: 'https://unic.com' + }, + license: { + name: 'Apache 2.0', + url: 'http://www.apache.org/licenses/LICENSE-2.0' + }, + social: [ + { + url: 'http://facebook.com/unic', + title: 'Follow @unic on Facebook', + iconPath: 'M211.9 197.4h-36.7v59.9h36.7V433.1h70.5V256.5h49.2l5.2-59.1h-54.4c0 0 0-22.1 0-33.7 0-13.9 2.8-19.5 16.3-19.5 10.9 0 38.2 0 38.2 0V82.9c0 0-40.2 0-48.8 0 -52.5 0-76.1 23.1-76.1 67.3C211.9 188.8 211.9 197.4 211.9 197.4z', + name: 'Facebook' + }, + { + url: 'http://twitter.com/unic', + title: 'Follow @unic on Twitter', + iconPath: 'M419.6 168.6c-11.7 5.2-24.2 8.7-37.4 10.2 13.4-8.1 23.8-20.8 28.6-36 -12.6 7.5-26.5 12.9-41.3 15.8 -11.9-12.6-28.8-20.6-47.5-20.6 -42 0-72.9 39.2-63.4 79.9 -54.1-2.7-102.1-28.6-134.2-68 -17 29.2-8.8 67.5 20.1 86.9 -10.7-0.3-20.7-3.3-29.5-8.1 -0.7 30.2 20.9 58.4 52.2 64.6 -9.2 2.5-19.2 3.1-29.4 1.1 8.3 25.9 32.3 44.7 60.8 45.2 -27.4 21.4-61.8 31-96.4 27 28.8 18.5 63 29.2 99.8 29.2 120.8 0 189.1-102.1 185-193.6C399.9 193.1 410.9 181.7 419.6 168.6z', + name: 'Twitter' + }, + { + url: 'https://www.linkedin.com/company/unic', + title: 'Find us on Linkedin', + iconPath: 'M186.4 142.4c0 19-15.3 34.5-34.2 34.5 -18.9 0-34.2-15.4-34.2-34.5 0-19 15.3-34.5 34.2-34.5C171.1 107.9 186.4 123.4 186.4 142.4zM181.4 201.3h-57.8V388.1h57.8V201.3zM273.8 201.3h-55.4V388.1h55.4c0 0 0-69.3 0-98 0-26.3 12.1-41.9 35.2-41.9 21.3 0 31.5 15 31.5 41.9 0 26.9 0 98 0 98h57.5c0 0 0-68.2 0-118.3 0-50-28.3-74.2-68-74.2 -39.6 0-56.3 30.9-56.3 30.9v-25.2H273.8z', + name: 'LinkedIn' + }, + { + url: 'https://github.com/unic/estatico', + title: 'Get the code on GitHub', + iconPath: 'M256 70.7c-102.6 0-185.9 83.2-185.9 185.9 0 82.1 53.3 151.8 127.1 176.4 9.3 1.7 12.3-4 12.3-8.9V389.4c-51.7 11.3-62.5-21.9-62.5-21.9 -8.4-21.5-20.6-27.2-20.6-27.2 -16.9-11.5 1.3-11.3 1.3-11.3 18.7 1.3 28.5 19.2 28.5 19.2 16.6 28.4 43.5 20.2 54.1 15.4 1.7-12 6.5-20.2 11.8-24.9 -41.3-4.7-84.7-20.6-84.7-91.9 0-20.3 7.3-36.9 19.2-49.9 -1.9-4.7-8.3-23.6 1.8-49.2 0 0 15.6-5 51.1 19.1 14.8-4.1 30.7-6.2 46.5-6.3 15.8 0.1 31.7 2.1 46.6 6.3 35.5-24 51.1-19.1 51.1-19.1 10.1 25.6 3.8 44.5 1.8 49.2 11.9 13 19.1 29.6 19.1 49.9 0 71.4-43.5 87.1-84.9 91.7 6.7 5.8 12.8 17.1 12.8 34.4 0 24.9 0 44.9 0 51 0 4.9 3 10.7 12.4 8.9 73.8-24.6 127-94.3 127-176.4C441.9 153.9 358.6 70.7 256 70.7z', + name: 'GitHub Repository' + } + ] }, env: util.env, + tree: tree, props: { svgSprites: JSON.stringify([ - // Disabled since there are no icons by default // '/assets/media/svg/base.svg' ]) diff --git a/source/data/tree.data.js b/source/data/tree.data.js new file mode 100644 index 00000000..b5e45f5d --- /dev/null +++ b/source/data/tree.data.js @@ -0,0 +1,45 @@ +'use strict'; + +var _ = require('lodash'), + dataHelper = require('../../helpers/data.js'), + path = require('path'), + + transform = function(data, filePath) { + const previewUrl = '/' + path.relative('./source/', filePath).replace('.data.js', '.html'); + + return _.merge(data, { + meta: { + previewUrl: previewUrl, + documentation: dataHelper.getDocumentation('../index.md') + } + }); + }, + + data = { + pages: dataHelper.getDataGlob('./source/pages/**/*.data.js', transform), + demoPages: dataHelper.getDataGlob('./source/demo/pages/**/*.data.js', transform), + modules: dataHelper.getDataGlob('./source/modules/**/*.data.js', transform), + demoModules: dataHelper.getDataGlob('./source/demo/modules/**/*.data.js', transform), + styleguide: dataHelper.getDataGlob('./source/preview/styleguide/*.data.js', transform) + }; + +// console.log('pages =>', data.pages); + + +data.pages = _.sortBy(data.pages, function(item) { + return item.meta.title; +}).concat(_.sortBy(data.demoPages, function(item) { + return item.meta.title; +})); + +data.modules = _.sortBy(data.modules, function(item) { + return item.meta.title; +}).concat(_.sortBy(data.demoModules, function(item) { + return item.meta.title; +})); + +data.styleguide = _.sortBy(data.styleguide, function(item) { + return item.meta.title; +}); + +module.exports = data; diff --git a/source/index.data.js b/source/index.data.js index 35499eac..b2d8949a 100644 --- a/source/index.data.js +++ b/source/index.data.js @@ -4,41 +4,12 @@ var _ = require('lodash'), requireNew = require('require-new'), dataHelper = require('../helpers/data.js'), defaultData = requireNew('./data/default.data.js'), - path = require('path'), - transform = function(data, filePath) { - var previewUrl = path.relative('./source/', filePath).replace('.data.js', '.html'); - - data = _.merge(data, { - meta: { - previewUrl: previewUrl - } - }); - - return data; - }, data = _.merge(defaultData, { - pages: dataHelper.getDataGlob('./source/pages/**/*.data.js', transform), - demoPages: dataHelper.getDataGlob('./source/demo/pages/**/*.data.js', transform), - modules: dataHelper.getDataGlob('./source/modules/**/*.data.js', transform), - demoModules: dataHelper.getDataGlob('./source/demo/modules/**/*.data.js', transform), - styleguide: dataHelper.getDataGlob('./source/preview/styleguide/*.data.js', transform) + meta: { + documentation: dataHelper.getDocumentation('index.md') + }, + additionalLayoutClasses: 'sg--home' }); -data.pages = _.sortBy(data.pages, function(item) { - return item.meta.title; -}).concat(_.sortBy(data.demoPages, function(item) { - return item.meta.title; -})); - -data.modules = _.sortBy(data.modules, function(item) { - return item.meta.title; -}).concat(_.sortBy(data.demoModules, function(item) { - return item.meta.title; -})); - -data.styleguide = _.sortBy(data.styleguide, function(item) { - return item.meta.title; -}); - module.exports = data; diff --git a/source/index.hbs b/source/index.hbs index c7936c24..837cb04a 100644 --- a/source/index.hbs +++ b/source/index.hbs @@ -1,69 +1,11 @@ {{#extend "preview/layouts/layout"}} {{#content "content"}} -
{{{meta.code.handlebars.content}}}
+ {{{meta.code.handlebars.content}}}
{{#each meta.code.handlebars.partials as |partial|}}
- {{{partial.content}}}
+ {{{partial.content}}}
{{/each}}
{{/if}}
{{#if meta.code.data}}
- {{{meta.code.data}}}
+ {{{meta.code.data}}}
{{/if}}
{{#if meta.code.html}}
- {{{meta.code.html}}}
+ {{{meta.code.html}}}
{{/if}}
diff --git a/source/preview/styleguide/elements/figure.hbs b/source/preview/styleguide/elements/figure.hbs index 46a1c48d..1246da78 100644 --- a/source/preview/styleguide/elements/figure.hbs +++ b/source/preview/styleguide/elements/figure.hbs @@ -1,6 +1,6 @@ -Some sort of famous witty quote marked up with a <blockquote> and a child <p> element.
P R E F O R M A T T E D T E X T @@ -14,7 +14,7 @@
<html>
<head>
diff --git a/source/preview/styleguide/elements/tables.hbs b/source/preview/styleguide/elements/tables.hbs
index 45cb7c72..7782cae0 100644
--- a/source/preview/styleguide/elements/tables.hbs
+++ b/source/preview/styleguide/elements/tables.hbs
@@ -1,7 +1,7 @@
-
- Tables
-
-
+
+ Tables
+
+
Default Table
Table Caption
@@ -39,7 +39,7 @@
-
+
Table with side headings
Table Caption
diff --git a/source/preview/styleguide/elements/text_elements.hbs b/source/preview/styleguide/elements/text_elements.hbs
index 4995c6b8..228cf1e1 100644
--- a/source/preview/styleguide/elements/text_elements.hbs
+++ b/source/preview/styleguide/elements/text_elements.hbs
@@ -1,10 +1,10 @@
-
- Text Elements
-
+
+ Text Elements
+
There are a number of inline HTML elements you may use anywhere within other elements.
-
+
Links and anchors
The a element is used to hyperlink text, be that to another page, a named fragment on the current page or any other location on the web. Example:
@@ -12,7 +12,7 @@
-
+
Stressed emphasis
The em element is used to denote text with stressed emphasis, i.e., something you’d pronounce differently. Where italicizing is required for stylistic differentiation, the i element may be preferable. Example:
@@ -20,7 +20,7 @@
-
+
Strong importance
The strong element is used to denote text with strong importance. Where bolding is used for stylistic differentiation, the b element may be preferable. Example:
@@ -28,7 +28,7 @@
-
+
Small print
The small element is used to represent disclaimers, caveats, legal restrictions, or copyrights (commonly referred to as ‘small print’). It can also be used for attributions or satisfying licensing requirements. Example:
@@ -36,7 +36,7 @@
-
+
Strikethrough
The s element is used to represent content that is no longer accurate or relevant. When indicating document edits i.e., marking a span of text as having been removed from a document, use the del element instead. Example:
@@ -44,7 +44,7 @@
-
+
Citations
The cite element is used to represent the title of a work (e.g. a book, essay, poem, song, film, TV show, sculpture, painting, musical, exhibition, etc). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can just be a work that is mentioned in passing. Example:
@@ -52,7 +52,7 @@
-
+
Inline quotes
The q element is used for quoting text inline. Example showing nested quotations:
@@ -60,7 +60,7 @@
-
+
Definition
The dfn element is used to highlight the first use of a term. The title attribute can be used to describe the term. Example:
@@ -68,7 +68,7 @@
-
+
Abbreviation
The abbr element is used for any abbreviated text, whether it be acronym, initialism, or otherwise. Generally, it’s less work and useful (enough) to mark up only the first occurrence of any particular abbreviation on a page, and ignore the rest. Any text in the title attribute will appear when the user’s mouse hovers the abbreviation (although notably, this does not work in Internet Explorer for Windows). Example abbreviations:
@@ -76,7 +76,7 @@
-
+
Time
The time element is used to represent either a time on a 24 hour clock, or a precise date in the proleptic Gregorian calendar, optionally with a time and a time-zone offset. Example:
@@ -84,7 +84,7 @@
-
+
Code
The code element is used to represent fragments of computer code. Useful for technology-oriented sites, not so useful otherwise. Example:
@@ -100,7 +100,7 @@
-
+
Variable
The var element is used to denote a variable in a mathematical expression or programming context, but can also be used to indicate a placeholder where the contents should be replaced with your own value. Example:
@@ -108,7 +108,7 @@
-
+
Sample output
The samp element is used to represent (sample) output from a program or computing system. Useful for technology-oriented sites, not so useful otherwise. Example:
@@ -116,7 +116,7 @@
-
+
Keyboard entry
The kbd element is used to denote user input (typically via a keyboard, although it may also be used to represent other input methods, such as voice commands). Example:
@@ -124,7 +124,7 @@
-
+
Superscript and subscript text
The sup element represents a superscript and the sub element represents a sub. These elements must be used only to mark up typographical conventions with specific meanings, not for typographical presentation. As a guide, only use these elements if their absence would change the meaning of the content. Example:
@@ -133,7 +133,7 @@
-
+
Italicised
The i element is used for text in an alternate voice or mood, or otherwise offset from the normal prose. Examples include taxonomic designations, technical terms, idiomatic phrases from another language, the name of a ship or other spans of text whose typographic presentation is typically italicised. Example:
@@ -141,7 +141,7 @@
-
+
Emboldened
The b element is used for text stylistically offset from normal prose without conveying extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typographic presentation is typically emboldened. Example:
@@ -149,7 +149,7 @@
-
+
Marked or highlighted text
The mark element is used to represent a run of text marked or highlighted for reference purposes. When used in a quotation it indicates a highlight not originally present but added to bring the reader’s attention to that part of the text. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its relevance to the user’s current activity. Example:
@@ -157,7 +157,7 @@
-
+
Edits
The del element is used to represent deleted or retracted text which still must remain on the page for some reason. Meanwhile its counterpart, the ins element, is used to represent inserted text. Both del and ins have a datetime attribute which allows you to include a timestamp directly in the element. Example inserted text and usage:
diff --git a/source/preview/styleguide/elements/text_paragraph.hbs b/source/preview/styleguide/elements/text_paragraph.hbs
index 95db921c..d5310545 100644
--- a/source/preview/styleguide/elements/text_paragraph.hbs
+++ b/source/preview/styleguide/elements/text_paragraph.hbs
@@ -1,6 +1,6 @@
-
- Paragraph/Text
-
+
+ Paragraph/Text
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
diff --git a/source/preview/styleguide/forms.hbs b/source/preview/styleguide/forms.hbs
index 5231ca6a..6f4a7321 100644
--- a/source/preview/styleguide/forms.hbs
+++ b/source/preview/styleguide/forms.hbs
@@ -1,225 +1,235 @@
{{#extend "preview/layouts/layout"}}
{{#content "content"}}
-
- Form buttons
-
-
-
-
+
+ {{#if meta.title}}
+ {{meta.title}}
+ {{else}}
+ Module Preview
+ {{/if}}
+
-
- Form fields default
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
- Form fields disabled
-
-
-
-
+
+ Form fields disabled
+
+
+
+
-
- Form fields readonly
-
-
-
-
+
+ Form fields readonly
+
+
+
+
-
- Form fields with datalist
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- Form fieldset
-
-
-
-
+
+ Form fieldset
+
+
+
+
+
{{/content}}
{{/extend}}
diff --git a/source/preview/styleguide/icons.data.js b/source/preview/styleguide/icons.data.js
index 09a5edbc..e7fb92aa 100644
--- a/source/preview/styleguide/icons.data.js
+++ b/source/preview/styleguide/icons.data.js
@@ -7,7 +7,7 @@ var _ = require('lodash'),
path = require('path'),
data = _.merge(defaultData, {
meta: {
- title: 'Icons (font variant)',
+ title: 'Icons (font variant)'
},
icons: _.map(glob.sync('./source/{,demo/}{assets/media/,modules/**/}icons/*'), function(file) {
return path.basename(file).replace(path.extname(file), '');
diff --git a/source/preview/styleguide/icons.hbs b/source/preview/styleguide/icons.hbs
index 6f389778..e72fa730 100644
--- a/source/preview/styleguide/icons.hbs
+++ b/source/preview/styleguide/icons.hbs
@@ -1,14 +1,22 @@
{{#extend "preview/layouts/layout"}}
{{#content "content"}}
+
+ {{#if meta.title}}
+ {{meta.title}}
+ {{else}}
+ Module Preview
+ {{/if}}
+
+
-
-
+
+
{{#each icons}}
-
- {{this}}
+
+ {{this}}
{{#each ../sizes}}
-
+
{{/each}}
diff --git a/source/preview/styleguide/webfonts.hbs b/source/preview/styleguide/webfonts.hbs
index 1b2c9997..3668e90f 100644
--- a/source/preview/styleguide/webfonts.hbs
+++ b/source/preview/styleguide/webfonts.hbs
@@ -7,51 +7,62 @@ In case of different sizes for each weight, they can be defined in separate obje
{{#extend "preview/layouts/layout"}}
{{#content "content"}}
-
- Warning: By default, the font loader assumes to find a /assets/css/fonts.css file. This can be configured as a parameter of the FontLoader instance in head.js. The result is that this currently fails on our GitHub pages, e.g., where the whole build is in a subdirectory. Subsequently, the request to the CSS file will result in a 404 and Roboto will not be loaded.
+
+ {{#if meta.title}}
+ {{meta.title}}
+ {{else}}
+ Module Preview
+ {{/if}}
+
+
+
{{#each fonts}}
-
- family: {{family}}
+
+
+ Warning: By default, the font loader assumes to find a /assets/css/fonts.css file. This can be configured as a parameter of the FontLoader instance in head.js. The result is that this currently fails on our GitHub pages, e.g., where the whole build is in a subdirectory. Subsequently, the request to the CSS file will result in a 404 and Roboto will not be loaded.
+
+
+ family: {{family}}
{{#each variants}}
-
-
- weight: {{weight}}
style: {{style}}
-
-
- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- a b c d e f g h i j k l m n o p q r s t u v w x y z
- À È Ì Ò Ù Á É Í Ó Ú Ä Ë Ï Ö Ü Â Ê Î Ô Û Ç
- à è ì ò ù á é í ó ú ä ë ï ö ü â ê î ô û ç
- 0 1 2 3 4 5 6 7 8 9 . , ; : - _ = { } ( ) [ ] ? ! $ £ & % * " ' § °
-
-
- example text
-
-
- A static build is a compiled version of a program which has been statically linked against libraries.
-
-
- In computer science, linking means taking one or more objects generated by compilers and assemble them into a single executable program. The objects are program modules containing machine code and symbol definitions, which come in two varieties:
-
-
- Defined or exported symbols are functions or variables that are present in the module represented by the object, and which should be available for use by other modules.
- Undefined or imported symbols are functions or variables that are called or referenced by this object, but not internally defined.
- A linker program then resolves references to undefined symbols by finding out which other object defines a symbol in question, and replacing placeholders with the symbol's address. Linkers can take objects from a collection called a library. The final program does not include the whole library, only those objects from it that are needed. Libraries for diverse purposes exist, and one or more system libraries are usually linked in by default.
-
-
- Modern operating system environments allow dynamic linking, or the postponing of the resolving of some undefined symbols until a program is run. That means that the executable still contains undefined symbols, plus a list of objects or libraries that will provide definitions for these. Loading the program will load these objects/libraries as well, and perform a final linking.
-
-
-
+
+ weight: {{weight}}
style: {{style}}
+
+
+ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+ a b c d e f g h i j k l m n o p q r s t u v w x y z
+ À È Ì Ò Ù Á É Í Ó Ú Ä Ë Ï Ö Ü Â Ê Î Ô Û Ç
+ à è ì ò ù á é í ó ú ä ë ï ö ü â ê î ô û ç
+ 0 1 2 3 4 5 6 7 8 9 . , ; : - _ = { } ( ) [ ] ? ! $ £ & % * " ' § °
+
+
+
+ example text
+
+
+ A static build is a compiled version of a program which has been statically linked against libraries.
+
+
+ In computer science, linking means taking one or more objects generated by compilers and assemble them into a single executable program. The objects are program modules containing machine code and symbol definitions, which come in two varieties:
+
+
+ Defined or exported symbols are functions or variables that are present in the module represented by the object, and which should be available for use by other modules.
+ Undefined or imported symbols are functions or variables that are called or referenced by this object, but not internally defined.
+ A linker program then resolves references to undefined symbols by finding out which other object defines a symbol in question, and replacing placeholders with the symbol's address. Linkers can take objects from a collection called a library. The final program does not include the whole library, only those objects from it that are needed. Libraries for diverse purposes exist, and one or more system libraries are usually linked in by default.
+
+
+ Modern operating system environments allow dynamic linking, or the postponing of the resolving of some undefined symbols until a program is run. That means that the executable still contains undefined symbols, plus a list of objects or libraries that will provide definitions for these. Loading the program will load these objects/libraries as well, and perform a final linking.
+
+
+
+
.selector {
font-family: {{../family}};
font-weight: {{weight}};
font-style: {{style}};
}
-
-
+
{{/each}}