guides_style_18f 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +19 -0
  3. data/LICENSE.md +31 -0
  4. data/README.md +91 -0
  5. data/assets/favicons/18f-center-114.png +0 -0
  6. data/assets/favicons/18f-center-144.png +0 -0
  7. data/assets/favicons/18f-center-16.png +0 -0
  8. data/assets/favicons/18f-center-192.png +0 -0
  9. data/assets/favicons/18f-center-200.png +0 -0
  10. data/assets/favicons/18f-center-32.png +0 -0
  11. data/assets/favicons/18f-center-57.png +0 -0
  12. data/assets/favicons/18f-center-72.png +0 -0
  13. data/assets/favicons/favicon.ico +0 -0
  14. data/assets/favicons/favicon.png +0 -0
  15. data/assets/img/18f-logo.png +0 -0
  16. data/assets/js/accordion.js +53 -0
  17. data/assets/js/html5shiv.js +301 -0
  18. data/assets/js/respond.js +341 -0
  19. data/lib/guides_style_18f.rb +8 -0
  20. data/lib/guides_style_18f/assets.rb +35 -0
  21. data/lib/guides_style_18f/generator.rb +12 -0
  22. data/lib/guides_style_18f/includes.rb +19 -0
  23. data/lib/guides_style_18f/includes/analytics.html +16 -0
  24. data/lib/guides_style_18f/includes/footer.html +9 -0
  25. data/lib/guides_style_18f/includes/header.html +21 -0
  26. data/lib/guides_style_18f/includes/scripts.html +5 -0
  27. data/lib/guides_style_18f/includes/sidebar.html +30 -0
  28. data/lib/guides_style_18f/layouts.rb +37 -0
  29. data/lib/guides_style_18f/layouts/default.html +40 -0
  30. data/lib/guides_style_18f/sass.rb +12 -0
  31. data/lib/guides_style_18f/sass/_guides_style_18f_custom.scss +50 -0
  32. data/lib/guides_style_18f/sass/_guides_style_18f_main.scss +606 -0
  33. data/lib/guides_style_18f/sass/_guides_style_18f_syntax.scss +60 -0
  34. data/lib/guides_style_18f/sass/guides_style_18f.scss +3 -0
  35. data/lib/guides_style_18f/version.rb +5 -0
  36. metadata +148 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cab37ea597931d824a06465aa3506012eb1f8b56
4
+ data.tar.gz: 85ca44041fb62b6758b81cc329254a3524698988
5
+ SHA512:
6
+ metadata.gz: 1a363b1cefe26d296b2eb78d5203e34319f7e34e3dd8e3d316d216bfbcaadd79f793aa5826b1bfd6e3965ed951a21e0aecd36010efbe647ee9caed41846a4e15
7
+ data.tar.gz: 81353d4711be77ab9d1d7fe0c67f45dc2f1bdf6ea98349bd48a6245674d59e0fac0fd9ac9af35572a6415cee72a8bd53698a1a985f194ac9a04345994cc750b6
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,19 @@
1
+ ## Welcome!
2
+
3
+ We're so glad you're thinking about contributing to an 18F open source project! If you're unsure about anything, just ask -- or submit the issue or pull request anyway. The worst that can happen is you'll be politely asked to change something. We love all friendly contributions.
4
+
5
+ We want to ensure a welcoming environment for all of our projects. Our staff follow the [18F Code of Conduct](https://github.com/18F/code-of-conduct/blob/master/code-of-conduct.md) and all contributors should do the same.
6
+
7
+ We encourage you to read this project's CONTRIBUTING policy (you are here), its [LICENSE](LICENSE.md), and its [README](README.md).
8
+
9
+ If you have any questions or want to read more, check out the [18F Open Source Policy GitHub repository]( https://github.com/18f/open-source-policy), or just [shoot us an email](mailto:18f@gsa.gov).
10
+
11
+ ## Public domain
12
+
13
+ This project is in the public domain within the United States, and
14
+ copyright and related rights in the work worldwide are waived through
15
+ the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
16
+
17
+ All contributions to this project will be released under the CC0
18
+ dedication. By submitting a pull request, you are agreeing to comply
19
+ with this waiver of copyright interest.
data/LICENSE.md ADDED
@@ -0,0 +1,31 @@
1
+ As a work of the United States Government, this project is in the
2
+ public domain within the United States.
3
+
4
+ Additionally, we waive copyright and related rights in the work
5
+ worldwide through the CC0 1.0 Universal public domain dedication.
6
+
7
+ ## CC0 1.0 Universal Summary
8
+
9
+ This is a human-readable summary of the [Legal Code (read the full text)](https://creativecommons.org/publicdomain/zero/1.0/legalcode).
10
+
11
+ ### No Copyright
12
+
13
+ The person who associated a work with this deed has dedicated the work to
14
+ the public domain by waiving all of his or her rights to the work worldwide
15
+ under copyright law, including all related and neighboring rights, to the
16
+ extent allowed by law.
17
+
18
+ You can copy, modify, distribute and perform the work, even for commercial
19
+ purposes, all without asking permission.
20
+
21
+ ### Other Information
22
+
23
+ In no way are the patent or trademark rights of any person affected by CC0,
24
+ nor are the rights that other persons may have in the work or in how the
25
+ work is used, such as publicity or privacy rights.
26
+
27
+ Unless expressly stated otherwise, the person who associated a work with
28
+ this deed makes no warranties about the work, and disclaims liability for
29
+ all uses of the work, to the fullest extent permitted by applicable law.
30
+ When using or citing the work, you should not imply endorsement by the
31
+ author or the affirmer.
data/README.md ADDED
@@ -0,0 +1,91 @@
1
+ ## [`guides_style_18f`](https://rubygems.org/gems/guides_style_18f): 18F Guides style gem
2
+
3
+ Provides consistent style elements for [Jekyll](https://jekyllrb.com/)-based
4
+ web sites based on the
5
+ [18F Guides Template](https://pages.18f.gov/guides-template/). The 18F Guides
6
+ theme is based on [DOCter](https://github.com/cfpb/docter/) from
7
+ [CFPB](http://cfpb.github.io/).
8
+
9
+ ### Usage
10
+
11
+ In your [`Gemfile`](http://bundler.io/gemfile.html), include the following:
12
+
13
+ ```ruby
14
+ group :jekyll_plugins do
15
+ gem 'guides_style_18f'
16
+ end
17
+ ```
18
+
19
+ Then in your [`_config.yml` file](https://jekyllrb.com/docs/configuration/),
20
+ add the following (you may need to remove any `layout:`
21
+ [front matter](https://jekyllrb.com/docs/frontmatter/) from existing pages for
22
+ this to take effect):
23
+
24
+ ```yaml
25
+ defaults:
26
+ -
27
+ scope:
28
+ path: ""
29
+ values:
30
+ layout: "guides_style_18f_default"
31
+ ```
32
+
33
+ Build the site per usual, and observe the results.
34
+
35
+ ### Additional features
36
+
37
+ Here are some other features that can be enabled via `_config.yml`:
38
+
39
+ ```yaml
40
+ # To use the shared 18F Guides Teamplate assets when deploying to
41
+ # pages.18f.gov, to avoid having to rebuild the site for minor style and
42
+ # script updates:
43
+ asset_root: /guides-template
44
+
45
+ # This adds the "back to" breadcrumb link under the page title:
46
+ back_link:
47
+ url: "https://pages.18f.gov/guides/"
48
+ text: Read more 18F Guides
49
+
50
+ # If you use Analytics, add your code here:
51
+ google_analytics_ua: UA-????????-??
52
+ ```
53
+
54
+ ### Additional scripts and styles
55
+
56
+ If you'd like to add additional scripts or styles to every page on the site,
57
+ you can add `styles:` and `scripts:` lists to `_config.yml`. To add them to a
58
+ particular page, add these lists to the page's front matter.
59
+
60
+ ### Development
61
+
62
+ First, choose a Jekyll site you'd like to use to view the impact of your
63
+ updates and clone its repository; then clone this repository into the same
64
+ parent directory. For example, to use the 18F Guides Template:
65
+
66
+ ```shell
67
+ $ git clone git@github.com:18F/guides-template.git
68
+ $ git clone git@github.com:18F/guides-style.git
69
+ ```
70
+
71
+ In the `Gemfile` of the Jekyll site's repository, include the following:
72
+
73
+ ```ruby
74
+ group :jekyll_plugins do
75
+ gem 'guides_style_18f', :path => '../guides-style'
76
+ end
77
+ ```
78
+
79
+ You can find the different style assets and templates within subdirectories of
80
+ the `assets` and `lib/guides_style_18f` directories of this repository. Edit
81
+ those, then rebuild the Jekyll site as usual to see the results.
82
+
83
+ ### Public domain
84
+
85
+ This project is in the worldwide [public domain](LICENSE.md). As stated in [CONTRIBUTING](CONTRIBUTING.md):
86
+
87
+ > This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
88
+ >
89
+ > All contributions to this project will be released under the CC0
90
+ >dedication. By submitting a pull request, you are agreeing to comply
91
+ >with this waiver of copyright interest.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,53 @@
1
+ /* Originally from the Government Wide Pattern Library.
2
+ Modified to check for items expanded on page load and
3
+ to allow you to close an accordion without opening another
4
+ */
5
+
6
+ function Accordion($el) {
7
+ var self = this;
8
+ this.$root = $el;
9
+ this.$root.on('click', 'button', function(ev) {
10
+ ev.preventDefault();
11
+ if ( $(this).attr('aria-expanded') === 'true' ) {
12
+ self.hide($(this));
13
+ } else {
14
+ self.show($(this));
15
+ }
16
+ });
17
+
18
+ }
19
+
20
+ Accordion.prototype.$ = function(selector) {
21
+ return this.$root.find(selector);
22
+ }
23
+
24
+ Accordion.prototype.hide = function($button) {
25
+ var selector = $button.attr('aria-controls'),
26
+ $content = this.$('#' + selector);
27
+ $button.attr('aria-expanded', false);
28
+ $content.attr('aria-hidden', true);
29
+ };
30
+
31
+ Accordion.prototype.show = function($button) {
32
+ var selector = $button.attr('aria-controls'),
33
+ $content = this.$('#' + selector);
34
+ $button.attr('aria-expanded', true);
35
+ $content.attr('aria-hidden', false);
36
+ };
37
+
38
+ Accordion.prototype.hideAll = function() {
39
+ var self = this;
40
+ this.$('button').each(function() {
41
+ self.hide($(this));
42
+ });
43
+ };
44
+
45
+ function accordion($el) {
46
+ return new Accordion($el);
47
+ }
48
+
49
+ $(function() {
50
+ $('.sidebar-nav').each(function() {
51
+ accordion($(this));
52
+ });
53
+ });
@@ -0,0 +1,301 @@
1
+ /**
2
+ * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3
+ */
4
+ ;(function(window, document) {
5
+ /*jshint evil:true */
6
+ /** version */
7
+ var version = '3.7.0';
8
+
9
+ /** Preset options */
10
+ var options = window.html5 || {};
11
+
12
+ /** Used to skip problem elements */
13
+ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
14
+
15
+ /** Not all elements can be cloned in IE **/
16
+ var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
17
+
18
+ /** Detect whether the browser supports default html5 styles */
19
+ var supportsHtml5Styles;
20
+
21
+ /** Name of the expando, to work with multiple documents or to re-shiv one document */
22
+ var expando = '_html5shiv';
23
+
24
+ /** The id for the the documents expando */
25
+ var expanID = 0;
26
+
27
+ /** Cached data for each document */
28
+ var expandoData = {};
29
+
30
+ /** Detect whether the browser supports unknown elements */
31
+ var supportsUnknownElements;
32
+
33
+ (function() {
34
+ try {
35
+ var a = document.createElement('a');
36
+ a.innerHTML = '<xyz></xyz>';
37
+ //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
38
+ supportsHtml5Styles = ('hidden' in a);
39
+
40
+ supportsUnknownElements = a.childNodes.length == 1 || (function() {
41
+ // assign a false positive if unable to shiv
42
+ (document.createElement)('a');
43
+ var frag = document.createDocumentFragment();
44
+ return (
45
+ typeof frag.cloneNode == 'undefined' ||
46
+ typeof frag.createDocumentFragment == 'undefined' ||
47
+ typeof frag.createElement == 'undefined'
48
+ );
49
+ }());
50
+ } catch(e) {
51
+ // assign a false positive if detection fails => unable to shiv
52
+ supportsHtml5Styles = true;
53
+ supportsUnknownElements = true;
54
+ }
55
+
56
+ }());
57
+
58
+ /*--------------------------------------------------------------------------*/
59
+
60
+ /**
61
+ * Creates a style sheet with the given CSS text and adds it to the document.
62
+ * @private
63
+ * @param {Document} ownerDocument The document.
64
+ * @param {String} cssText The CSS text.
65
+ * @returns {StyleSheet} The style element.
66
+ */
67
+ function addStyleSheet(ownerDocument, cssText) {
68
+ var p = ownerDocument.createElement('p'),
69
+ parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
70
+
71
+ p.innerHTML = 'x<style>' + cssText + '</style>';
72
+ return parent.insertBefore(p.lastChild, parent.firstChild);
73
+ }
74
+
75
+ /**
76
+ * Returns the value of `html5.elements` as an array.
77
+ * @private
78
+ * @returns {Array} An array of shived element node names.
79
+ */
80
+ function getElements() {
81
+ var elements = html5.elements;
82
+ return typeof elements == 'string' ? elements.split(' ') : elements;
83
+ }
84
+
85
+ /**
86
+ * Returns the data associated to the given document
87
+ * @private
88
+ * @param {Document} ownerDocument The document.
89
+ * @returns {Object} An object of data.
90
+ */
91
+ function getExpandoData(ownerDocument) {
92
+ var data = expandoData[ownerDocument[expando]];
93
+ if (!data) {
94
+ data = {};
95
+ expanID++;
96
+ ownerDocument[expando] = expanID;
97
+ expandoData[expanID] = data;
98
+ }
99
+ return data;
100
+ }
101
+
102
+ /**
103
+ * returns a shived element for the given nodeName and document
104
+ * @memberOf html5
105
+ * @param {String} nodeName name of the element
106
+ * @param {Document} ownerDocument The context document.
107
+ * @returns {Object} The shived element.
108
+ */
109
+ function createElement(nodeName, ownerDocument, data){
110
+ if (!ownerDocument) {
111
+ ownerDocument = document;
112
+ }
113
+ if(supportsUnknownElements){
114
+ return ownerDocument.createElement(nodeName);
115
+ }
116
+ if (!data) {
117
+ data = getExpandoData(ownerDocument);
118
+ }
119
+ var node;
120
+
121
+ if (data.cache[nodeName]) {
122
+ node = data.cache[nodeName].cloneNode();
123
+ } else if (saveClones.test(nodeName)) {
124
+ node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
125
+ } else {
126
+ node = data.createElem(nodeName);
127
+ }
128
+
129
+ // Avoid adding some elements to fragments in IE < 9 because
130
+ // * Attributes like `name` or `type` cannot be set/changed once an element
131
+ // is inserted into a document/fragment
132
+ // * Link elements with `src` attributes that are inaccessible, as with
133
+ // a 403 response, will cause the tab/window to crash
134
+ // * Script elements appended to fragments will execute when their `src`
135
+ // or `text` property is set
136
+ return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
137
+ }
138
+
139
+ /**
140
+ * returns a shived DocumentFragment for the given document
141
+ * @memberOf html5
142
+ * @param {Document} ownerDocument The context document.
143
+ * @returns {Object} The shived DocumentFragment.
144
+ */
145
+ function createDocumentFragment(ownerDocument, data){
146
+ if (!ownerDocument) {
147
+ ownerDocument = document;
148
+ }
149
+ if(supportsUnknownElements){
150
+ return ownerDocument.createDocumentFragment();
151
+ }
152
+ data = data || getExpandoData(ownerDocument);
153
+ var clone = data.frag.cloneNode(),
154
+ i = 0,
155
+ elems = getElements(),
156
+ l = elems.length;
157
+ for(;i<l;i++){
158
+ clone.createElement(elems[i]);
159
+ }
160
+ return clone;
161
+ }
162
+
163
+ /**
164
+ * Shivs the `createElement` and `createDocumentFragment` methods of the document.
165
+ * @private
166
+ * @param {Document|DocumentFragment} ownerDocument The document.
167
+ * @param {Object} data of the document.
168
+ */
169
+ function shivMethods(ownerDocument, data) {
170
+ if (!data.cache) {
171
+ data.cache = {};
172
+ data.createElem = ownerDocument.createElement;
173
+ data.createFrag = ownerDocument.createDocumentFragment;
174
+ data.frag = data.createFrag();
175
+ }
176
+
177
+
178
+ ownerDocument.createElement = function(nodeName) {
179
+ //abort shiv
180
+ if (!html5.shivMethods) {
181
+ return data.createElem(nodeName);
182
+ }
183
+ return createElement(nodeName, ownerDocument, data);
184
+ };
185
+
186
+ ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
187
+ 'var n=f.cloneNode(),c=n.createElement;' +
188
+ 'h.shivMethods&&(' +
189
+ // unroll the `createElement` calls
190
+ getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
191
+ data.createElem(nodeName);
192
+ data.frag.createElement(nodeName);
193
+ return 'c("' + nodeName + '")';
194
+ }) +
195
+ ');return n}'
196
+ )(html5, data.frag);
197
+ }
198
+
199
+ /*--------------------------------------------------------------------------*/
200
+
201
+ /**
202
+ * Shivs the given document.
203
+ * @memberOf html5
204
+ * @param {Document} ownerDocument The document to shiv.
205
+ * @returns {Document} The shived document.
206
+ */
207
+ function shivDocument(ownerDocument) {
208
+ if (!ownerDocument) {
209
+ ownerDocument = document;
210
+ }
211
+ var data = getExpandoData(ownerDocument);
212
+
213
+ if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
214
+ data.hasCSS = !!addStyleSheet(ownerDocument,
215
+ // corrects block display not defined in IE6/7/8/9
216
+ 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
217
+ // adds styling not present in IE6/7/8/9
218
+ 'mark{background:#FF0;color:#000}' +
219
+ // hides non-rendered elements
220
+ 'template{display:none}'
221
+ );
222
+ }
223
+ if (!supportsUnknownElements) {
224
+ shivMethods(ownerDocument, data);
225
+ }
226
+ return ownerDocument;
227
+ }
228
+
229
+ /*--------------------------------------------------------------------------*/
230
+
231
+ /**
232
+ * The `html5` object is exposed so that more elements can be shived and
233
+ * existing shiving can be detected on iframes.
234
+ * @type Object
235
+ * @example
236
+ *
237
+ * // options can be changed before the script is included
238
+ * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
239
+ */
240
+ var html5 = {
241
+
242
+ /**
243
+ * An array or space separated string of node names of the elements to shiv.
244
+ * @memberOf html5
245
+ * @type Array|String
246
+ */
247
+ 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
248
+
249
+ /**
250
+ * current version of html5shiv
251
+ */
252
+ 'version': version,
253
+
254
+ /**
255
+ * A flag to indicate that the HTML5 style sheet should be inserted.
256
+ * @memberOf html5
257
+ * @type Boolean
258
+ */
259
+ 'shivCSS': (options.shivCSS !== false),
260
+
261
+ /**
262
+ * Is equal to true if a browser supports creating unknown/HTML5 elements
263
+ * @memberOf html5
264
+ * @type boolean
265
+ */
266
+ 'supportsUnknownElements': supportsUnknownElements,
267
+
268
+ /**
269
+ * A flag to indicate that the document's `createElement` and `createDocumentFragment`
270
+ * methods should be overwritten.
271
+ * @memberOf html5
272
+ * @type Boolean
273
+ */
274
+ 'shivMethods': (options.shivMethods !== false),
275
+
276
+ /**
277
+ * A string to describe the type of `html5` object ("default" or "default print").
278
+ * @memberOf html5
279
+ * @type String
280
+ */
281
+ 'type': 'default',
282
+
283
+ // shivs the document according to the specified `html5` object options
284
+ 'shivDocument': shivDocument,
285
+
286
+ //creates a shived element
287
+ createElement: createElement,
288
+
289
+ //creates a shived documentFragment
290
+ createDocumentFragment: createDocumentFragment
291
+ };
292
+
293
+ /*--------------------------------------------------------------------------*/
294
+
295
+ // expose html5
296
+ window.html5 = html5;
297
+
298
+ // shiv the document
299
+ shivDocument(document);
300
+
301
+ }(this, document));