docks_theme_api 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (237) hide show
  1. checksums.yaml +15 -0
  2. data/.babelrc +4 -0
  3. data/.editorconfig +8 -0
  4. data/.eslintrc +115 -0
  5. data/.gitignore +24 -0
  6. data/.rubocop.yml +20 -0
  7. data/.travis.yml +16 -0
  8. data/Gemfile +4 -0
  9. data/README.md +5 -0
  10. data/Rakefile +3 -0
  11. data/assets/images/icons.svg +63 -0
  12. data/assets/scripts/coffeescript/pattern_library_helpers.coffee +8 -0
  13. data/assets/scripts/javascript/pattern_library_helpers.js +11 -0
  14. data/assets/scripts/pattern_library.js +10380 -0
  15. data/assets/scripts/pattern_library_demo.js +0 -0
  16. data/assets/styles/less/pattern-library-helpers.less +103 -0
  17. data/assets/styles/pattern-library-demo.css +1882 -0
  18. data/assets/styles/pattern-library.css +1882 -0
  19. data/assets/styles/sass/pattern-library-helpers.sass +90 -0
  20. data/assets/styles/scss/pattern-library-helpers.scss +99 -0
  21. data/assets/styles/stylus/pattern-library-helpers.styl +90 -0
  22. data/assets/templates/erb/demo.erb +26 -0
  23. data/assets/templates/erb/layouts/demo.erb +17 -0
  24. data/assets/templates/erb/layouts/pattern.erb +76 -0
  25. data/assets/templates/erb/partials/sidebar.erb +124 -0
  26. data/assets/templates/erb/partials/symbols/class.erb +1 -0
  27. data/assets/templates/erb/partials/symbols/demo.erb +40 -0
  28. data/assets/templates/erb/partials/symbols/factory.erb +70 -0
  29. data/assets/templates/erb/partials/symbols/function.erb +103 -0
  30. data/assets/templates/erb/partials/symbols/mixin.erb +62 -0
  31. data/assets/templates/erb/partials/symbols/variable.erb +59 -0
  32. data/assets/templates/erb/pattern.erb +102 -0
  33. data/assets/templates/haml/demo.haml +14 -0
  34. data/assets/templates/haml/layouts/demo.haml +6 -0
  35. data/assets/templates/haml/layouts/pattern.haml +38 -0
  36. data/assets/templates/haml/partials/sidebar.haml +68 -0
  37. data/assets/templates/haml/partials/symbols/class.haml +1 -0
  38. data/assets/templates/haml/partials/symbols/demo.haml +23 -0
  39. data/assets/templates/haml/partials/symbols/factory.haml +38 -0
  40. data/assets/templates/haml/partials/symbols/function.haml +54 -0
  41. data/assets/templates/haml/partials/symbols/mixin.haml +31 -0
  42. data/assets/templates/haml/partials/symbols/variable.haml +22 -0
  43. data/assets/templates/haml/pattern.haml +54 -0
  44. data/assets/templates/slim/demo.slim +24 -0
  45. data/assets/templates/slim/layouts/demo.slim +5 -0
  46. data/assets/templates/slim/layouts/pattern.slim +48 -0
  47. data/assets/templates/slim/partials/sidebar.slim +112 -0
  48. data/assets/templates/slim/partials/symbols/class.slim +1 -0
  49. data/assets/templates/slim/partials/symbols/demo.slim +30 -0
  50. data/assets/templates/slim/partials/symbols/factory.slim +57 -0
  51. data/assets/templates/slim/partials/symbols/function.slim +81 -0
  52. data/assets/templates/slim/partials/symbols/mixin.slim +45 -0
  53. data/assets/templates/slim/partials/symbols/variable.slim +35 -0
  54. data/assets/templates/slim/pattern.slim +63 -0
  55. data/docks_config.rb +32 -0
  56. data/docks_theme_api.gemspec +37 -0
  57. data/gulpfile.js +88 -0
  58. data/karma.conf.js +6 -0
  59. data/lib/docks_theme_api/components/base_component.rb +99 -0
  60. data/lib/docks_theme_api/components/code_block_component.rb +10 -0
  61. data/lib/docks_theme_api/components/popover_component.rb +15 -0
  62. data/lib/docks_theme_api/components/table_component.rb +34 -0
  63. data/lib/docks_theme_api/components/tablist_component.rb +11 -0
  64. data/lib/docks_theme_api/components.rb +21 -0
  65. data/lib/docks_theme_api/helpers/ui_helper.rb +69 -0
  66. data/lib/docks_theme_api/theme.rb +21 -0
  67. data/lib/docks_theme_api.rb +1 -0
  68. data/package.json +60 -0
  69. data/source/behaviors/filterable/filterable.coffee +353 -0
  70. data/source/behaviors/filterable/filterable.js +0 -0
  71. data/source/behaviors/filterable/filterable.scss +34 -0
  72. data/source/behaviors/filterable/package.json +3 -0
  73. data/source/behaviors/index.js +0 -0
  74. data/source/components/avatar/avatar.erb +20 -0
  75. data/source/components/avatar/avatar.js +142 -0
  76. data/source/components/avatar/avatar.scss +200 -0
  77. data/source/components/avatar/avatar_container.erb +13 -0
  78. data/source/components/avatar/package.json +3 -0
  79. data/source/components/avatar/spec/avatar_spec.js +81 -0
  80. data/source/components/badge/badge.scss +158 -0
  81. data/source/components/button/button.scss +213 -0
  82. data/source/components/card/card.scss +32 -0
  83. data/source/components/code_block/code-block.scss +353 -0
  84. data/source/components/code_block/code_block.erb +95 -0
  85. data/source/components/code_block/code_block.js +444 -0
  86. data/source/components/code_block/package.json +3 -0
  87. data/source/components/code_block/spec/code_block_spec.js +10 -0
  88. data/source/components/demo/demo.js +244 -0
  89. data/source/components/demo/demo.scss +90 -0
  90. data/source/components/demo/package.json +3 -0
  91. data/source/components/exploded/exploded.erb +25 -0
  92. data/source/components/exploded/exploded.js +694 -0
  93. data/source/components/exploded/exploded.scss +166 -0
  94. data/source/components/exploded/package.json +3 -0
  95. data/source/components/field/field.js +24 -0
  96. data/source/components/field/field.scss +101 -0
  97. data/source/components/field/package.json +3 -0
  98. data/source/components/header/header.scss +33 -0
  99. data/source/components/iframe/iframe.erb +12 -0
  100. data/source/components/iframe/iframe.js +381 -0
  101. data/source/components/iframe/package.json +3 -0
  102. data/source/components/index.js +37 -0
  103. data/source/components/inline_group/inline-group.scss +14 -0
  104. data/source/components/internal_link/internal_link.js +49 -0
  105. data/source/components/internal_link/package.json +3 -0
  106. data/source/components/list/list.scss +230 -0
  107. data/source/components/modal/modal.coffee +84 -0
  108. data/source/components/modal/modal.erb +19 -0
  109. data/source/components/modal/modal.js +0 -0
  110. data/source/components/modal/modal.scss +57 -0
  111. data/source/components/modal/package.json +3 -0
  112. data/source/components/notice/notice.scss +48 -0
  113. data/source/components/popover/package.json +3 -0
  114. data/source/components/popover/popover.coffee +562 -0
  115. data/source/components/popover/popover.erb +21 -0
  116. data/source/components/popover/popover.js +0 -0
  117. data/source/components/popover/popover.scss +139 -0
  118. data/source/components/range/range.scss +78 -0
  119. data/source/components/resizable/package.json +3 -0
  120. data/source/components/resizable/resizable.erb +30 -0
  121. data/source/components/resizable/resizable.js +250 -0
  122. data/source/components/resizable/resizable.scss +245 -0
  123. data/source/components/resizable/size_buttons.js +249 -0
  124. data/source/components/scroll_container/package.json +3 -0
  125. data/source/components/scroll_container/scroll-container.scss +4 -0
  126. data/source/components/scroll_container/scroll_container.js +24 -0
  127. data/source/components/section/section.scss +99 -0
  128. data/source/components/select/package.json +3 -0
  129. data/source/components/select/select.erb +21 -0
  130. data/source/components/select/select.js +35 -0
  131. data/source/components/select/select.scss +163 -0
  132. data/source/components/table/package.json +3 -0
  133. data/source/components/table/table.erb +16 -0
  134. data/source/components/table/table.js +351 -0
  135. data/source/components/table/table.scss +236 -0
  136. data/source/components/tablist/package.json +3 -0
  137. data/source/components/tablist/tablist.erb +13 -0
  138. data/source/components/tablist/tablist.js +246 -0
  139. data/source/components/tablist/tablist.scss +191 -0
  140. data/source/components/tablist/tablist_panel.erb +14 -0
  141. data/source/components/tablist/tablist_tab.erb +20 -0
  142. data/source/components/toggle/package.json +3 -0
  143. data/source/components/toggle/toggle.erb +11 -0
  144. data/source/components/toggle/toggle.js +211 -0
  145. data/source/components/toggle/toggle_container.erb +30 -0
  146. data/source/components/vertical_spacer/vertical-spacer.scss +3 -0
  147. data/source/components/vertical_stack/vertical-stack.scss +19 -0
  148. data/source/components/xray/package.json +3 -0
  149. data/source/components/xray/xray.erb +50 -0
  150. data/source/components/xray/xray.js +123 -0
  151. data/source/components/xray/xray.scss +79 -0
  152. data/source/foundation/app/app.js +15 -0
  153. data/source/foundation/app/package.json +3 -0
  154. data/source/pattern-library-demo.scss +13 -0
  155. data/source/pattern-library.scss +13 -0
  156. data/source/pattern_library.js +8 -0
  157. data/source/pattern_library_demo.js +8 -0
  158. data/source/structures/index.js +11 -0
  159. data/source/structures/sidebar/package.json +3 -0
  160. data/source/structures/sidebar/sidebar.js +69 -0
  161. data/source/structures/sidebar/sidebar.scss +79 -0
  162. data/source/utilities/builder/builder.js +138 -0
  163. data/source/utilities/builder/package.json +3 -0
  164. data/source/utilities/client/client.js +7 -0
  165. data/source/utilities/client/package.json +3 -0
  166. data/source/utilities/colors/colors.scss +112 -0
  167. data/source/utilities/defaults/defaults.scss +38 -0
  168. data/source/utilities/dom_cache/dom_cache.js +24 -0
  169. data/source/utilities/dom_cache/package.json +3 -0
  170. data/source/utilities/events/events.js +25 -0
  171. data/source/utilities/events/package.json +3 -0
  172. data/source/utilities/font_sizes/font-sizes.scss +85 -0
  173. data/source/utilities/foundation/a11y.scss +10 -0
  174. data/source/utilities/foundation/base.scss +29 -0
  175. data/source/utilities/foundation/icon.scss +114 -0
  176. data/source/utilities/foundation/layout.scss +67 -0
  177. data/source/utilities/foundation/page.scss +39 -0
  178. data/source/utilities/foundation/type.scss +208 -0
  179. data/source/utilities/functions/functions.scss +127 -0
  180. data/source/utilities/keycodes/keycodes.js +23 -0
  181. data/source/utilities/keycodes/package.json +3 -0
  182. data/source/utilities/markup/markup.js +90 -0
  183. data/source/utilities/markup/package.json +3 -0
  184. data/source/utilities/media/media.scss +172 -0
  185. data/source/utilities/mixins/mixins.scss +89 -0
  186. data/source/utilities/naming_convention/naming_convention.js +3 -0
  187. data/source/utilities/naming_convention/package.json +3 -0
  188. data/source/utilities/numbers/numbers.js +14 -0
  189. data/source/utilities/numbers/package.json +3 -0
  190. data/source/utilities/painting/package.json +3 -0
  191. data/source/utilities/painting/painting.js +7 -0
  192. data/source/utilities/pattern/package.json +3 -0
  193. data/source/utilities/pattern/pattern.js +50 -0
  194. data/source/utilities/query_string/package.json +3 -0
  195. data/source/utilities/query_string/query_string.js +24 -0
  196. data/source/utilities/template/package.json +3 -0
  197. data/source/utilities/template/template.js +10 -0
  198. data/source/utilities/text_range/package.json +3 -0
  199. data/source/utilities/text_range/text_range.js +30 -0
  200. data/source/utilities/ui_events/package.json +3 -0
  201. data/source/utilities/ui_events/ui_events.js +85 -0
  202. data/source/utilities/variables/variables.scss +18 -0
  203. data/source/utilities/z_indexes/z-indexes.scss +88 -0
  204. data/source/vendor/array_includes.js +28 -0
  205. data/source/vendor/highlight.js +1142 -0
  206. data/source/vendor/index.js +1 -0
  207. data/source/vendor/matrix.js +399 -0
  208. data/source/vendor/query_string.js +66 -0
  209. data/spec/assets/.eslintrc +9 -0
  210. data/spec/assets/spec_fixture.js +33 -0
  211. data/spec/assets/spec_helper.js +19 -0
  212. data/spec/lib/components/base_component_spec.rb +156 -0
  213. data/spec/lib/components_spec.rb +30 -0
  214. data/spec/lib/helpers/ui_helper_spec.rb +62 -0
  215. data/spec/lib/theme_spec.rb +25 -0
  216. data/spec/spec_helper.rb +15 -0
  217. data/tasks/gulp/.eslintrc +6 -0
  218. data/tasks/gulp/browser_sync.js +8 -0
  219. data/tasks/gulp/code_quality/scripts.js +10 -0
  220. data/tasks/gulp/config/index.js +116 -0
  221. data/tasks/gulp/minify/scripts.js +13 -0
  222. data/tasks/gulp/minify/styles.js +13 -0
  223. data/tasks/gulp/pattern_library/index.js +5 -0
  224. data/tasks/gulp/pattern_library/scripts.js +10 -0
  225. data/tasks/gulp/pattern_library/styles.js +10 -0
  226. data/tasks/gulp/scripts.js +8 -0
  227. data/tasks/gulp/spec/scripts.js +11 -0
  228. data/tasks/gulp/styles.js +17 -0
  229. data/tasks/gulp/utilities/babel/relative_require.js +22 -0
  230. data/tasks/gulp/utilities/babel/spec_helper.js +20 -0
  231. data/tasks/gulp/utilities/browserify_bundler.js +22 -0
  232. data/tasks/gulp/utilities/handle_errors.js +13 -0
  233. data/tasks/gulp/watch.js +9 -0
  234. data/tasks/rake/rspec.rake +7 -0
  235. data/tasks/rake/rubocop.rake +8 -0
  236. data/tasks/rake/templates.rake +50 -0
  237. metadata +470 -0
@@ -0,0 +1,54 @@
1
+ .content
2
+ - if deprecation = @pattern.deprecated
3
+ .notice
4
+ %h3.type.type--heading.type--heading-3
5
+ Deprecated as of
6
+ %strong= deprecation.version
7
+ .type-container= deprecation.description
8
+ %pre
9
+ %pre
10
+ - if description = @pattern.description
11
+ .type-container
12
+ = description
13
+ - if @pattern.has_structure? && @pattern.has_behavior?
14
+ - docks_tablist(size: :large, manage_url?: true) do |tablist|
15
+ = tablist.tab(text: "Structure", active?: true, id: "page__content__tab--markup", panel_id: "page__content--markup", icon: :code)
16
+ = tablist.tab(text: "Behavior", id: "page__content__tab--behavior", panel_id: "page__content--behavior", icon: :script)
17
+ .tablist__panel-container
18
+ - docks_component("tablist:panel", active?: true, id: "page__content--markup", tab_id: "page__content__tab--markup") do
19
+ #symbols--structure{"data-filter-items" => ".section"}
20
+ - @pattern.demos.each do |demo|
21
+ = render partial: "symbols/demo", locals: { demo: demo }
22
+ - unless (variables = @pattern.variables(exclude: :script)).empty?
23
+ .content.content--extra-vertical-spacing
24
+ %h2.type.type--heading.type--heading-2.type--heading-bordered Variables
25
+ - variables.each do |variable|
26
+ = render partial: "symbols/variable", locals: { variable: variable }
27
+ - unless (functions = @pattern.functions(exclude: :script)).empty?
28
+ .content.content--extra-vertical-spacing
29
+ %h2.type.type--heading.type--heading-2.type--heading-bordered Functions
30
+ - functions.each_with_index do |func, index|
31
+ = render partial: "symbols/function", locals: { function: func }
32
+ - unless (mixins = @pattern.mixins(exclude: :script)).empty?
33
+ .content.content--extra-vertical-spacing
34
+ %h2.type.type--heading.type--heading-2.type--heading-bordered Mixins
35
+ - mixins.each do |mixin|
36
+ = render partial: "symbols/mixin", locals: { mixin: mixin }
37
+ - docks_component("tablist:panel", id: "page__content--behavior", tab_id: "page__content__tab--behavior") do
38
+ #symbols--behavior{"data-filter-items" => ".section"}
39
+ - unless (factories = @pattern.factories(include: :script)).empty?
40
+ - factories.each do |factory|
41
+ = render partial: "symbols/factory", locals: { factory: factory }
42
+ - unless (classes = @pattern.classes(include: :script)).empty?
43
+ - classes.each do |klass|
44
+ = render partial: "symbols/class", locals: { klass: klass }
45
+ - unless (variables = @pattern.variables(include: :script)).empty?
46
+ .content.content--extra-vertical-spacing
47
+ %h2.type.type--heading.type--heading-2.type--heading-bordered Variables
48
+ - variables.each do |variable|
49
+ = render partial: "symbols/variable", locals: { variable: variable }
50
+ - unless (functions = @pattern.functions(include: :script)).empty?
51
+ .content.content--extra-vertical-spacing
52
+ %h2.type.type--heading.type--heading-2.type--heading-bordered Functions
53
+ - functions.each do |func|
54
+ = render partial: "symbols/function", locals: { function: func }
@@ -0,0 +1,24 @@
1
+ | <div class="iframe" data-iframe-id="
2
+ = id
3
+ | "> <div class="demo" data-iframe-id="
4
+ = id
5
+ | ">
6
+ - if demo.kind_of?(Docks::Containers::Demo)
7
+ - demo_variations = [demo.component] + demo.joint_variations
8
+ - demo_variations.each do |variation|
9
+ - name = variation.name
10
+ | <section class="demo__section" data-name="
11
+ = name
12
+ | " id="demo__section--
13
+ = name
14
+ | ">
15
+ - unless demo_variations.length == 1
16
+ header.demo__header
17
+ h2.badge.badge--code
18
+ = name
19
+ .content
20
+ = variation.markup
21
+ - else
22
+ section.demo__section
23
+ .content
24
+ = demo
@@ -0,0 +1,5 @@
1
+ html
2
+ head
3
+ body
4
+ .wrapper
5
+ = yield
@@ -0,0 +1,48 @@
1
+ - render_everything
2
+ head
3
+ = stylesheet_link_tag "pattern-library"
4
+ body
5
+ = docks_icons
6
+ .page
7
+ .page__sidebar
8
+ = render "sidebar"
9
+ .page__content
10
+ .vertical-stack
11
+ .vertical-stack__item.vertical-stack__item--fixed
12
+ .page-header
13
+ .grid.grid--vertically-centered
14
+ .grid__item.grid__item--no-flex
15
+ button.sidebar__toggler
16
+ span.helper--visually-hidden
17
+ | Toggle Sidebar
18
+ .icon.icon--action.icon--hamburger
19
+ .icon--hamburger__slice
20
+ .grid__item
21
+ h1.type.type--heading.type--heading-1
22
+ = @pattern.title
23
+ - if has_github?
24
+ .popover__container
25
+ button.docks-button.docks-button--dark
26
+ | Github
27
+ i.icon.icon--disclosure
28
+ - docks_popover do
29
+ .list
30
+ | <a href="
31
+ = "#{github_root_url}/issues/new?body=#{url_encode(github_issue_message)}"
32
+ | " target="_blank" class="list__item">File an issue
33
+ .list__group
34
+ h4.type.type--heading.type--heading-4
35
+ | View source
36
+ - relative_pattern_files.each do |file|
37
+ | <a href="
38
+ = github_url(file)
39
+ | " target="_blank" class="list__item type--code">
40
+ = File.basename(file)
41
+ .vertical-stack__item
42
+ main.scroll-container
43
+ = yield
44
+ = docks_details_sheet
45
+ = docks_xray
46
+ script[type="text/javascript"]
47
+ | window.pattern = <ruby code="= CGI.unescapeHTML(@pattern.to_json)"></ruby>;
48
+ = javascript_include_tag "pattern_library"
@@ -0,0 +1,112 @@
1
+ nav.sidebar
2
+ .vertical-stack
3
+ .vertical-stack__item.vertical-stack__item--fixed
4
+ header.page-header
5
+ .grid.grid--vertically-centered
6
+ .grid__item
7
+ label.label.helper--visually-hidden[for="search"]
8
+ | Search
9
+ .field.field--text
10
+ .field__icon
11
+ = docks_icon(:search, size: :medium)
12
+ input#search.field__input[type="search" data-filters="#list--patterns, #list--this-pattern" data-filter-attribute="contents" placeholder="Search"]
13
+ .grid__item.grid__item--no-flex
14
+ .popover__container
15
+ = docks_icon :eye, size: :large, color: :gray_darker
16
+ - docks_popover do |popover|
17
+ - popover.pane do
18
+ .field.field--switch
19
+ input#private-toggle.field__switch[type="checkbox" data-filters="#list--this-pattern, #symbols--structure, #symbols--behavior" data-filter-attribute="data-private" data-checked-value="true|false"]
20
+ label.label[for="private-toggle"]
21
+ | Show private symbols
22
+ .vertical-stack__item
23
+ - unless @pattern.symbols.empty?
24
+ #list--this-pattern.list[data-filter-items=".list__item"]
25
+ - symbol_contents = { "structure" => @pattern.has_structure?, "behavior" => @pattern.has_behavior? }
26
+ - has_both = symbol_contents["structure"] && symbol_contents["behavior"]
27
+ h3.type.type--heading.type--heading-3
28
+ | This Pattern
29
+ - %w(structure behavior).each do |group|
30
+ - if symbol_contents[group]
31
+ - if group == "structure" && !(demos = @pattern.demos).empty?
32
+ .list__group
33
+ h4.type.type--heading.type--heading-4
34
+ | Components
35
+ - demos.each do |demo|
36
+ | <a class="list__item type--code" href="#
37
+ = demo.component.symbol_id
38
+ | " data-private="
39
+ = demo.component.private?
40
+ | ">
41
+ = demo.name
42
+ - if group == "behavior" && !(factories = @pattern.factories).empty?
43
+ .list__group
44
+ h4.type.type--heading.type--heading-4
45
+ | Factories
46
+ - factories.each do |factory|
47
+ | <a class="list__item type--code" href="#
48
+ = factory.symbol_id
49
+ | " data-private="
50
+ = factory.private?
51
+ | ">
52
+ = factory.name
53
+ - factory.static_properties.each do |prop|
54
+ | <a href="#
55
+ = prop.symbol_id
56
+ | " class="list__item list__item--indented type--code" data-private="
57
+ = prop.private?
58
+ | ">.
59
+ = prop.name
60
+ - factory.static_methods.each do |meth|
61
+ | <a href="#
62
+ = meth.symbol_id
63
+ | " class="list__item list__item--indented type--code" data-private="
64
+ = meth.private?
65
+ | ">.
66
+ = meth.name
67
+ | ()
68
+ - factory.instance_properties.each do |prop|
69
+ | <a href="#
70
+ = prop.symbol_id
71
+ | " class="list__item list__item--indented type--code" data-private="
72
+ = prop.private?
73
+ | ">#
74
+ = prop.name
75
+ - factory.instance_methods.each do |meth|
76
+ | <a href="#
77
+ = meth.symbol_id
78
+ | " class="list__item list__item--indented type--code" data-private="
79
+ = meth.private?
80
+ | ">#
81
+ = meth.name
82
+ | ()
83
+ - %w(variable function mixin).each do |type|
84
+ - symbol_options = {}
85
+ - symbol_options[group == "behavior" ? :include : :exclude] = Docks::Types::Languages::SCRIPT
86
+ - symbols = @pattern.send(type.pluralize.to_sym, symbol_options)
87
+ - unless symbols.empty?
88
+ .list__group
89
+ h4.type.type--heading.type--heading-4
90
+ = type.pluralize.capitalize
91
+ - symbols.each do |symbol|
92
+ | <a class="list__item type--code" href="#
93
+ = symbol.symbol_id
94
+ | " data-private="
95
+ = symbol.private?
96
+ | ">
97
+ = symbol.name
98
+ #list--patterns.list[data-filter-items=".list__item"]
99
+ h3.type.type--heading.type--heading-3
100
+ | Library
101
+ - @pattern_library.groups do |group, patterns|
102
+ .list__group
103
+ h4.type.type--heading.type--heading-4
104
+ = group.pluralize
105
+ - patterns.sort do |one, two| one.name <=> two.name }.each do |pattern|
106
+ - active_pattern = pattern.name == @pattern.name
107
+ | <a class="list__item
108
+ = " list__item--is-active" if active_pattern
109
+ | " href="
110
+ = active_pattern ? "javascript:" : docks.pattern_path(pattern.name)
111
+ | ">
112
+ = pattern.title
@@ -0,0 +1 @@
1
+ = render(partial: "symbols/factory", locals: { factory: klass })
@@ -0,0 +1,30 @@
1
+ | <section class="section" id="
2
+ = demo.component.symbol_id
3
+ | " data-private="
4
+ = demo.component.private?
5
+ | ">
6
+ header.content
7
+ .grid
8
+ .grid__item
9
+ h3.type.type--heading.type--heading-2
10
+ - if title = demo.component.title
11
+ = title
12
+ - else
13
+ span.type--code
14
+ = demo.component.name
15
+ .grid__item.grid__item--no-flex
16
+ .docks-button__container
17
+ | <div class="docks-button" data-xray-trigger="
18
+ = demo.name
19
+ | ">x-ray
20
+ - markup = render(inline: (demo.component.markup || demo.component.helper), layout: false)
21
+ - code_details = []
22
+ - code_details << { code: demo.component.helper, language: "erb", label: "Helper" } unless demo.component.helper.nil?
23
+ - code_details << { code: markup, language: "html", label: "Markup" }
24
+ - options = [demo.name].concat demo.joint_variations.map { |variant| variant.name }
25
+ = docks_code_block(code: code_details, hideable?: true, full_width?: true, hidden?: true, options: options, id: demo.name, demo: demo)
26
+ - #= docks_toggle_container variations: demo.select_variations(group_by_component: true), base_class: demo.component.name
27
+ - if demo.component.description
28
+ .content
29
+ .type-container
30
+ = demo.component.description
@@ -0,0 +1,57 @@
1
+ .content.content--extra-vertical-spacing
2
+ | <div class="section" id="
3
+ = factory.symbol_id
4
+ | " data-private="
5
+ = factory.private?
6
+ | ">
7
+ h2.type.type--heading.type--heading-2.type--heading-bordered
8
+ span.type--code
9
+ = factory.name
10
+ .type-container
11
+ = factory.description
12
+ = docks_code_block(code: factory.signature, language: factory.source.language_code)
13
+ - unless (params = factory.fetch(:params, [])).empty?
14
+ h4.type.type--heading.type--heading-4
15
+ | Parameters
16
+ - params.each do |param|
17
+ h5.type.type--heading.type--heading-5
18
+ span.type--code
19
+ = param.name
20
+ span.badge
21
+ = param.types.first
22
+ .type-container.type-container--small
23
+ = param.description
24
+ - unless (properties = param.properties || []).empty?
25
+ - docks_table do
26
+ thead.table__header
27
+ tr.table__row
28
+ th.table__cell
29
+ | Name
30
+ th.table__cell
31
+ | Description
32
+ th.table__cell
33
+ | Types
34
+ th.table__cell.table__cell--centered
35
+ | Default
36
+ tbody.table__body
37
+ - properties.each do |property|
38
+ tr.table__row
39
+ td.table__cell
40
+ code.type--code
41
+ = property.name
42
+ td.table__cell
43
+ .type-container.type-container--small
44
+ = property.description
45
+ td.table__cell
46
+ = (type = property.types.try(:first)) ? "<span class='type--code'>#{type}</span>".html_safe : "Anything"
47
+ td.table__cell.table__cell--centered
48
+ = (default = property.default) ? "<span class='type--code'>#{default}</span>".html_safe : "—".html_safe
49
+ - unless (examples = factory.fetch(:examples, [])).empty?
50
+ h4.type.type--heading.type--heading-4
51
+ = "Example".pluralize(examples.length)
52
+ - examples.each do |example|
53
+ = docks_code_block(code: example.code, language: example.language, condensed?: true)
54
+ - factory.properties.each do |property|
55
+ = render "docks/partials/variable", variable: property
56
+ - factory.methods.each do |method|
57
+ = render "docks/partials/function", function: method
@@ -0,0 +1,81 @@
1
+ | <div class="section" id="
2
+ = function.symbol_id
3
+ | " data-private="
4
+ = function.private?
5
+ | ">
6
+ header
7
+ .inline-group
8
+ .inline-group__item
9
+ h3.type.type--heading.type--heading-3
10
+ span.type--code
11
+ = function.name
12
+ - if function.private? || function.deprecated
13
+ .inline-group__item
14
+ .badge__container
15
+ - if function.private?
16
+ span.badge.badge--standalone.badge--secret
17
+ | private
18
+ - if function.deprecated
19
+ span.badge.badge--standalone.badge--warning
20
+ | deprecated
21
+ .type-container
22
+ = function.description
23
+ = docks_code_block code: function.signature, language: function.source.language_code, id: "function--#{function.name}", full_width?: true
24
+ - unless (aliases = function.fetch(:aliases, [])).empty?
25
+ h4.type.type--heading.type--heading-4
26
+ | Aliases
27
+ - aliases.each do |an_alias|
28
+ code.type--code
29
+ = an_alias
30
+ - unless (params = function.fetch(:params, [])).empty?
31
+ h4.type.type--heading.type--heading-4
32
+ | Parameters
33
+ - params.each do |param|
34
+ h5.type.type--heading.type--heading-5
35
+ span.type--code
36
+ = param.name
37
+ span.badge
38
+ = param.types.first
39
+ .type-container.type-container--small
40
+ = param.description
41
+ - unless (properties = param.properties || []).empty?
42
+ - docks_table do
43
+ thead.table__header
44
+ tr.table__row
45
+ th.table__cell
46
+ | Name
47
+ th.table__cell
48
+ | Description
49
+ th.table__cell
50
+ | Types
51
+ th.table__cell.table__cell--centered
52
+ | Default
53
+ tbody.table__body
54
+ - properties.each do |property|
55
+ tr.table__row
56
+ td.table__cell
57
+ code.type--code
58
+ = property.name
59
+ td.table__cell
60
+ .type-container.type-container--small
61
+ = property.description
62
+ td.table__cell
63
+ = (type = !property.types && property.types.first) ? "<span class='type--code'>#{type}</span>" : "Anything"
64
+ td.table__cell.table__cell--centered
65
+ = (default = property.default) ? "<span class='type--code'>#{default}</span>" : "—"
66
+ h4.type.type--heading.type--heading-4
67
+ | Returns
68
+ - if return_types = function.returns && function.returns.types
69
+ | <a href="
70
+ = docks_path(return_types.first, language: function.source.language_code)
71
+ | ">
72
+ code.type--code
73
+ = return_types.first
74
+ - else
75
+ p.type.type--paragraph
76
+ | Nothing
77
+ - unless (examples = function.fetch(:examples, [])).empty?
78
+ h4.type.type--heading.type--heading-4
79
+ = "Example".pluralize(examples.length)
80
+ - examples.each do |example|
81
+ = docks_code_block code: example.code, language: example.language, condensed?: true
@@ -0,0 +1,45 @@
1
+ | <div class="section" id="
2
+ = mixin.symbol_id
3
+ | " data-private="
4
+ = mixin.private?
5
+ | ">
6
+ header
7
+ .inline-group
8
+ .inline-group__item
9
+ h3.type.type--heading.type--heading-3
10
+ span.type--code
11
+ = mixin.name
12
+ - if mixin.private? || mixin.deprecated
13
+ .inline-group__item
14
+ .badge__container
15
+ - if mixin.private?
16
+ span.badge.badge--standalone.badge--secret
17
+ | private
18
+ - if mixin.deprecated
19
+ span.badge.badge--standalone.badge--warning
20
+ | deprecated
21
+ .type-container
22
+ = mixin.description
23
+ = docks_code_block code: mixin.signature, language: mixin.source.language_code, id: "mixin--#{mixin.name}", full_width?: true
24
+ - unless (aliases = mixin.fetch(:aliases, [])).empty?
25
+ h4.type.type--heading.type--heading-4
26
+ | Aliases
27
+ - aliases.each do |an_alias|
28
+ code.type--code
29
+ = an_alias
30
+ - unless (params = mixin.fetch(:params, [])).empty?
31
+ h4.type.type--heading.type--heading-4
32
+ | Parameters
33
+ - params.each do |param|
34
+ h5.type.type--heading.type--heading-5
35
+ span.type--code
36
+ = param.name
37
+ span.badge
38
+ = param.types.first
39
+ .type-container.type-container--small
40
+ = param.description
41
+ - unless (examples = mixin.fetch(:examples, [])).empty?
42
+ h4.type.type--heading.type--heading-4
43
+ = "Example".pluralize(examples.length)
44
+ - examples.each do |example|
45
+ = docks_code_block code: example.code, language: example.language, condensed?: true
@@ -0,0 +1,35 @@
1
+ | <div class="section" id="
2
+ = variable.symbol_id
3
+ | " data-private="
4
+ = variable.private?
5
+ | ">
6
+ header
7
+ .inline-group
8
+ .inline-group__item
9
+ h3.type.type--heading.type--heading-3
10
+ span.type--code
11
+ = variable.name
12
+ - if variable.private? || variable.deprecated
13
+ .inline-group__item
14
+ .badge__container
15
+ - if variable.private?
16
+ span.badge.badge--standalone.badge--secret
17
+ | private
18
+ - if variable.deprecated
19
+ span.badge.badge--standalone.badge--warning
20
+ | deprecated
21
+ .type-container
22
+ = variable.description
23
+ - if type = variable.type
24
+ h4.type.type--heading.type--heading-4
25
+ | Type
26
+ | <a href="
27
+ = docks_path_to(type, language: variable.source.language_code)
28
+ | ">
29
+ code.type--code
30
+ = type
31
+ - if value = variable.value
32
+ h4.type.type--heading.type--heading-4
33
+ | Value
34
+ code.type--code
35
+ = value
@@ -0,0 +1,63 @@
1
+ .content
2
+ - if deprecation = @pattern.deprecated
3
+ .notice
4
+ h3.type.type--heading.type--heading-3
5
+ | Deprecated as of
6
+ strong
7
+ = deprecation.version
8
+ .type-container
9
+ = deprecation.description
10
+ pre
11
+ - #= @pattern.to_yaml
12
+ pre
13
+ - #= @pattern_library.to_yaml
14
+ - if description = @pattern.description
15
+ .type-container
16
+ = description
17
+ - if @pattern.has_structure? && @pattern.has_behavior?
18
+ - docks_tablist(size: :large, manage_url?: true) do |tablist|
19
+ = tablist.tab(text: "Structure", active?: true, id: "page__content__tab--markup", panel_id: "page__content--markup", icon: :code)
20
+ = tablist.tab(text: "Behavior", id: "page__content__tab--behavior", panel_id: "page__content--behavior", icon: :script)
21
+ .tablist__panel-container
22
+ - docks_component("tablist:panel", active?: true, id: "page__content--markup", tab_id: "page__content__tab--markup") do
23
+ #symbols--structure[data-filter-items=".section"]
24
+ - @pattern.demos.each do |demo|
25
+ = render partial: "symbols/demo", locals: { demo: demo }
26
+ - unless (variables = @pattern.variables(exclude: :script)).empty?
27
+ .content.content--extra-vertical-spacing
28
+ h2.type.type--heading.type--heading-2.type--heading-bordered
29
+ | Variables
30
+ - variables.each do |variable|
31
+ = render partial: "symbols/variable", locals: { variable: variable }
32
+ - unless (functions = @pattern.functions(exclude: :script)).empty?
33
+ .content.content--extra-vertical-spacing
34
+ h2.type.type--heading.type--heading-2.type--heading-bordered
35
+ | Functions
36
+ - functions.each_with_index do |func, index|
37
+ = render partial: "symbols/function", locals: { function: func }
38
+ - unless (mixins = @pattern.mixins(exclude: :script)).empty?
39
+ .content.content--extra-vertical-spacing
40
+ h2.type.type--heading.type--heading-2.type--heading-bordered
41
+ | Mixins
42
+ - mixins.each do |mixin|
43
+ = render partial: "symbols/mixin", locals: { mixin: mixin }
44
+ - docks_component("tablist:panel", id: "page__content--behavior", tab_id: "page__content__tab--behavior") do
45
+ #symbols--behavior[data-filter-items=".section"]
46
+ - unless (factories = @pattern.factories(include: :script)).empty?
47
+ - factories.each do |factory|
48
+ = render partial: "symbols/factory", locals: { factory: factory }
49
+ - unless (classes = @pattern.classes(include: :script)).empty?
50
+ - classes.each do |klass|
51
+ = render partial: "symbols/class", locals: { klass: klass }
52
+ - unless (variables = @pattern.variables(include: :script)).empty?
53
+ .content.content--extra-vertical-spacing
54
+ h2.type.type--heading.type--heading-2.type--heading-bordered
55
+ | Variables
56
+ - variables.each do |variable|
57
+ = render partial: "symbols/variable", locals: { variable: variable }
58
+ - unless (functions = @pattern.functions(include: :script)).empty?
59
+ .content.content--extra-vertical-spacing
60
+ h2.type.type--heading.type--heading-2.type--heading-bordered
61
+ | Functions
62
+ - functions.each do |func|
63
+ = render partial: "symbols/function", locals: { function: func }
data/docks_config.rb ADDED
@@ -0,0 +1,32 @@
1
+ Docks.configure do |config|
2
+ config.sources = [
3
+ "source/components/**/*.{scss,js,md}",
4
+ "source/structures/**/*.{scss,js,md}",
5
+ "source/behaviors/**/*.{scss,js,md}",
6
+ "source/utilities/**/*.{scss,js,md}",
7
+ "source/foundation/**/*.{scss,js,md}"
8
+ ]
9
+
10
+ config.destination = "public"
11
+
12
+ config.compiled_assets = [
13
+ "pattern-library.css",
14
+ "pattern_library.js"
15
+ ]
16
+
17
+ config.asset_folders = {
18
+ scripts: "scripts",
19
+ styles: "styles"
20
+ }
21
+
22
+ config.templates = "pattern_library_assets/templates/erb"
23
+
24
+ config.mount_at = "pattern-library"
25
+ config.use_theme_assets = false
26
+ config.github_repo = "docks-app/docks_theme_api"
27
+
28
+ config.pattern_id = lambda do |file|
29
+ dir = File.basename(File.dirname(file))
30
+ %w(vendor foundation .).include?(dir) ? File.basename(file).split(".").first : dir
31
+ end
32
+ end
@@ -0,0 +1,37 @@
1
+ require "rubygems"
2
+
3
+ # -*- encoding: utf-8 -*-
4
+ $:.push File.expand_path("../lib", __FILE__)
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "docks_theme_api"
8
+ s.version = "1.0.2"
9
+ s.platform = Gem::Platform::RUBY
10
+ s.required_ruby_version = ">= 1.9.3"
11
+ s.authors = ["Chris Sauve"]
12
+ s.email = ["chrismsauve@gmail.com"]
13
+ s.license = "MIT"
14
+ s.homepage = "http://github.com/docks-app/docks_theme_api"
15
+ s.summary = "A theme for Docks geared towards documenting complex CSS and JavaScript components."
16
+ s.description = s.summary
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- spec/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_runtime_dependency "activesupport"
24
+ s.add_runtime_dependency "docks_app"
25
+ s.add_runtime_dependency "docks_theme_base"
26
+
27
+ s.add_development_dependency "bundler", "~> 1.3"
28
+ s.add_development_dependency "rubocop", "< 1.0"
29
+ s.add_development_dependency "rake", "~> 10.4"
30
+ s.add_development_dependency "rspec", "~> 3.0"
31
+ s.add_development_dependency "haml", "~> 4.0"
32
+ s.add_development_dependency "slim", "~> 3.0"
33
+ s.add_development_dependency "awesome_print", "~> 1.6"
34
+ s.add_development_dependency "rspec-html-matchers", "~> 0.7"
35
+ s.add_development_dependency "html2haml", "~> 2.0"
36
+ s.add_development_dependency "html2slim", "~> 0.2"
37
+ end