govuk_tech_docs 6.0.1 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug.yaml +69 -0
  3. data/.github/ISSUE_TEMPLATE/config.yaml +6 -0
  4. data/.github/ISSUE_TEMPLATE/enhancement.yaml +25 -0
  5. data/.github/pull_request_template.md +22 -8
  6. data/.github/workflows/dependency-review.yaml +17 -0
  7. data/.github/workflows/test.yaml +1 -1
  8. data/.nvmrc +1 -1
  9. data/.ruby-version +1 -1
  10. data/CHANGELOG.md +18 -2
  11. data/README.md +3 -2
  12. data/example/.ruby-version +1 -1
  13. data/example/config/tech-docs.yml +4 -0
  14. data/example/config.rb +15 -0
  15. data/example/source/active-pages/index.html.md.erb +7 -0
  16. data/example/source/active-pages/sub-section/index.html.md.erb +7 -0
  17. data/example/source/index.html.md.erb +6 -1
  18. data/govuk_tech_docs.gemspec +21 -19
  19. data/lib/govuk_tech_docs/custom_method_missing_handler.rb +30 -0
  20. data/lib/govuk_tech_docs/govuk_nunjuck_componenet_renderer.rb +43 -0
  21. data/lib/govuk_tech_docs/version.rb +1 -1
  22. data/lib/govuk_tech_docs.rb +35 -5
  23. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +1 -1
  24. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +1 -1
  25. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  26. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_accordion.scss +4 -1
  27. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +3 -1
  28. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_back-link.scss +4 -1
  29. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +7 -3
  30. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_breadcrumbs.scss +4 -1
  31. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +8 -4
  32. data/node_modules/govuk-frontend/dist/govuk/components/button/_button.scss +4 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +3 -1
  34. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_character-count.scss +4 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -0
  36. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_checkboxes.scss +4 -1
  37. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +10 -6
  38. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_cookie-banner.scss +4 -1
  39. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -0
  40. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_date-input.scss +4 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -0
  42. data/node_modules/govuk-frontend/dist/govuk/components/details/_details.scss +4 -1
  43. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +3 -1
  44. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_error-message.scss +4 -1
  45. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +2 -0
  46. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_error-summary.scss +4 -1
  47. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +3 -1
  48. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_exit-this-page.scss +4 -1
  49. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +3 -1
  50. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_fieldset.scss +4 -1
  51. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -1
  52. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_file-upload.scss +4 -1
  53. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +4 -1
  54. data/node_modules/govuk-frontend/dist/govuk/components/footer/_footer.scss +4 -1
  55. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +2 -0
  56. data/node_modules/govuk-frontend/dist/govuk/components/header/_header.scss +4 -1
  57. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +2 -0
  58. data/node_modules/govuk-frontend/dist/govuk/components/hint/_hint.scss +4 -1
  59. data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +2 -0
  60. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +2 -0
  61. data/node_modules/govuk-frontend/dist/govuk/components/input/_input.scss +4 -1
  62. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +5 -1
  63. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_inset-text.scss +4 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/label/_index.scss +3 -1
  65. data/node_modules/govuk-frontend/dist/govuk/components/label/_label.scss +4 -1
  66. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +6 -2
  67. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_notification-banner.scss +4 -1
  68. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +2 -0
  69. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_pagination.scss +4 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +3 -1
  71. data/node_modules/govuk-frontend/dist/govuk/components/panel/_panel.scss +4 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -0
  73. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_password-input.scss +4 -1
  74. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +3 -1
  75. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_phase-banner.scss +4 -1
  76. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +14 -10
  77. data/node_modules/govuk-frontend/dist/govuk/components/radios/_radios.scss +4 -1
  78. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +2 -0
  79. data/node_modules/govuk-frontend/dist/govuk/components/select/_select.scss +4 -1
  80. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +5 -1
  81. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -1
  82. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +7 -3
  83. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_skip-link.scss +4 -1
  84. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +15 -2
  85. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_summary-list.scss +4 -1
  86. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +4 -1
  87. data/node_modules/govuk-frontend/dist/govuk/components/table/_table.scss +4 -1
  88. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +5 -2
  89. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_tabs.scss +4 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +4 -1
  91. data/node_modules/govuk-frontend/dist/govuk/components/tag/_tag.scss +4 -1
  92. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +6 -2
  93. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_task-list.scss +4 -1
  94. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +2 -0
  95. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_textarea.scss +4 -1
  96. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +3 -1
  97. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_warning-text.scss +4 -1
  98. data/node_modules/govuk-frontend/dist/govuk/core/_global-styles.scss +4 -0
  99. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +4 -0
  100. data/node_modules/govuk-frontend/dist/govuk/core/_links.scss +8 -0
  101. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +10 -1
  102. data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +5 -0
  103. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +14 -13
  104. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +1 -1
  105. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +5 -0
  106. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  107. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +38 -70
  108. data/node_modules/govuk-frontend/dist/govuk/helpers/_device-pixels.scss +2 -0
  109. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +1 -1
  110. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +3 -2
  111. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +4 -4
  112. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +17 -15
  113. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +2 -2
  114. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +19 -13
  115. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +48 -26
  116. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +13 -11
  117. data/node_modules/govuk-frontend/dist/govuk/objects/_grid.scss +4 -2
  118. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +10 -9
  119. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +2 -0
  120. data/node_modules/govuk-frontend/dist/govuk/overrides/_index.scss +3 -0
  121. data/node_modules/govuk-frontend/dist/govuk/overrides/_spacing.scss +5 -1
  122. data/node_modules/govuk-frontend/dist/govuk/overrides/_text-align.scss +2 -0
  123. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +7 -2
  124. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +3 -0
  125. data/node_modules/govuk-frontend/dist/govuk/settings/_assets.scss +18 -0
  126. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +28 -4
  127. data/node_modules/govuk-frontend/dist/govuk/settings/_links.scss +3 -2
  128. data/node_modules/govuk-frontend/dist/govuk/settings/_measurements.scss +8 -16
  129. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-font.scss +4 -1
  130. data/node_modules/govuk-frontend/dist/govuk/settings/_warnings.scss +15 -2
  131. data/node_modules/govuk-frontend/dist/govuk/tools/_exports.scss +3 -2
  132. data/node_modules/govuk-frontend/dist/govuk/tools/_font-url.scss +13 -5
  133. data/node_modules/govuk-frontend/dist/govuk/tools/_if.scss +24 -0
  134. data/node_modules/govuk-frontend/dist/govuk/tools/_image-url.scss +13 -5
  135. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
  136. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +5 -3
  137. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +4 -2
  138. data/node_modules/govuk-frontend/dist/govuk/utilities/_clearfix.scss +3 -0
  139. data/node_modules/govuk-frontend/dist/govuk/utilities/_index.scss +1 -0
  140. data/node_modules/govuk-frontend/dist/govuk/utilities/_visually-hidden.scss +3 -0
  141. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +3 -1
  142. data/package-lock.json +1302 -4959
  143. data/package.json +5 -4
  144. metadata +74 -80
  145. data/.github/ISSUE_TEMPLATE.md +0 -13
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group settings/warnings
3
3
  ////
4
+ @use "sass:list";
4
5
 
5
6
  /// Suppressed warnings map
6
7
  ///
@@ -51,18 +52,30 @@ $govuk-suppressed-warnings: () !default;
51
52
  @warn _warning-text($key, $message);
52
53
 
53
54
  @if $silence-further-warnings {
54
- $govuk-suppressed-warnings: append($govuk-suppressed-warnings, $key) !global;
55
+ $govuk-suppressed-warnings: list.append($govuk-suppressed-warnings, $key) !global;
55
56
  }
56
57
  }
57
58
  }
58
59
 
60
+ /// Logs a deprecation warning that the given component's `<COMPONENT_NAME>.scss` file is deprecated
61
+ ///
62
+ /// @param {string} $component-name - The name of component, as it appears in the folder gathering its files
63
+ /// @access private
64
+ @mixin _component-scss-file-warning($component-name) {
65
+ $component-path: "<PATH_TO_GOVUK_FRONTEND>/components/#{$component-name}";
66
+
67
+ $message: "Importing `#{$component-path}/#{$component-name}` is deprecated." + " Import `#{$component-path}` instead.";
68
+
69
+ @include _warning("component-scss-files", $message, $silence-further-warnings: false);
70
+ }
71
+
59
72
  /// Check whether a key is present in the suppressed warnings list.
60
73
  ///
61
74
  /// @param {String} $key - The key to be checked against `$govuk-suppressed-warnings`.
62
75
  /// @access private
63
76
 
64
77
  @function _should-warn($key) {
65
- @return index($govuk-suppressed-warnings, $key) == null;
78
+ @return list.index($govuk-suppressed-warnings, $key) == null;
66
79
  }
67
80
 
68
81
  /// Format a warning by appending information on how to suppress it.
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group tools
3
3
  ////
4
+ @use "sass:list";
4
5
 
5
6
  /// List of modules which have already been exported
6
7
  ///
@@ -22,9 +23,9 @@ $_govuk-imported-modules: () !default;
22
23
 
23
24
  @mixin govuk-exports($name) {
24
25
  // If the mixin is not in the list of modules already exported...
25
- @if not index($_govuk-imported-modules, $name) {
26
+ @if not list.index($_govuk-imported-modules, $name) {
26
27
  // ... then add it to the list
27
- $_govuk-imported-modules: append($_govuk-imported-modules, $name) !global;
28
+ $_govuk-imported-modules: list.append($_govuk-imported-modules, $name) !global;
28
29
  // ... and output the CSS for that module
29
30
  @content;
30
31
  }
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group tools/assets
3
3
  ////
4
+ @use "sass:meta";
4
5
 
5
6
  /// Font URL
6
7
  ///
@@ -14,12 +15,19 @@
14
15
 
15
16
  @function govuk-font-url($filename) {
16
17
  // prettier-ignore
17
- $use-custom-function: variable-exists("govuk-font-url-function")
18
- and $govuk-font-url-function
19
- and function-exists($govuk-font-url-function);
18
+ $custom-function: meta.variable-exists("govuk-font-url-function")
19
+ and $govuk-font-url-function;
20
20
 
21
- @if $use-custom-function {
22
- @return call(get-function($govuk-font-url-function), $filename);
21
+ @if meta.type-of($custom-function) == "string" {
22
+ @if meta.function-exists($custom-function) {
23
+ $custom-function: meta.get-function($custom-function);
24
+ } @else {
25
+ $custom-function: null;
26
+ }
27
+ }
28
+
29
+ @if $custom-function {
30
+ @return meta.call($custom-function, $filename);
23
31
  } @else {
24
32
  @return url($govuk-fonts-path + $filename);
25
33
  }
@@ -0,0 +1,24 @@
1
+ ////
2
+ /// @group tools/if
3
+ ////
4
+
5
+ /// Inline `if` function
6
+ ///
7
+ /// Replicates the syntax of the original Sass `if` function
8
+ /// to support Sass `>=1.79 <1.95`. Defaults `$if-false` to `null`
9
+ /// when not set.
10
+ ///
11
+ /// @param {Boolean} $condition - The condition
12
+ /// @param {any} $if-true - The value if the condition is met
13
+ /// @param {any} $if-false [null] - The value if the condition is not met, defaults to `null`.
14
+ /// @returns {any} `$if-true` if the condition is met, `$if-false` otherwise.
15
+ /// @access public
16
+ @function govuk-if($condition, $if-true, $if-false: null) {
17
+ @if $condition {
18
+ @return $if-true;
19
+ } @else {
20
+ @return $if-false;
21
+ }
22
+ }
23
+
24
+ /*# sourceMappingURL=_if.scss.map */
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group tools/assets
3
3
  ////
4
+ @use "sass:meta";
4
5
 
5
6
  /// Image URL
6
7
  ///
@@ -14,12 +15,19 @@
14
15
 
15
16
  @function govuk-image-url($filename) {
16
17
  // prettier-ignore
17
- $use-custom-function: variable-exists("govuk-image-url-function")
18
- and $govuk-image-url-function
19
- and function-exists($govuk-image-url-function);
18
+ $custom-function: meta.variable-exists("govuk-image-url-function")
19
+ and $govuk-image-url-function;
20
20
 
21
- @if $use-custom-function {
22
- @return call(get-function($govuk-image-url-function), $filename);
21
+ @if meta.type-of($custom-function) == "string" {
22
+ @if meta.function-exists($custom-function) {
23
+ $custom-function: meta.get-function($custom-function);
24
+ } @else {
25
+ $custom-function: null;
26
+ }
27
+ }
28
+
29
+ @if $custom-function {
30
+ @return meta.call($custom-function, $filename);
23
31
  } @else {
24
32
  @return url($govuk-images-path + $filename);
25
33
  }
@@ -1,5 +1,6 @@
1
1
  @import "exports";
2
2
  @import "font-url";
3
+ @import "if";
3
4
  @import "image-url";
4
5
  @import "px-to-em";
5
6
  @import "px-to-rem";
@@ -2,6 +2,8 @@
2
2
  /// @group tools/unit-conversion
3
3
  ////
4
4
 
5
+ @use "sass:math";
6
+
5
7
  @import "../settings/typography-responsive";
6
8
 
7
9
  /// Convert pixels to em
@@ -12,13 +14,13 @@
12
14
  /// @access public
13
15
 
14
16
  @function govuk-em($value, $context-font-size: $govuk-root-font-size) {
15
- @if unitless($value) {
17
+ @if math.is-unitless($value) {
16
18
  $value: $value * 1px;
17
19
  }
18
- @if unitless($context-font-size) {
20
+ @if math.is-unitless($context-font-size) {
19
21
  $context-font-size: $context-font-size * 1px;
20
22
  }
21
- @return $value / $context-font-size * 1em;
23
+ @return math.div($value, $context-font-size) * 1em;
22
24
  }
23
25
 
24
26
  /*# sourceMappingURL=_px-to-em.scss.map */
@@ -2,6 +2,8 @@
2
2
  /// @group tools/unit-conversion
3
3
  ////
4
4
 
5
+ @use "sass:math";
6
+
5
7
  @import "../settings/typography-responsive";
6
8
 
7
9
  /// Convert pixels to rem
@@ -14,11 +16,11 @@
14
16
  /// @access public
15
17
 
16
18
  @function govuk-px-to-rem($value) {
17
- @if unitless($value) {
19
+ @if math.is-unitless($value) {
18
20
  $value: $value * 1px;
19
21
  }
20
22
 
21
- @return $value / $govuk-root-font-size * 1rem;
23
+ @return math.div($value, $govuk-root-font-size) * 1rem;
22
24
  }
23
25
 
24
26
  /*# sourceMappingURL=_px-to-rem.scss.map */
@@ -1,3 +1,6 @@
1
+ @import "../tools/exports";
2
+ @import "../helpers/clearfix";
3
+
1
4
  @include govuk-exports("govuk/utilities/clearfix") {
2
5
  .govuk-clearfix {
3
6
  @include govuk-clearfix;
@@ -1,3 +1,4 @@
1
+ @import "../tools/exports";
1
2
  @import "clearfix";
2
3
  @import "visually-hidden";
3
4
 
@@ -1,3 +1,6 @@
1
+ @import "../tools/exports";
2
+ @import "../helpers/visually-hidden";
3
+
1
4
  @include govuk-exports("govuk/utilities/visually-hidden") {
2
5
  .govuk-visually-hidden {
3
6
  @include govuk-visually-hidden;
@@ -1,6 +1,8 @@
1
+ @import "../govuk/tools/if";
2
+
1
3
  $govuk-prototype-kit-major-version: 0 !default;
2
4
 
3
- $govuk-assets-path: if(
5
+ $govuk-assets-path: govuk-if(
4
6
  $govuk-prototype-kit-major-version > 12,
5
7
  $govuk-extensions-url-context + "/govuk-frontend/dist/govuk/assets/",
6
8
  "/govuk/assets/"