govuk_publishing_components 9.3.6 → 9.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/app/assets/stylesheets/component_guide/application.scss +10 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/admin_styles.scss +13 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +66 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss +1 -0
  9. data/app/models/govuk_publishing_components/component_doc.rb +12 -0
  10. data/app/views/govuk_publishing_components/component_guide/component_doc/_preview.html.erb +7 -5
  11. data/app/views/govuk_publishing_components/component_guide/show.html.erb +22 -0
  12. data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +39 -0
  13. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +26 -0
  14. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +10 -0
  15. data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +142 -0
  16. data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +12 -0
  17. data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +28 -0
  18. data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -0
  19. data/app/views/layouts/govuk_publishing_components/application.html.erb +5 -0
  20. data/config/initializers/assets.rb +12 -0
  21. data/lib/govuk_publishing_components.rb +1 -0
  22. data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +13 -0
  23. data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -0
  24. data/lib/govuk_publishing_components/version.rb +1 -1
  25. data/node_modules/govuk-frontend/README.md +96 -0
  26. data/node_modules/govuk-frontend/all-ie8.scss +6 -0
  27. data/node_modules/govuk-frontend/all.js +1720 -0
  28. data/node_modules/govuk-frontend/all.scss +11 -0
  29. data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
  30. data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
  31. data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
  32. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
  33. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
  34. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
  35. data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
  36. data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
  37. data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
  38. data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
  39. data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
  40. data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
  41. data/node_modules/govuk-frontend/assets/images/favicon.ico +0 -0
  42. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
  43. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
  44. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
  45. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon.png +0 -0
  46. data/node_modules/govuk-frontend/assets/images/govuk-crest-2x.png +0 -0
  47. data/node_modules/govuk-frontend/assets/images/govuk-crest.png +0 -0
  48. data/node_modules/govuk-frontend/assets/images/govuk-logotype-crown.png +0 -0
  49. data/node_modules/govuk-frontend/assets/images/govuk-mask-icon.svg +7 -0
  50. data/node_modules/govuk-frontend/assets/images/govuk-opengraph-image.png +0 -0
  51. data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
  52. data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
  53. data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
  54. data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
  55. data/node_modules/govuk-frontend/common.js +39 -0
  56. data/node_modules/govuk-frontend/components/_all.scss +26 -0
  57. data/node_modules/govuk-frontend/components/back-link/README.md +142 -0
  58. data/node_modules/govuk-frontend/components/back-link/_back-link.scss +54 -0
  59. data/node_modules/govuk-frontend/components/back-link/back-link.njk +3 -0
  60. data/node_modules/govuk-frontend/components/back-link/macro.njk +3 -0
  61. data/node_modules/govuk-frontend/components/back-link/template.njk +2 -0
  62. data/node_modules/govuk-frontend/components/breadcrumbs/README.md +335 -0
  63. data/node_modules/govuk-frontend/components/breadcrumbs/_breadcrumbs.scss +119 -0
  64. data/node_modules/govuk-frontend/components/breadcrumbs/breadcrumbs.njk +14 -0
  65. data/node_modules/govuk-frontend/components/breadcrumbs/macro.njk +3 -0
  66. data/node_modules/govuk-frontend/components/breadcrumbs/template.njk +13 -0
  67. data/node_modules/govuk-frontend/components/button/README.md +319 -0
  68. data/node_modules/govuk-frontend/components/button/_button.scss +185 -0
  69. data/node_modules/govuk-frontend/components/button/button.js +548 -0
  70. data/node_modules/govuk-frontend/components/button/button.njk +3 -0
  71. data/node_modules/govuk-frontend/components/button/macro.njk +3 -0
  72. data/node_modules/govuk-frontend/components/button/template.njk +35 -0
  73. data/node_modules/govuk-frontend/components/checkboxes/README.md +782 -0
  74. data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +151 -0
  75. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +730 -0
  76. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.njk +27 -0
  77. data/node_modules/govuk-frontend/components/checkboxes/macro.njk +3 -0
  78. data/node_modules/govuk-frontend/components/checkboxes/template.njk +86 -0
  79. data/node_modules/govuk-frontend/components/date-input/README.md +640 -0
  80. data/node_modules/govuk-frontend/components/date-input/_date-input.scss +35 -0
  81. data/node_modules/govuk-frontend/components/date-input/date-input.njk +23 -0
  82. data/node_modules/govuk-frontend/components/date-input/macro.njk +3 -0
  83. data/node_modules/govuk-frontend/components/date-input/template.njk +76 -0
  84. data/node_modules/govuk-frontend/components/details/README.md +237 -0
  85. data/node_modules/govuk-frontend/components/details/_details.scss +86 -0
  86. data/node_modules/govuk-frontend/components/details/details.js +836 -0
  87. data/node_modules/govuk-frontend/components/details/details.njk +7 -0
  88. data/node_modules/govuk-frontend/components/details/implementation.md +43 -0
  89. data/node_modules/govuk-frontend/components/details/macro.njk +3 -0
  90. data/node_modules/govuk-frontend/components/details/template.njk +10 -0
  91. data/node_modules/govuk-frontend/components/error-message/README.md +143 -0
  92. data/node_modules/govuk-frontend/components/error-message/_error-message.scss +15 -0
  93. data/node_modules/govuk-frontend/components/error-message/error-message.njk +7 -0
  94. data/node_modules/govuk-frontend/components/error-message/macro.njk +3 -0
  95. data/node_modules/govuk-frontend/components/error-message/template.njk +3 -0
  96. data/node_modules/govuk-frontend/components/error-summary/README.md +215 -0
  97. data/node_modules/govuk-frontend/components/error-summary/_error-summary.scss +68 -0
  98. data/node_modules/govuk-frontend/components/error-summary/error-summary.js +520 -0
  99. data/node_modules/govuk-frontend/components/error-summary/error-summary.njk +17 -0
  100. data/node_modules/govuk-frontend/components/error-summary/macro.njk +3 -0
  101. data/node_modules/govuk-frontend/components/error-summary/template.njk +25 -0
  102. data/node_modules/govuk-frontend/components/fieldset/README.md +213 -0
  103. data/node_modules/govuk-frontend/components/fieldset/_fieldset.scss +58 -0
  104. data/node_modules/govuk-frontend/components/fieldset/fieldset.njk +13 -0
  105. data/node_modules/govuk-frontend/components/fieldset/macro.njk +3 -0
  106. data/node_modules/govuk-frontend/components/fieldset/template.njk +17 -0
  107. data/node_modules/govuk-frontend/components/file-upload/README.md +332 -0
  108. data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +19 -0
  109. data/node_modules/govuk-frontend/components/file-upload/file-upload.njk +9 -0
  110. data/node_modules/govuk-frontend/components/file-upload/macro.njk +3 -0
  111. data/node_modules/govuk-frontend/components/file-upload/template.njk +42 -0
  112. data/node_modules/govuk-frontend/components/footer/README.md +284 -0
  113. data/node_modules/govuk-frontend/components/footer/_footer.scss +216 -0
  114. data/node_modules/govuk-frontend/components/footer/footer.njk +3 -0
  115. data/node_modules/govuk-frontend/components/footer/macro.njk +3 -0
  116. data/node_modules/govuk-frontend/components/footer/template.njk +80 -0
  117. data/node_modules/govuk-frontend/components/header/README.md +524 -0
  118. data/node_modules/govuk-frontend/components/header/_header.scss +285 -0
  119. data/node_modules/govuk-frontend/components/header/header.js +717 -0
  120. data/node_modules/govuk-frontend/components/header/header.njk +3 -0
  121. data/node_modules/govuk-frontend/components/header/macro.njk +3 -0
  122. data/node_modules/govuk-frontend/components/header/template.njk +82 -0
  123. data/node_modules/govuk-frontend/components/hint/README.md +157 -0
  124. data/node_modules/govuk-frontend/components/hint/_hint.scss +29 -0
  125. data/node_modules/govuk-frontend/components/hint/hint.njk +7 -0
  126. data/node_modules/govuk-frontend/components/hint/macro.njk +3 -0
  127. data/node_modules/govuk-frontend/components/hint/template.njk +4 -0
  128. data/node_modules/govuk-frontend/components/input/README.md +416 -0
  129. data/node_modules/govuk-frontend/components/input/_input.scss +62 -0
  130. data/node_modules/govuk-frontend/components/input/input.njk +9 -0
  131. data/node_modules/govuk-frontend/components/input/macro.njk +3 -0
  132. data/node_modules/govuk-frontend/components/input/template.njk +42 -0
  133. data/node_modules/govuk-frontend/components/inset-text/README.md +157 -0
  134. data/node_modules/govuk-frontend/components/inset-text/_inset-text.scss +28 -0
  135. data/node_modules/govuk-frontend/components/inset-text/inset-text.njk +7 -0
  136. data/node_modules/govuk-frontend/components/inset-text/macro.njk +3 -0
  137. data/node_modules/govuk-frontend/components/inset-text/template.njk +4 -0
  138. data/node_modules/govuk-frontend/components/label/README.md +193 -0
  139. data/node_modules/govuk-frontend/components/label/_label.scss +45 -0
  140. data/node_modules/govuk-frontend/components/label/label.njk +6 -0
  141. data/node_modules/govuk-frontend/components/label/macro.njk +3 -0
  142. data/node_modules/govuk-frontend/components/label/template.njk +15 -0
  143. data/node_modules/govuk-frontend/components/panel/README.md +151 -0
  144. data/node_modules/govuk-frontend/components/panel/_panel.scss +42 -0
  145. data/node_modules/govuk-frontend/components/panel/macro.njk +3 -0
  146. data/node_modules/govuk-frontend/components/panel/panel.njk +7 -0
  147. data/node_modules/govuk-frontend/components/panel/template.njk +12 -0
  148. data/node_modules/govuk-frontend/components/phase-banner/README.md +152 -0
  149. data/node_modules/govuk-frontend/components/phase-banner/_phase-banner.scss +31 -0
  150. data/node_modules/govuk-frontend/components/phase-banner/macro.njk +3 -0
  151. data/node_modules/govuk-frontend/components/phase-banner/phase-banner.njk +7 -0
  152. data/node_modules/govuk-frontend/components/phase-banner/template.njk +17 -0
  153. data/node_modules/govuk-frontend/components/radios/README.md +686 -0
  154. data/node_modules/govuk-frontend/components/radios/_radios.scss +157 -0
  155. data/node_modules/govuk-frontend/components/radios/macro.njk +3 -0
  156. data/node_modules/govuk-frontend/components/radios/radios.js +730 -0
  157. data/node_modules/govuk-frontend/components/radios/radios.njk +27 -0
  158. data/node_modules/govuk-frontend/components/radios/template.njk +85 -0
  159. data/node_modules/govuk-frontend/components/select/README.md +387 -0
  160. data/node_modules/govuk-frontend/components/select/_select.scss +35 -0
  161. data/node_modules/govuk-frontend/components/select/macro.njk +3 -0
  162. data/node_modules/govuk-frontend/components/select/select.njk +24 -0
  163. data/node_modules/govuk-frontend/components/select/template.njk +44 -0
  164. data/node_modules/govuk-frontend/components/skip-link/README.md +142 -0
  165. data/node_modules/govuk-frontend/components/skip-link/_skip-link.scss +15 -0
  166. data/node_modules/govuk-frontend/components/skip-link/macro.njk +3 -0
  167. data/node_modules/govuk-frontend/components/skip-link/skip-link.njk +3 -0
  168. data/node_modules/govuk-frontend/components/skip-link/template.njk +3 -0
  169. data/node_modules/govuk-frontend/components/table/README.md +585 -0
  170. data/node_modules/govuk-frontend/components/table/_table.scss +50 -0
  171. data/node_modules/govuk-frontend/components/table/macro.njk +3 -0
  172. data/node_modules/govuk-frontend/components/table/table.njk +45 -0
  173. data/node_modules/govuk-frontend/components/table/template.njk +39 -0
  174. data/node_modules/govuk-frontend/components/tabs/README.md +375 -0
  175. data/node_modules/govuk-frontend/components/tabs/_tabs.scss +120 -0
  176. data/node_modules/govuk-frontend/components/tabs/macro.njk +3 -0
  177. data/node_modules/govuk-frontend/components/tabs/tabs.js +1302 -0
  178. data/node_modules/govuk-frontend/components/tabs/tabs.njk +3 -0
  179. data/node_modules/govuk-frontend/components/tabs/template.njk +29 -0
  180. data/node_modules/govuk-frontend/components/tag/README.md +150 -0
  181. data/node_modules/govuk-frontend/components/tag/_tag.scss +23 -0
  182. data/node_modules/govuk-frontend/components/tag/macro.njk +3 -0
  183. data/node_modules/govuk-frontend/components/tag/tag.njk +7 -0
  184. data/node_modules/govuk-frontend/components/tag/template.njk +3 -0
  185. data/node_modules/govuk-frontend/components/textarea/README.md +350 -0
  186. data/node_modules/govuk-frontend/components/textarea/_textarea.scss +31 -0
  187. data/node_modules/govuk-frontend/components/textarea/macro.njk +3 -0
  188. data/node_modules/govuk-frontend/components/textarea/template.njk +41 -0
  189. data/node_modules/govuk-frontend/components/textarea/textarea.njk +11 -0
  190. data/node_modules/govuk-frontend/components/warning-text/README.md +148 -0
  191. data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +50 -0
  192. data/node_modules/govuk-frontend/components/warning-text/macro.njk +3 -0
  193. data/node_modules/govuk-frontend/components/warning-text/template.njk +9 -0
  194. data/node_modules/govuk-frontend/components/warning-text/warning-text.njk +9 -0
  195. data/node_modules/govuk-frontend/core/_all.scss +6 -0
  196. data/node_modules/govuk-frontend/core/_global-styles.scss +19 -0
  197. data/node_modules/govuk-frontend/core/_links.scss +40 -0
  198. data/node_modules/govuk-frontend/core/_lists.scss +63 -0
  199. data/node_modules/govuk-frontend/core/_section-break.scss +56 -0
  200. data/node_modules/govuk-frontend/core/_template.scss +16 -0
  201. data/node_modules/govuk-frontend/core/_typography.scss +186 -0
  202. data/node_modules/govuk-frontend/helpers/_all.scss +12 -0
  203. data/node_modules/govuk-frontend/helpers/_clearfix.scss +15 -0
  204. data/node_modules/govuk-frontend/helpers/_colour.scss +51 -0
  205. data/node_modules/govuk-frontend/helpers/_device-pixels.scss +38 -0
  206. data/node_modules/govuk-frontend/helpers/_focusable.scss +34 -0
  207. data/node_modules/govuk-frontend/helpers/_font-faces.scss +67 -0
  208. data/node_modules/govuk-frontend/helpers/_grid.scss +100 -0
  209. data/node_modules/govuk-frontend/helpers/_links.scss +149 -0
  210. data/node_modules/govuk-frontend/helpers/_media-queries.scss +95 -0
  211. data/node_modules/govuk-frontend/helpers/_shape-arrow.scss +80 -0
  212. data/node_modules/govuk-frontend/helpers/_spacing.scss +152 -0
  213. data/node_modules/govuk-frontend/helpers/_typography.scss +153 -0
  214. data/node_modules/govuk-frontend/helpers/_visually-hidden.scss +76 -0
  215. data/node_modules/govuk-frontend/objects/_all.scss +4 -0
  216. data/node_modules/govuk-frontend/objects/_form-group.scss +21 -0
  217. data/node_modules/govuk-frontend/objects/_grid.scss +10 -0
  218. data/node_modules/govuk-frontend/objects/_main-wrapper.scss +37 -0
  219. data/node_modules/govuk-frontend/objects/_width-container.scss +28 -0
  220. data/node_modules/govuk-frontend/overrides/_all.scss +4 -0
  221. data/node_modules/govuk-frontend/overrides/_display.scss +14 -0
  222. data/node_modules/govuk-frontend/overrides/_spacing.scss +58 -0
  223. data/node_modules/govuk-frontend/overrides/_typography.scss +21 -0
  224. data/node_modules/govuk-frontend/overrides/_width.scss +41 -0
  225. data/node_modules/govuk-frontend/package.json +89 -0
  226. data/node_modules/govuk-frontend/settings/_all.scss +21 -0
  227. data/node_modules/govuk-frontend/settings/_assets.scss +82 -0
  228. data/node_modules/govuk-frontend/settings/_colours-applied.scss +130 -0
  229. data/node_modules/govuk-frontend/settings/_colours-organisations.scss +136 -0
  230. data/node_modules/govuk-frontend/settings/_colours-palette.scss +37 -0
  231. data/node_modules/govuk-frontend/settings/_compatibility.scss +51 -0
  232. data/node_modules/govuk-frontend/settings/_global-styles.scss +13 -0
  233. data/node_modules/govuk-frontend/settings/_ie8.scss +18 -0
  234. data/node_modules/govuk-frontend/settings/_measurements.scss +85 -0
  235. data/node_modules/govuk-frontend/settings/_media-queries.scss +23 -0
  236. data/node_modules/govuk-frontend/settings/_spacing.scss +80 -0
  237. data/node_modules/govuk-frontend/settings/_typography-font-families.scss +22 -0
  238. data/node_modules/govuk-frontend/settings/_typography-font.scss +48 -0
  239. data/node_modules/govuk-frontend/settings/_typography-responsive.scss +138 -0
  240. data/node_modules/govuk-frontend/template.njk +56 -0
  241. data/node_modules/govuk-frontend/tools/_all.scss +7 -0
  242. data/node_modules/govuk-frontend/tools/_compatibility.scss +36 -0
  243. data/node_modules/govuk-frontend/tools/_exports.scss +33 -0
  244. data/node_modules/govuk-frontend/tools/_font-url.scss +28 -0
  245. data/node_modules/govuk-frontend/tools/_ie8.scss +51 -0
  246. data/node_modules/govuk-frontend/tools/_iff.scss +15 -0
  247. data/node_modules/govuk-frontend/tools/_image-url.scss +28 -0
  248. data/node_modules/govuk-frontend/tools/_px-to-em.scss +20 -0
  249. data/node_modules/govuk-frontend/utilities/_all.scss +2 -0
  250. data/node_modules/govuk-frontend/utilities/_clearfix.scss +5 -0
  251. data/node_modules/govuk-frontend/utilities/_visually-hidden.scss +9 -0
  252. data/node_modules/govuk-frontend/vendor/_sass-mq.scss +351 -0
  253. data/node_modules/govuk-frontend/vendor/polyfills/DOMTokenList.js +272 -0
  254. data/node_modules/govuk-frontend/vendor/polyfills/Document.js +34 -0
  255. data/node_modules/govuk-frontend/vendor/polyfills/Element.js +147 -0
  256. data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +449 -0
  257. data/node_modules/govuk-frontend/vendor/polyfills/Event.js +504 -0
  258. data/node_modules/govuk-frontend/vendor/polyfills/Function/prototype/bind.js +252 -0
  259. data/node_modules/govuk-frontend/vendor/polyfills/Object/defineProperty.js +94 -0
  260. data/node_modules/govuk-frontend/vendor/polyfills/Window.js +28 -0
  261. metadata +249 -2
@@ -0,0 +1,272 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
4
+ (factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ (function(undefined) {
8
+
9
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/detect.js
10
+ var detect = (
11
+ 'DOMTokenList' in this && (function (x) {
12
+ return 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true;
13
+ })(document.createElement('x'))
14
+ );
15
+
16
+ if (detect) return
17
+
18
+ // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/polyfill.js
19
+ (function (global) {
20
+ var nativeImpl = "DOMTokenList" in global && global.DOMTokenList;
21
+
22
+ if (
23
+ !nativeImpl ||
24
+ (
25
+ !!document.createElementNS &&
26
+ !!document.createElementNS('http://www.w3.org/2000/svg', 'svg') &&
27
+ !(document.createElementNS("http://www.w3.org/2000/svg", "svg").classList instanceof DOMTokenList)
28
+ )
29
+ ) {
30
+ global.DOMTokenList = (function() { // eslint-disable-line no-unused-vars
31
+ var dpSupport = true;
32
+ var defineGetter = function (object, name, fn, configurable) {
33
+ if (Object.defineProperty)
34
+ Object.defineProperty(object, name, {
35
+ configurable: false === dpSupport ? true : !!configurable,
36
+ get: fn
37
+ });
38
+
39
+ else object.__defineGetter__(name, fn);
40
+ };
41
+
42
+ /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
43
+ try {
44
+ defineGetter({}, "support");
45
+ }
46
+ catch (e) {
47
+ dpSupport = false;
48
+ }
49
+
50
+
51
+ var _DOMTokenList = function (el, prop) {
52
+ var that = this;
53
+ var tokens = [];
54
+ var tokenMap = {};
55
+ var length = 0;
56
+ var maxLength = 0;
57
+ var addIndexGetter = function (i) {
58
+ defineGetter(that, i, function () {
59
+ preop();
60
+ return tokens[i];
61
+ }, false);
62
+
63
+ };
64
+ var reindex = function () {
65
+
66
+ /** Define getter functions for array-like access to the tokenList's contents. */
67
+ if (length >= maxLength)
68
+ for (; maxLength < length; ++maxLength) {
69
+ addIndexGetter(maxLength);
70
+ }
71
+ };
72
+
73
+ /** Helper function called at the start of each class method. Internal use only. */
74
+ var preop = function () {
75
+ var error;
76
+ var i;
77
+ var args = arguments;
78
+ var rSpace = /\s+/;
79
+
80
+ /** Validate the token/s passed to an instance method, if any. */
81
+ if (args.length)
82
+ for (i = 0; i < args.length; ++i)
83
+ if (rSpace.test(args[i])) {
84
+ error = new SyntaxError('String "' + args[i] + '" ' + "contains" + ' an invalid character');
85
+ error.code = 5;
86
+ error.name = "InvalidCharacterError";
87
+ throw error;
88
+ }
89
+
90
+
91
+ /** Split the new value apart by whitespace*/
92
+ if (typeof el[prop] === "object") {
93
+ tokens = ("" + el[prop].baseVal).replace(/^\s+|\s+$/g, "").split(rSpace);
94
+ } else {
95
+ tokens = ("" + el[prop]).replace(/^\s+|\s+$/g, "").split(rSpace);
96
+ }
97
+
98
+ /** Avoid treating blank strings as single-item token lists */
99
+ if ("" === tokens[0]) tokens = [];
100
+
101
+ /** Repopulate the internal token lists */
102
+ tokenMap = {};
103
+ for (i = 0; i < tokens.length; ++i)
104
+ tokenMap[tokens[i]] = true;
105
+ length = tokens.length;
106
+ reindex();
107
+ };
108
+
109
+ /** Populate our internal token list if the targeted attribute of the subject element isn't empty. */
110
+ preop();
111
+
112
+ /** Return the number of tokens in the underlying string. Read-only. */
113
+ defineGetter(that, "length", function () {
114
+ preop();
115
+ return length;
116
+ });
117
+
118
+ /** Override the default toString/toLocaleString methods to return a space-delimited list of tokens when typecast. */
119
+ that.toLocaleString =
120
+ that.toString = function () {
121
+ preop();
122
+ return tokens.join(" ");
123
+ };
124
+
125
+ that.item = function (idx) {
126
+ preop();
127
+ return tokens[idx];
128
+ };
129
+
130
+ that.contains = function (token) {
131
+ preop();
132
+ return !!tokenMap[token];
133
+ };
134
+
135
+ that.add = function () {
136
+ preop.apply(that, args = arguments);
137
+
138
+ for (var args, token, i = 0, l = args.length; i < l; ++i) {
139
+ token = args[i];
140
+ if (!tokenMap[token]) {
141
+ tokens.push(token);
142
+ tokenMap[token] = true;
143
+ }
144
+ }
145
+
146
+ /** Update the targeted attribute of the attached element if the token list's changed. */
147
+ if (length !== tokens.length) {
148
+ length = tokens.length >>> 0;
149
+ if (typeof el[prop] === "object") {
150
+ el[prop].baseVal = tokens.join(" ");
151
+ } else {
152
+ el[prop] = tokens.join(" ");
153
+ }
154
+ reindex();
155
+ }
156
+ };
157
+
158
+ that.remove = function () {
159
+ preop.apply(that, args = arguments);
160
+
161
+ /** Build a hash of token names to compare against when recollecting our token list. */
162
+ for (var args, ignore = {}, i = 0, t = []; i < args.length; ++i) {
163
+ ignore[args[i]] = true;
164
+ delete tokenMap[args[i]];
165
+ }
166
+
167
+ /** Run through our tokens list and reassign only those that aren't defined in the hash declared above. */
168
+ for (i = 0; i < tokens.length; ++i)
169
+ if (!ignore[tokens[i]]) t.push(tokens[i]);
170
+
171
+ tokens = t;
172
+ length = t.length >>> 0;
173
+
174
+ /** Update the targeted attribute of the attached element. */
175
+ if (typeof el[prop] === "object") {
176
+ el[prop].baseVal = tokens.join(" ");
177
+ } else {
178
+ el[prop] = tokens.join(" ");
179
+ }
180
+ reindex();
181
+ };
182
+
183
+ that.toggle = function (token, force) {
184
+ preop.apply(that, [token]);
185
+
186
+ /** Token state's being forced. */
187
+ if (undefined !== force) {
188
+ if (force) {
189
+ that.add(token);
190
+ return true;
191
+ } else {
192
+ that.remove(token);
193
+ return false;
194
+ }
195
+ }
196
+
197
+ /** Token already exists in tokenList. Remove it, and return FALSE. */
198
+ if (tokenMap[token]) {
199
+ that.remove(token);
200
+ return false;
201
+ }
202
+
203
+ /** Otherwise, add the token and return TRUE. */
204
+ that.add(token);
205
+ return true;
206
+ };
207
+
208
+ return that;
209
+ };
210
+
211
+ return _DOMTokenList;
212
+ }());
213
+ }
214
+
215
+ // Add second argument to native DOMTokenList.toggle() if necessary
216
+ (function () {
217
+ var e = document.createElement('span');
218
+ if (!('classList' in e)) return;
219
+ e.classList.toggle('x', false);
220
+ if (!e.classList.contains('x')) return;
221
+ e.classList.constructor.prototype.toggle = function toggle(token /*, force*/) {
222
+ var force = arguments[1];
223
+ if (force === undefined) {
224
+ var add = !this.contains(token);
225
+ this[add ? 'add' : 'remove'](token);
226
+ return add;
227
+ }
228
+ force = !!force;
229
+ this[force ? 'add' : 'remove'](token);
230
+ return force;
231
+ };
232
+ }());
233
+
234
+ // Add multiple arguments to native DOMTokenList.add() if necessary
235
+ (function () {
236
+ var e = document.createElement('span');
237
+ if (!('classList' in e)) return;
238
+ e.classList.add('a', 'b');
239
+ if (e.classList.contains('b')) return;
240
+ var native = e.classList.constructor.prototype.add;
241
+ e.classList.constructor.prototype.add = function () {
242
+ var args = arguments;
243
+ var l = arguments.length;
244
+ for (var i = 0; i < l; i++) {
245
+ native.call(this, args[i]);
246
+ }
247
+ };
248
+ }());
249
+
250
+ // Add multiple arguments to native DOMTokenList.remove() if necessary
251
+ (function () {
252
+ var e = document.createElement('span');
253
+ if (!('classList' in e)) return;
254
+ e.classList.add('a');
255
+ e.classList.add('b');
256
+ e.classList.remove('a', 'b');
257
+ if (!e.classList.contains('b')) return;
258
+ var native = e.classList.constructor.prototype.remove;
259
+ e.classList.constructor.prototype.remove = function () {
260
+ var args = arguments;
261
+ var l = arguments.length;
262
+ for (var i = 0; i < l; i++) {
263
+ native.call(this, args[i]);
264
+ }
265
+ };
266
+ }());
267
+
268
+ }(this));
269
+
270
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
271
+
272
+ })));
@@ -0,0 +1,34 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
4
+ (factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ (function(undefined) {
8
+
9
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
10
+ var detect = ("Document" in this);
11
+
12
+ if (detect) return
13
+
14
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
15
+ if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
16
+
17
+ if (this.HTMLDocument) { // IE8
18
+
19
+ // HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
20
+ this.Document = this.HTMLDocument;
21
+
22
+ } else {
23
+
24
+ // Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made.
25
+ this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());
26
+ this.Document.prototype = document;
27
+ }
28
+ }
29
+
30
+
31
+ })
32
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
33
+
34
+ })));
@@ -0,0 +1,147 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
4
+ (factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ (function(undefined) {
8
+
9
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
10
+ var detect = ("Document" in this);
11
+
12
+ if (detect) return
13
+
14
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
15
+ if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
16
+
17
+ if (this.HTMLDocument) { // IE8
18
+
19
+ // HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
20
+ this.Document = this.HTMLDocument;
21
+
22
+ } else {
23
+
24
+ // Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made.
25
+ this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());
26
+ this.Document.prototype = document;
27
+ }
28
+ }
29
+
30
+
31
+ })
32
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
33
+
34
+ (function(undefined) {
35
+
36
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
37
+ var detect = ('Element' in this && 'HTMLElement' in this);
38
+
39
+ if (detect) return
40
+
41
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
42
+ (function () {
43
+
44
+ // IE8
45
+ if (window.Element && !window.HTMLElement) {
46
+ window.HTMLElement = window.Element;
47
+ return;
48
+ }
49
+
50
+ // create Element constructor
51
+ window.Element = window.HTMLElement = new Function('return function Element() {}')();
52
+
53
+ // generate sandboxed iframe
54
+ var vbody = document.appendChild(document.createElement('body'));
55
+ var frame = vbody.appendChild(document.createElement('iframe'));
56
+
57
+ // use sandboxed iframe to replicate Element functionality
58
+ var frameDocument = frame.contentWindow.document;
59
+ var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
60
+ var cache = {};
61
+
62
+ // polyfill Element.prototype on an element
63
+ var shiv = function (element, deep) {
64
+ var
65
+ childNodes = element.childNodes || [],
66
+ index = -1,
67
+ key, value, childNode;
68
+
69
+ if (element.nodeType === 1 && element.constructor !== Element) {
70
+ element.constructor = Element;
71
+
72
+ for (key in cache) {
73
+ value = cache[key];
74
+ element[key] = value;
75
+ }
76
+ }
77
+
78
+ while (childNode = deep && childNodes[++index]) {
79
+ shiv(childNode, deep);
80
+ }
81
+
82
+ return element;
83
+ };
84
+
85
+ var elements = document.getElementsByTagName('*');
86
+ var nativeCreateElement = document.createElement;
87
+ var interval;
88
+ var loopLimit = 100;
89
+
90
+ prototype.attachEvent('onpropertychange', function (event) {
91
+ var
92
+ propertyName = event.propertyName,
93
+ nonValue = !cache.hasOwnProperty(propertyName),
94
+ newValue = prototype[propertyName],
95
+ oldValue = cache[propertyName],
96
+ index = -1,
97
+ element;
98
+
99
+ while (element = elements[++index]) {
100
+ if (element.nodeType === 1) {
101
+ if (nonValue || element[propertyName] === oldValue) {
102
+ element[propertyName] = newValue;
103
+ }
104
+ }
105
+ }
106
+
107
+ cache[propertyName] = newValue;
108
+ });
109
+
110
+ prototype.constructor = Element;
111
+
112
+ if (!prototype.hasAttribute) {
113
+ // <Element>.hasAttribute
114
+ prototype.hasAttribute = function hasAttribute(name) {
115
+ return this.getAttribute(name) !== null;
116
+ };
117
+ }
118
+
119
+ // Apply Element prototype to the pre-existing DOM as soon as the body element appears.
120
+ function bodyCheck() {
121
+ if (!(loopLimit--)) clearTimeout(interval);
122
+ if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
123
+ shiv(document, true);
124
+ if (interval && document.body.prototype) clearTimeout(interval);
125
+ return (!!document.body.prototype);
126
+ }
127
+ return false;
128
+ }
129
+ if (!bodyCheck()) {
130
+ document.onreadystatechange = bodyCheck;
131
+ interval = setInterval(bodyCheck, 25);
132
+ }
133
+
134
+ // Apply to any new elements created after load
135
+ document.createElement = function createElement(nodeName) {
136
+ var element = nativeCreateElement(String(nodeName).toLowerCase());
137
+ return shiv(element);
138
+ };
139
+
140
+ // remove sandboxed iframe
141
+ document.removeChild(vbody);
142
+ }());
143
+
144
+ })
145
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
146
+
147
+ })));