jekyll_patternbot 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/_includes/patternbot_pattern_brand_typeface.html +2 -2
  4. data/_includes/patternbot_pattern_class_list.html +30 -0
  5. data/_includes/patternbot_patternlib_pattern.html +5 -1
  6. data/_layouts/patternbot_pattern_lib.html +1 -1
  7. data/_patterns/grid/config.yml +8 -1
  8. data/_patterns/grid/utility-classes.html +1 -0
  9. data/_patterns/grid/utility-classes.yml +35 -0
  10. data/_patterns/icons/config.yml +26 -1
  11. data/_patterns/icons/icon-classes.html +1 -0
  12. data/_patterns/icons/icon-classes.yml +54 -0
  13. data/_patterns/icons/icon-sizes.html +8 -0
  14. data/_patterns/icons/icons-with-labels.html +6 -0
  15. data/_patterns/icons/icons.html +1 -1
  16. data/_patterns/modules/config.yml +35 -13
  17. data/_patterns/modules/images-embeds.html +28 -0
  18. data/_patterns/modules/media-objects.html +4 -7
  19. data/_patterns/modules/skip-links.html +1 -0
  20. data/_patterns/modules/utility-classes.html +29 -0
  21. data/_patterns/modules/utility-classes.yml +196 -0
  22. data/_patterns/typography/config.yml +6 -1
  23. data/_patterns/typography/utility-classes.html +1 -0
  24. data/_patterns/typography/utility-classes.yml +36 -0
  25. data/_patterns/typography/vertical-spacing.html +5 -5
  26. data/_patterns/utilities/classes.html +1 -20
  27. data/_plugins/jekyll_patternbot.rb +1 -0
  28. data/_plugins/jekyll_patternbot/config.rb +8 -0
  29. data/_plugins/jekyll_patternbot/hooks/pattern_lib.rb +9 -3
  30. data/_plugins/jekyll_patternbot/parsers/css_font.rb +5 -4
  31. data/_plugins/jekyll_patternbot/parsers/gridifier.rb +4 -0
  32. data/_plugins/jekyll_patternbot/parsers/icons.rb +7 -0
  33. data/_plugins/jekyll_patternbot/parsers/modulifier.rb +4 -0
  34. data/_plugins/jekyll_patternbot/parsers/typografier.rb +4 -0
  35. data/_plugins/jekyll_patternbot/parsers/web_dev_tool.rb +12 -0
  36. data/_plugins/jekyll_patternbot/processors/brand.rb +5 -5
  37. data/_plugins/jekyll_patternbot/processors/icons.rb +23 -0
  38. data/_plugins/jekyll_patternbot/processors/modules.rb +15 -15
  39. data/_plugins/jekyll_patternbot/processors/utilities.rb +5 -5
  40. data/assets/_patternbot/common/common.css +10 -0
  41. data/assets/_patternbot/common/common.min.css +1 -1
  42. data/assets/_patternbot/patterns/utilities/utilities.css +24 -0
  43. data/assets/_patternbot/patterns/utilities/utilities.min.css +1 -1
  44. data/version.rb +1 -1
  45. metadata +16 -4
  46. data/_patterns/modules/embed.html +0 -23
  47. data/_patterns/modules/list-groups.html +0 -21
@@ -0,0 +1,196 @@
1
+ # Direct copy from: https://learn-the-web.algonquindesign.ca/topics/modulifier-cheat-sheet/
2
+
3
+ images:
4
+ - class: '.img-flex'
5
+ description: 'Make images 100% the width of their container.'
6
+ - class: '.image-replacement'
7
+ description: 'A class (and a shorter version `.ir`) that will hide all the text inside an element and allow only the background-image to show.'
8
+ - class: '.embed'
9
+ description: 'The wrapper class for making responsive embedded resources like images and videos.'
10
+ - class: '.embed-item'
11
+ description: 'The class to be added directly to the embedded image or video.'
12
+
13
+ embed_sizes:
14
+ - class: '.embed-1by1'
15
+ description: 'Square.'
16
+ - class: '.embed-4by3'
17
+ description: 'Traditional TV/computer screens.'
18
+ - class: '.embed-iso216'
19
+ description: 'A-standard paper sizes.'
20
+ - class: '.embed-3by2'
21
+ description: 'Classic 35 mm film & most digital photos, landscape.'
22
+ - class: '.embed-2by3'
23
+ description: 'Classic 35 mm film & most digital photos, portrait.'
24
+ - class: '.embed-golden'
25
+ description: 'The Golden Ratio.'
26
+ - class: '.embed-16by9'
27
+ description: 'HDTV.'
28
+ - class: '.embed-185by100'
29
+ description: 'Common widescreen cinema.'
30
+ - class: '.embed-24by10'
31
+ description: 'Widescreen cinema: 2.4:1.'
32
+ - class: '.embed-3by1'
33
+ description: 'Panorama photos.'
34
+ - class: '.embed-4by1'
35
+ description: 'Polyvision.'
36
+ - class: '.embed-5by1'
37
+ description: 'Really, really wide…'
38
+
39
+ lists:
40
+ - class: '.list-group'
41
+ description: |
42
+ The `.list-group` class that will remove bullets and padding from lists, so semantically they can be lists but no visually.
43
+
44
+ When added to a `<dl>` tag, there is a little responsiveness to how the `<dt>` and `<dd>` tags flow.
45
+ - class: '.list-group-inline'
46
+ description: |
47
+ The `.list-group-inline` class that will force the `<li>` tags onto the same line.
48
+
49
+ When added to the `<dl>` tag, the `<dt>` and `<dd>` tags will sit on the same line if there is enough space.
50
+
51
+ media_objects:
52
+ - class: '.media'
53
+ description: 'A wrapper class to surround image & text groups, especially if the images is to be beside the text.'
54
+ - class: '.media-img'
55
+ description: 'A class for adding to the image, or surrounding `<div>`, within the media object.'
56
+ - class: '.media-body'
57
+ description: 'A class to add to the text, or surrounding `<div>`, within the media object.'
58
+ - class: '.media-img-reversed'
59
+ description: 'Instead of floating the image left it will float: right'
60
+ - class: '.media-img-stacked'
61
+ description: 'Will disable floating and have the image above the text instead.'
62
+
63
+ skip_links:
64
+ - class: '.skip-links'
65
+ description: 'Adds all the CSS necessary for creating basic skip links.'
66
+
67
+ hidden:
68
+ - class: '.hidden'
69
+ description: 'Makes sure the hidden attribute works in all browsers and provides a .hidden class.'
70
+ - class: '.visually-hidden'
71
+ description: 'A class that will hide something from the visual screen but still allow it to be accessible via tools.'
72
+ - class: '.focusable'
73
+ description: 'To be added to the .visually-hidden class to allow the keyboard to access the element.'
74
+ - class: '.invisible'
75
+ description: 'A class that will hide an element on the screen, but its space will still be there.'
76
+ - class: '.crop'
77
+ description: 'These classes that will chop/crop overflowing elements off—essentially just overflow: hidden'
78
+ - class: '.truncate'
79
+ description: 'A class that will chop single lines of text off and add an ellipsis at the end.'
80
+ - class: '.scrollable'
81
+ description: 'A class that make an element horizontally scrollable, good for simple responsive tables.'
82
+
83
+ positioning:
84
+ - class: '.clearfix'
85
+ description: 'A class that can be used on floating wrappers to trigger a clear fix.'
86
+ - classes:
87
+ - '.left'
88
+ - '.right'
89
+ description: 'Will float the element to the left or the right.'
90
+ - classes:
91
+ - '.inline'
92
+ - '.inline-block'
93
+ - '.ib'
94
+ - '.block'
95
+ description: 'Classes to control the display property between inline, inline-block, and block.'
96
+ - classes:
97
+ - '.valign-top'
98
+ - '.valign-middle'
99
+ - '.valign-bottom'
100
+ description: 'These classes allow you to control the vertical-align property on inline and inline-block elements or within tables.'
101
+ - classes:
102
+ - '.fixed'
103
+ - '.relative'
104
+ - '.absolute'
105
+ - '.static'
106
+ description: 'Classes to control the position property of an element.'
107
+ - classes:
108
+ - '.zindex-1'
109
+ - '.zindex-2'
110
+ - '.zindex-3'
111
+ - '.zindex-1000'
112
+ description: 'Classes to control three basic z-index states on an element.'
113
+ - classes:
114
+ - '.pin-left-top'
115
+ - '.pin-right-top'
116
+ - '.pin-left-bottom'
117
+ - '.pin-right-bottom'
118
+ - '.pin-center-top'
119
+ - '.pin-center-bottom'
120
+ - '.pin-left-center'
121
+ - '.pin-right-center'
122
+ - '.pin-center'
123
+ description: |
124
+ A series of classes for moving a position: absolute element to different common locations.
125
+
126
+ The `.pin-*` classes will automatically add position: absolute so adding the class .absolute also isn’t necessary.
127
+
128
+ Simplified versions are available: `.pin-lt`, `.pin-rt`, `pin-lb`, `.pin-rb`, `.pin-ct`, `.pin-cb`, `.pin-lc`, `.pin-rc`, `.pin-c`
129
+ - classes:
130
+ - '.width-quarter'
131
+ - '.width-half'
132
+ - '.width-full'
133
+ description: |
134
+ A series of classes for setting common widths.
135
+
136
+ Simplified versions are available: `.w-1-4`, `.w-1-2`, `.w-1`
137
+ - classes:
138
+ - '.height-quarter'
139
+ - '.height-half'
140
+ - '.height-full'
141
+ description: |
142
+ A series of classes for setting common heights—usually only useful the context of `position: absolute`.
143
+
144
+ Simplified versions are available: `.h-1-4`, `.h-1-2`, `.h-1`
145
+ - classes:
146
+ - '.height-win-quarter'
147
+ - '.height-win-half'
148
+ - '.height-win-full'
149
+ description: |
150
+ A series of classes for setting elements to have a minimum height compared to the window size.
151
+
152
+ Simplified versions are available: `.h-w-1-4`, `.h-w-1-2`, `.h-w-1`
153
+ - class: '.center-flow'
154
+ description: 'Centres inline, inline-block & text elements—essentially just adds text-align: center'
155
+ - class: '.center-block'
156
+ description: 'Centres block-level elements, but they need widths—essentially adds: margin-left: auto; margin-right: auto'
157
+ - classes:
158
+ - '.center-content'
159
+ - '.center-content-vertical'
160
+ description: 'Centres all the contents of a box within, both vertically & horizontally centered.'
161
+ - class: '.center-content-horizontal'
162
+ description: 'Centres all the contents of a box within, both vertically & horizontally centered.'
163
+
164
+ buttons:
165
+ - class: '.btn'
166
+ description: 'A very basic button style for prototyping websites.'
167
+ - class: '.btn-light'
168
+ description: 'An alternative button style for prototyping websites.'
169
+ - class: '.btn-ghost'
170
+ description: 'A third button style for prototyping websites.'
171
+ - class: '.link-box'
172
+ description: 'For adding to `<a>` tags to remove their underlines and make them block.'
173
+
174
+ forms:
175
+ - class: '.label-block'
176
+ description: 'A class to force a `<label>` onto its own line.'
177
+ - class: '.label-inline'
178
+ description: 'A class to force a `<label>` onto the same line as other inputs.'
179
+ - class: '.hide-custom-input'
180
+ description: 'This class can be added to a checkbox or radio button `<input>` or `<label>` to hide the custom control.'
181
+
182
+ print:
183
+ - class: '.no-print'
184
+ description: 'Will hide the element when a user prints out the website.'
185
+ - class: '.no-print-href'
186
+ description: 'Will stop the href printing out beside a link when printed.'
187
+ - class: '.print-only'
188
+ description: 'Will hide an element by default but then display it when the website is printed.'
189
+ - class: '.force-print'
190
+ description: 'Will attempt to force something to be printed even if there’s JavaScript or some other CSS that tries to hide it.'
191
+ - class: '.page-break-before'
192
+ description: 'Will force a page-break before this content when printed.'
193
+ - class: '.page-break-after'
194
+ description: 'Will force a page-break after this content when printed.'
195
+ - class: '.no-page-break-inside'
196
+ description: 'Will attempt to prevent the content from being broken over multiple pages when printed.'
@@ -2,10 +2,11 @@ _layout: "patternbot_pattern_internal"
2
2
  _user_typografier: true
3
3
  _extra_css:
4
4
  - 'typography/typography.min.css'
5
+ - 'utilities/utilities.min.css'
5
6
 
6
7
  title: "Typography"
7
8
  description: |
8
- The modular typography uses a system generated by [Typografier](++typografier-settings-url++). There are multiple sizes and spacing classes available—all based on the font-size and line-height to create a harmonious vertical rhythm. [See the documentation for all available classes.](https://learn-the-web.algonquindesign.ca/topics/typografier-cheat-sheet/)
9
+ The modular typography uses a system generated by [Typografier](++typografier-settings-url++). There are multiple sizes and spacing classes available—all based on the font-size and line-height to create a harmonious vertical rhythm.
9
10
 
10
11
  patterns:
11
12
  size-adjustments:
@@ -53,3 +54,7 @@ patterns:
53
54
  typesetting:
54
55
  title: "Typesetting"
55
56
  _code: false
57
+ utility-classes:
58
+ _popout_button: false
59
+ _resizable: false
60
+ _code: false
@@ -0,0 +1 @@
1
+ {% include patternbot_pattern_class_list.html classes=page._PatternbotData.css.typografier.utility_classes %}
@@ -0,0 +1,36 @@
1
+ # Direct copy from: https://learn-the-web.algonquindesign.ca/topics/typografier-cheat-sheet/
2
+
3
+ - classes:
4
+ - '.island-2'
5
+ - '.island'
6
+ - '.island-1-2'
7
+ - '.island-1-4'
8
+ - '.island-1-8'
9
+ description: 'Add padding around all four sides of the box using divisions of the line-height for measurement.'
10
+ - classes:
11
+ - '.text-left'
12
+ - '.text-right'
13
+ - '.text-center'
14
+ description: 'Text alignment classes.'
15
+ - classes:
16
+ - '.bold'
17
+ - '.not-bold'
18
+ description: 'Font weight classes. There’s also `.normal` as a variation to `.not-bold`'
19
+ - classes:
20
+ - '.italic'
21
+ - '.not-italic'
22
+ description: 'Font style classes.'
23
+ - classes:
24
+ - '.text-upper'
25
+ - '.text-lower'
26
+ description: 'Font capitalization classes: all uppercase & all lowercase.'
27
+ - class: '.hang-punc'
28
+ description: 'Add to an element at the beginning of a line to make the character hang in the margin.'
29
+ - class: '.wrapper'
30
+ description: 'Sets the max-width of an element to 52em—which is a fairly good line-length for a website body.'
31
+ - class: '.wrapper-no-center'
32
+ description: 'Same as wrapper but doesn’t auto center.'
33
+ - class: '.max-length'
34
+ description: 'Sets the max-width of an element to 36em—which is a fairly good line-length for text content.'
35
+ - class: '.max-length-no-center'
36
+ description: 'Same as max-length but doesn’t auto center.'
@@ -21,35 +21,35 @@
21
21
  <h2 class="push-0">2</h2>
22
22
  <ul class="patternbot-code-details patternbot-code-details-under patternbot-code-details-center list-group-inline micro push-0 patternbot-vertical-spacing-classes">
23
23
  <li><code>.push-2</code></li>
24
- <li><code>.pad-2</code></li>
24
+ <li><code>.pad-t-2</code></li>
25
25
  </ul>
26
26
  </div>
27
27
  <div class="unit [ xs-1-5 ]">
28
28
  <h2 class="push-0">1</h2>
29
29
  <ul class="patternbot-code-details patternbot-code-details-under patternbot-code-details-center list-group-inline micro push-0 patternbot-vertical-spacing-classes">
30
30
  <li><code>.push</code></li>
31
- <li><code>.pad</code></li>
31
+ <li><code>.pad-b</code></li>
32
32
  </ul>
33
33
  </div>
34
34
  <div class="unit [ xs-1-5 ]">
35
35
  <h2 class="push-0">½</h2>
36
36
  <ul class="patternbot-code-details patternbot-code-details-under patternbot-code-details-center list-group-inline micro push-0 patternbot-vertical-spacing-classes">
37
37
  <li><code>.push-1-2</code></li>
38
- <li><code>.pad-1-2</code></li>
38
+ <li><code>.pad-t-1-2</code></li>
39
39
  </ul>
40
40
  </div>
41
41
  <div class="unit [ xs-1-5 ]">
42
42
  <h2 class="push-0">¼</h2>
43
43
  <ul class="patternbot-code-details patternbot-code-details-under patternbot-code-details-center list-group-inline micro push-0 patternbot-vertical-spacing-classes">
44
44
  <li><code>.push-1-4</code></li>
45
- <li><code>.pad-1-4</code></li>
45
+ <li><code>.pad-b-1-4</code></li>
46
46
  </ul>
47
47
  </div>
48
48
  <div class="unit [ xs-1-5 ]">
49
49
  <h2 class="push-0">⅛</h2>
50
50
  <ul class="patternbot-code-details patternbot-code-details-under patternbot-code-details-center list-group-inline micro push-0 patternbot-vertical-spacing-classes">
51
51
  <li><code>.push-1-8</code></li>
52
- <li><code>.pad-1-8</code></li>
52
+ <li><code>.pad-t-1-8</code></li>
53
53
  </ul>
54
54
  </div>
55
55
  </div>
@@ -1,20 +1 @@
1
- <div class="patternbot-font-primary text-left milli">
2
- <div class="pattern-utilities-scrollable scrollable">
3
- <table class="patternbot-utilities-table">
4
- <thead>
5
- <tr>
6
- <th scope="col" colspan="6">Class</th>
7
- <th scope="col" colspan="18">Description</th>
8
- </tr>
9
- </thead>
10
- <tbody>
11
- {% for util in page._PatternbotData.css.theme.utilities %}
12
- <tr>
13
- <th class="valign-middle" scope="row" colspan="6"><code class="ib valign-middle">{{util.class | escape}}</code></th>
14
- <td class="valign-middle" scope="col" colspan="18"><span class="ib valign-middle">{{util.description | escape}}</span></td>
15
- </tr>
16
- {% endfor %}
17
- </tbody>
18
- </table>
19
- </div>
20
- </div>
1
+ {% include patternbot_pattern_class_list.html classes=page._PatternbotData.css.theme.utilities %}
@@ -40,6 +40,7 @@ module JekyllPatternbot
40
40
 
41
41
  require 'jekyll_patternbot/processors/brand'
42
42
  require 'jekyll_patternbot/processors/modules'
43
+ require 'jekyll_patternbot/processors/icons'
43
44
  require 'jekyll_patternbot/processors/utilities'
44
45
 
45
46
  require 'jekyll_patternbot/hooks/pattern_lib'
@@ -6,6 +6,14 @@ module JekyllPatternbot
6
6
  class << self; attr_accessor :PatternbotData; end
7
7
 
8
8
  Jekyll::Hooks.register :site, :after_init do |site|
9
+ unless site.config.key? 'theme' and site.config['theme'] == 'jekyll_patternbot'
10
+ raise 'Specify “theme: jekyll_patternbot” inside your Jekyll `_config.yml` file.'
11
+ end
12
+
13
+ unless site.config.key? 'patternbot' and site.config['patternbot'].is_a?(Hash)
14
+ site.config['patternbot'] = {}
15
+ end
16
+
9
17
  Config.deep_merge! site.config
10
18
  Config['patternbot'][:version] = JekyllPatternbot::VERSION
11
19
 
@@ -5,7 +5,10 @@ module JekyllPatternbot
5
5
  :css => {},
6
6
  :js => {},
7
7
  :logos => {},
8
- :icons => [],
8
+ :icons => {
9
+ :spritesheets => [],
10
+ :classes => [],
11
+ },
9
12
  :layouts => [],
10
13
  :patterns => {},
11
14
  :pages => [],
@@ -34,9 +37,11 @@ module JekyllPatternbot
34
37
  icon_files = IconsFinder.new(Config['patternbot']['icons'])
35
38
  if icon_files.exists?
36
39
  icons = IconsParser.new(Config['patternbot']['icons'], icon_files.info)
37
- PatternbotData[:icons] = icons.info
40
+ PatternbotData[:icons][:spritesheets] = icons.info
41
+ PatternbotData[:icons][:classes] = icons.classes
38
42
  else
39
- PatternbotData[:icons] = []
43
+ PatternbotData[:icons][:spritesheets] = []
44
+ PatternbotData[:icons][:classes] = []
40
45
  end
41
46
 
42
47
  if File.exists? File.expand_path(Config['patternbot']['css']['main'], Config['patternbot']['css']['source'])
@@ -65,6 +70,7 @@ module JekyllPatternbot
65
70
 
66
71
  brand_processor = BrandProcessor.new.process
67
72
  modules_processor = ModulesProcessor.new.process
73
+ icons_processor = IconsProcessor.new.process
68
74
  utilities_processor = UtilitiesProcessor.new.process
69
75
 
70
76
  # File.open('/Users/thomasjbradley/Desktop/patternbot.json', 'w') do |f|
@@ -63,13 +63,14 @@ module JekyllPatternbot
63
63
  weights['normal'][:css_name] = font[:css_name]
64
64
  weights['normal'][:has_normal] = true
65
65
  weights['normal'][:has_italic] = true
66
+ weights['bold'][:weight] = 'bold'
66
67
  weights['bold'][:css_name] = font[:css_name]
67
68
  weights['bold'][:has_normal] = true
68
69
  weights
69
70
  end
70
71
 
71
72
  def self.parse_font_file(font_url)
72
- if font_url
73
+ if font_url and not font_url.strip.empty?
73
74
  parser = CssParser::Parser.new
74
75
  parser.load_uri!(font_url)
75
76
  font_face_rulesets = parser.find_by_selector('@font-face').map { |rules| CssParser::RuleSet.new(nil, rules) }
@@ -110,9 +111,7 @@ module JekyllPatternbot
110
111
  end
111
112
 
112
113
  def self.parse(font_url, data)
113
- unless font_url
114
- return self.parse_fonts data
115
- else
114
+ if font_url and not font_url.strip.empty?
116
115
  unless PatternbotCache.key?(font_url)
117
116
  PatternbotCache[font_url] = self.parse_font_file(font_url)
118
117
  PatternbotLogger.warn("Patternbot downloaded CSS for fonts from the remote URL: #{font_url}")
@@ -120,6 +119,8 @@ module JekyllPatternbot
120
119
  PatternbotLogger.info("Patternbot used a cached version of the font CSS originally located at: #{font_url}")
121
120
  end
122
121
  return self.parse_fonts data, PatternbotCache[font_url]
122
+ else
123
+ return self.parse_fonts data
123
124
  end
124
125
  end
125
126
 
@@ -18,5 +18,9 @@ module JekyllPatternbot
18
18
  grid_settings
19
19
  end
20
20
 
21
+ def utility_classes
22
+ WebDevToolParser.utility_classes_for_tool('grid')
23
+ end
24
+
21
25
  end
22
26
  end
@@ -15,6 +15,13 @@ module JekyllPatternbot
15
15
  matches.flatten
16
16
  end
17
17
 
18
+ def classes
19
+ internal_source = File.expand_path "../../../_patterns/icons/icon-classes.yml", __dir__
20
+ return [] unless File.file? internal_source
21
+ icon_classes = YAML.load_file internal_source
22
+ icon_classes
23
+ end
24
+
18
25
  def info
19
26
  for file in @icon_files
20
27
  data = File.read filepath file[:filename]
@@ -6,5 +6,9 @@ module JekyllPatternbot
6
6
  url_info.split(/\;/) if url_info
7
7
  end
8
8
 
9
+ def utility_classes
10
+ WebDevToolParser.utility_classes_for_tool('modules')
11
+ end
12
+
9
13
  end
10
14
  end