govuk_tech_docs 5.2.1 → 5.2.2

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +59 -0
  3. data/.npmrc +1 -0
  4. data/CHANGELOG.md +4 -0
  5. data/README.md +2 -1
  6. data/govuk_tech_docs.gemspec +1 -1
  7. data/lib/govuk_tech_docs/version.rb +1 -1
  8. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +97 -72
  9. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +97 -72
  10. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +29 -2
  11. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  12. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +4 -10
  13. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +13 -11
  14. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +13 -11
  15. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +4 -4
  16. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +7 -5
  17. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +7 -5
  18. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +10 -8
  19. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +10 -8
  20. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +1 -1
  21. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +10 -5
  22. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +10 -5
  23. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +8 -12
  24. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +8 -12
  25. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +2 -2
  26. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +9 -7
  27. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +9 -7
  28. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +10 -8
  29. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +10 -8
  30. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +1 -1
  31. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +10 -5
  32. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +10 -5
  33. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +7 -5
  34. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +7 -5
  35. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +4 -0
  36. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +9 -7
  37. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +9 -7
  38. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +10 -5
  39. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +10 -5
  40. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +6 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +10 -5
  42. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +10 -5
  43. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +1 -2
  44. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +12 -19
  45. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +12 -19
  46. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -9
  47. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +12 -13
  48. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +12 -13
  49. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +3 -3
  50. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  51. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +5 -3
  52. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  53. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +31 -2
  54. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +4 -1
  55. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +4 -2
  56. data/node_modules/govuk-frontend/dist/govuk/init.mjs +52 -43
  57. data/package-lock.json +2496 -4409
  58. data/package.json +2 -2
  59. metadata +7 -5
@@ -35,9 +35,6 @@ function formatErrorMessage(Component, message) {
35
35
  * @typedef ComponentWithModuleName
36
36
  * @property {string} moduleName - Name of the component
37
37
  */
38
- /**
39
- * @import { ObjectNested } from './configuration.mjs'
40
- */
41
38
 
42
39
  class GOVUKFrontendError extends Error {
43
40
  constructor(...args) {
@@ -66,7 +63,7 @@ class ConfigError extends GOVUKFrontendError {
66
63
  class ElementError extends GOVUKFrontendError {
67
64
  constructor(messageOrOptions) {
68
65
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
69
- if (typeof messageOrOptions === 'object') {
66
+ if (isObject(messageOrOptions)) {
70
67
  const {
71
68
  component,
72
69
  identifier,
@@ -75,7 +72,9 @@ class ElementError extends GOVUKFrontendError {
75
72
  } = messageOrOptions;
76
73
  message = identifier;
77
74
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
78
- message = formatErrorMessage(component, message);
75
+ if (component) {
76
+ message = formatErrorMessage(component, message);
77
+ }
79
78
  }
80
79
  super(message);
81
80
  this.name = 'ElementError';
@@ -289,6 +288,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
289
288
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
290
289
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
291
290
  */
291
+ /**
292
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
293
+ */
292
294
 
293
295
  class I18n {
294
296
  constructor(translations = {}, config = {}) {
@@ -303,7 +305,7 @@ class I18n {
303
305
  throw new Error('i18n: lookup key missing');
304
306
  }
305
307
  let translation = this.translations[lookupKey];
306
- if (typeof (options == null ? void 0 : options.count) === 'number' && typeof translation === 'object') {
308
+ if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
307
309
  const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
308
310
  if (translationPluralForm) {
309
311
  translation = translationPluralForm;
@@ -346,7 +348,7 @@ class I18n {
346
348
  }
347
349
  const translation = this.translations[lookupKey];
348
350
  const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
349
- if (typeof translation === 'object') {
351
+ if (isObject(translation)) {
350
352
  if (preferredForm in translation) {
351
353
  return preferredForm;
352
354
  } else if ('other' in translation) {
@@ -514,7 +516,6 @@ class FileUpload extends ConfigurableComponent {
514
516
  throw new ElementError(formatErrorMessage(FileUpload, 'File input (`<input type="file">`) attribute (`type`) is not `file`'));
515
517
  }
516
518
  this.$input = $input;
517
- this.$input.setAttribute('hidden', 'true');
518
519
  if (!this.$input.id) {
519
520
  throw new ElementError({
520
521
  component: FileUpload,
@@ -530,6 +531,7 @@ class FileUpload extends ConfigurableComponent {
530
531
  $label.id = `${this.id}-label`;
531
532
  }
532
533
  this.$input.id = `${this.id}-input`;
534
+ this.$input.setAttribute('hidden', 'true');
533
535
  const $button = document.createElement('button');
534
536
  $button.classList.add('govuk-file-upload-button');
535
537
  $button.type = 'button';
@@ -35,7 +35,6 @@ class FileUpload extends ConfigurableComponent {
35
35
  throw new ElementError(formatErrorMessage(FileUpload, 'File input (`<input type="file">`) attribute (`type`) is not `file`'));
36
36
  }
37
37
  this.$input = $input;
38
- this.$input.setAttribute('hidden', 'true');
39
38
  if (!this.$input.id) {
40
39
  throw new ElementError({
41
40
  component: FileUpload,
@@ -51,6 +50,7 @@ class FileUpload extends ConfigurableComponent {
51
50
  $label.id = `${this.id}-label`;
52
51
  }
53
52
  this.$input.id = `${this.id}-input`;
53
+ this.$input.setAttribute('hidden', 'true');
54
54
  const $button = document.createElement('button');
55
55
  $button.classList.add('govuk-file-upload-button');
56
56
  $button.type = 'button';
@@ -31,6 +31,12 @@
31
31
  }
32
32
  return $scope.classList.contains('govuk-frontend-supported');
33
33
  }
34
+ function isArray(option) {
35
+ return Array.isArray(option);
36
+ }
37
+ function isObject(option) {
38
+ return !!option && typeof option === 'object' && !isArray(option);
39
+ }
34
40
  function formatErrorMessage(Component, message) {
35
41
  return `${Component.moduleName}: ${message}`;
36
42
  }
@@ -38,9 +44,6 @@
38
44
  * @typedef ComponentWithModuleName
39
45
  * @property {string} moduleName - Name of the component
40
46
  */
41
- /**
42
- * @import { ObjectNested } from './configuration.mjs'
43
- */
44
47
 
45
48
  class GOVUKFrontendError extends Error {
46
49
  constructor(...args) {
@@ -63,7 +66,7 @@
63
66
  class ElementError extends GOVUKFrontendError {
64
67
  constructor(messageOrOptions) {
65
68
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
66
- if (typeof messageOrOptions === 'object') {
69
+ if (isObject(messageOrOptions)) {
67
70
  const {
68
71
  component,
69
72
  identifier,
@@ -72,7 +75,9 @@
72
75
  } = messageOrOptions;
73
76
  message = identifier;
74
77
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
75
- message = formatErrorMessage(component, message);
78
+ if (component) {
79
+ message = formatErrorMessage(component, message);
80
+ }
76
81
  }
77
82
  super(message);
78
83
  this.name = 'ElementError';
@@ -25,6 +25,12 @@ function isSupported($scope = document.body) {
25
25
  }
26
26
  return $scope.classList.contains('govuk-frontend-supported');
27
27
  }
28
+ function isArray(option) {
29
+ return Array.isArray(option);
30
+ }
31
+ function isObject(option) {
32
+ return !!option && typeof option === 'object' && !isArray(option);
33
+ }
28
34
  function formatErrorMessage(Component, message) {
29
35
  return `${Component.moduleName}: ${message}`;
30
36
  }
@@ -32,9 +38,6 @@ function formatErrorMessage(Component, message) {
32
38
  * @typedef ComponentWithModuleName
33
39
  * @property {string} moduleName - Name of the component
34
40
  */
35
- /**
36
- * @import { ObjectNested } from './configuration.mjs'
37
- */
38
41
 
39
42
  class GOVUKFrontendError extends Error {
40
43
  constructor(...args) {
@@ -57,7 +60,7 @@ class SupportError extends GOVUKFrontendError {
57
60
  class ElementError extends GOVUKFrontendError {
58
61
  constructor(messageOrOptions) {
59
62
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
60
- if (typeof messageOrOptions === 'object') {
63
+ if (isObject(messageOrOptions)) {
61
64
  const {
62
65
  component,
63
66
  identifier,
@@ -66,7 +69,9 @@ class ElementError extends GOVUKFrontendError {
66
69
  } = messageOrOptions;
67
70
  message = identifier;
68
71
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
69
- message = formatErrorMessage(component, message);
72
+ if (component) {
73
+ message = formatErrorMessage(component, message);
74
+ }
70
75
  }
71
76
  super(message);
72
77
  this.name = 'ElementError';
@@ -60,9 +60,6 @@
60
60
  * @typedef ComponentWithModuleName
61
61
  * @property {string} moduleName - Name of the component
62
62
  */
63
- /**
64
- * @import { ObjectNested } from './configuration.mjs'
65
- */
66
63
 
67
64
  class GOVUKFrontendError extends Error {
68
65
  constructor(...args) {
@@ -91,7 +88,7 @@
91
88
  class ElementError extends GOVUKFrontendError {
92
89
  constructor(messageOrOptions) {
93
90
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
94
- if (typeof messageOrOptions === 'object') {
91
+ if (isObject(messageOrOptions)) {
95
92
  const {
96
93
  component,
97
94
  identifier,
@@ -100,7 +97,9 @@
100
97
  } = messageOrOptions;
101
98
  message = identifier;
102
99
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
103
- message = formatErrorMessage(component, message);
100
+ if (component) {
101
+ message = formatErrorMessage(component, message);
102
+ }
104
103
  }
105
104
  super(message);
106
105
  this.name = 'ElementError';
@@ -314,6 +313,9 @@
314
313
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
315
314
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
316
315
  */
316
+ /**
317
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
318
+ */
317
319
 
318
320
  /**
319
321
  * Notification Banner component
@@ -54,9 +54,6 @@ function formatErrorMessage(Component, message) {
54
54
  * @typedef ComponentWithModuleName
55
55
  * @property {string} moduleName - Name of the component
56
56
  */
57
- /**
58
- * @import { ObjectNested } from './configuration.mjs'
59
- */
60
57
 
61
58
  class GOVUKFrontendError extends Error {
62
59
  constructor(...args) {
@@ -85,7 +82,7 @@ class ConfigError extends GOVUKFrontendError {
85
82
  class ElementError extends GOVUKFrontendError {
86
83
  constructor(messageOrOptions) {
87
84
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
88
- if (typeof messageOrOptions === 'object') {
85
+ if (isObject(messageOrOptions)) {
89
86
  const {
90
87
  component,
91
88
  identifier,
@@ -94,7 +91,9 @@ class ElementError extends GOVUKFrontendError {
94
91
  } = messageOrOptions;
95
92
  message = identifier;
96
93
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
97
- message = formatErrorMessage(component, message);
94
+ if (component) {
95
+ message = formatErrorMessage(component, message);
96
+ }
98
97
  }
99
98
  super(message);
100
99
  this.name = 'ElementError';
@@ -308,6 +307,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
308
307
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
309
308
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
310
309
  */
310
+ /**
311
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
312
+ */
311
313
 
312
314
  /**
313
315
  * Notification Banner component
@@ -147,6 +147,10 @@
147
147
  }
148
148
  }
149
149
 
150
+ .govuk-pagination__link-title {
151
+ text-decoration-thickness: inherit;
152
+ }
153
+
150
154
  .govuk-pagination__link-label {
151
155
  @include govuk-typography-weight-regular;
152
156
  @include govuk-link-decoration;
@@ -41,9 +41,6 @@
41
41
  * @typedef ComponentWithModuleName
42
42
  * @property {string} moduleName - Name of the component
43
43
  */
44
- /**
45
- * @import { ObjectNested } from './configuration.mjs'
46
- */
47
44
 
48
45
  class GOVUKFrontendError extends Error {
49
46
  constructor(...args) {
@@ -72,7 +69,7 @@
72
69
  class ElementError extends GOVUKFrontendError {
73
70
  constructor(messageOrOptions) {
74
71
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
75
- if (typeof messageOrOptions === 'object') {
72
+ if (isObject(messageOrOptions)) {
76
73
  const {
77
74
  component,
78
75
  identifier,
@@ -81,7 +78,9 @@
81
78
  } = messageOrOptions;
82
79
  message = identifier;
83
80
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
84
- message = formatErrorMessage(component, message);
81
+ if (component) {
82
+ message = formatErrorMessage(component, message);
83
+ }
85
84
  }
86
85
  super(message);
87
86
  this.name = 'ElementError';
@@ -295,6 +294,9 @@
295
294
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
296
295
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
297
296
  */
297
+ /**
298
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
299
+ */
298
300
 
299
301
  class I18n {
300
302
  constructor(translations = {}, config = {}) {
@@ -309,7 +311,7 @@
309
311
  throw new Error('i18n: lookup key missing');
310
312
  }
311
313
  let translation = this.translations[lookupKey];
312
- if (typeof (options == null ? void 0 : options.count) === 'number' && typeof translation === 'object') {
314
+ if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
313
315
  const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
314
316
  if (translationPluralForm) {
315
317
  translation = translationPluralForm;
@@ -352,7 +354,7 @@
352
354
  }
353
355
  const translation = this.translations[lookupKey];
354
356
  const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
355
- if (typeof translation === 'object') {
357
+ if (isObject(translation)) {
356
358
  if (preferredForm in translation) {
357
359
  return preferredForm;
358
360
  } else if ('other' in translation) {
@@ -35,9 +35,6 @@ function formatErrorMessage(Component, message) {
35
35
  * @typedef ComponentWithModuleName
36
36
  * @property {string} moduleName - Name of the component
37
37
  */
38
- /**
39
- * @import { ObjectNested } from './configuration.mjs'
40
- */
41
38
 
42
39
  class GOVUKFrontendError extends Error {
43
40
  constructor(...args) {
@@ -66,7 +63,7 @@ class ConfigError extends GOVUKFrontendError {
66
63
  class ElementError extends GOVUKFrontendError {
67
64
  constructor(messageOrOptions) {
68
65
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
69
- if (typeof messageOrOptions === 'object') {
66
+ if (isObject(messageOrOptions)) {
70
67
  const {
71
68
  component,
72
69
  identifier,
@@ -75,7 +72,9 @@ class ElementError extends GOVUKFrontendError {
75
72
  } = messageOrOptions;
76
73
  message = identifier;
77
74
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
78
- message = formatErrorMessage(component, message);
75
+ if (component) {
76
+ message = formatErrorMessage(component, message);
77
+ }
79
78
  }
80
79
  super(message);
81
80
  this.name = 'ElementError';
@@ -289,6 +288,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
289
288
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
290
289
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
291
290
  */
291
+ /**
292
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
293
+ */
292
294
 
293
295
  class I18n {
294
296
  constructor(translations = {}, config = {}) {
@@ -303,7 +305,7 @@ class I18n {
303
305
  throw new Error('i18n: lookup key missing');
304
306
  }
305
307
  let translation = this.translations[lookupKey];
306
- if (typeof (options == null ? void 0 : options.count) === 'number' && typeof translation === 'object') {
308
+ if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
307
309
  const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
308
310
  if (translationPluralForm) {
309
311
  translation = translationPluralForm;
@@ -346,7 +348,7 @@ class I18n {
346
348
  }
347
349
  const translation = this.translations[lookupKey];
348
350
  const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
349
- if (typeof translation === 'object') {
351
+ if (isObject(translation)) {
350
352
  if (preferredForm in translation) {
351
353
  return preferredForm;
352
354
  } else if ('other' in translation) {
@@ -23,6 +23,12 @@
23
23
  }
24
24
  return $scope.classList.contains('govuk-frontend-supported');
25
25
  }
26
+ function isArray(option) {
27
+ return Array.isArray(option);
28
+ }
29
+ function isObject(option) {
30
+ return !!option && typeof option === 'object' && !isArray(option);
31
+ }
26
32
  function formatErrorMessage(Component, message) {
27
33
  return `${Component.moduleName}: ${message}`;
28
34
  }
@@ -30,9 +36,6 @@
30
36
  * @typedef ComponentWithModuleName
31
37
  * @property {string} moduleName - Name of the component
32
38
  */
33
- /**
34
- * @import { ObjectNested } from './configuration.mjs'
35
- */
36
39
 
37
40
  class GOVUKFrontendError extends Error {
38
41
  constructor(...args) {
@@ -55,7 +58,7 @@
55
58
  class ElementError extends GOVUKFrontendError {
56
59
  constructor(messageOrOptions) {
57
60
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
58
- if (typeof messageOrOptions === 'object') {
61
+ if (isObject(messageOrOptions)) {
59
62
  const {
60
63
  component,
61
64
  identifier,
@@ -64,7 +67,9 @@
64
67
  } = messageOrOptions;
65
68
  message = identifier;
66
69
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
67
- message = formatErrorMessage(component, message);
70
+ if (component) {
71
+ message = formatErrorMessage(component, message);
72
+ }
68
73
  }
69
74
  super(message);
70
75
  this.name = 'ElementError';
@@ -17,6 +17,12 @@ function isSupported($scope = document.body) {
17
17
  }
18
18
  return $scope.classList.contains('govuk-frontend-supported');
19
19
  }
20
+ function isArray(option) {
21
+ return Array.isArray(option);
22
+ }
23
+ function isObject(option) {
24
+ return !!option && typeof option === 'object' && !isArray(option);
25
+ }
20
26
  function formatErrorMessage(Component, message) {
21
27
  return `${Component.moduleName}: ${message}`;
22
28
  }
@@ -24,9 +30,6 @@ function formatErrorMessage(Component, message) {
24
30
  * @typedef ComponentWithModuleName
25
31
  * @property {string} moduleName - Name of the component
26
32
  */
27
- /**
28
- * @import { ObjectNested } from './configuration.mjs'
29
- */
30
33
 
31
34
  class GOVUKFrontendError extends Error {
32
35
  constructor(...args) {
@@ -49,7 +52,7 @@ class SupportError extends GOVUKFrontendError {
49
52
  class ElementError extends GOVUKFrontendError {
50
53
  constructor(messageOrOptions) {
51
54
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
52
- if (typeof messageOrOptions === 'object') {
55
+ if (isObject(messageOrOptions)) {
53
56
  const {
54
57
  component,
55
58
  identifier,
@@ -58,7 +61,9 @@ class ElementError extends GOVUKFrontendError {
58
61
  } = messageOrOptions;
59
62
  message = identifier;
60
63
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
61
- message = formatErrorMessage(component, message);
64
+ if (component) {
65
+ message = formatErrorMessage(component, message);
66
+ }
62
67
  }
63
68
  super(message);
64
69
  this.name = 'ElementError';
@@ -214,6 +214,11 @@
214
214
  @include _govuk-rebrand {
215
215
  // Remove bottom border to add width-container ones
216
216
  border-bottom: none;
217
+
218
+ // Set colour here so non-link text (service name, slot content) can
219
+ // use it too.
220
+ color: govuk-colour("white");
221
+
217
222
  background-color: $govuk-brand-colour;
218
223
 
219
224
  .govuk-width-container {
@@ -240,7 +245,7 @@
240
245
 
241
246
  // Override mobile menu toggle colour when not focused
242
247
  .govuk-service-navigation__toggle:not(:focus) {
243
- color: govuk-colour("white");
248
+ color: currentcolor;
244
249
  }
245
250
  }
246
251
  }
@@ -31,6 +31,12 @@
31
31
  }
32
32
  return $scope.classList.contains('govuk-frontend-supported');
33
33
  }
34
+ function isArray(option) {
35
+ return Array.isArray(option);
36
+ }
37
+ function isObject(option) {
38
+ return !!option && typeof option === 'object' && !isArray(option);
39
+ }
34
40
  function formatErrorMessage(Component, message) {
35
41
  return `${Component.moduleName}: ${message}`;
36
42
  }
@@ -38,9 +44,6 @@
38
44
  * @typedef ComponentWithModuleName
39
45
  * @property {string} moduleName - Name of the component
40
46
  */
41
- /**
42
- * @import { ObjectNested } from './configuration.mjs'
43
- */
44
47
 
45
48
  class GOVUKFrontendError extends Error {
46
49
  constructor(...args) {
@@ -63,7 +66,7 @@
63
66
  class ElementError extends GOVUKFrontendError {
64
67
  constructor(messageOrOptions) {
65
68
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
66
- if (typeof messageOrOptions === 'object') {
69
+ if (isObject(messageOrOptions)) {
67
70
  const {
68
71
  component,
69
72
  identifier,
@@ -72,7 +75,9 @@
72
75
  } = messageOrOptions;
73
76
  message = identifier;
74
77
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
75
- message = formatErrorMessage(component, message);
78
+ if (component) {
79
+ message = formatErrorMessage(component, message);
80
+ }
76
81
  }
77
82
  super(message);
78
83
  this.name = 'ElementError';
@@ -25,6 +25,12 @@ function isSupported($scope = document.body) {
25
25
  }
26
26
  return $scope.classList.contains('govuk-frontend-supported');
27
27
  }
28
+ function isArray(option) {
29
+ return Array.isArray(option);
30
+ }
31
+ function isObject(option) {
32
+ return !!option && typeof option === 'object' && !isArray(option);
33
+ }
28
34
  function formatErrorMessage(Component, message) {
29
35
  return `${Component.moduleName}: ${message}`;
30
36
  }
@@ -32,9 +38,6 @@ function formatErrorMessage(Component, message) {
32
38
  * @typedef ComponentWithModuleName
33
39
  * @property {string} moduleName - Name of the component
34
40
  */
35
- /**
36
- * @import { ObjectNested } from './configuration.mjs'
37
- */
38
41
 
39
42
  class GOVUKFrontendError extends Error {
40
43
  constructor(...args) {
@@ -57,7 +60,7 @@ class SupportError extends GOVUKFrontendError {
57
60
  class ElementError extends GOVUKFrontendError {
58
61
  constructor(messageOrOptions) {
59
62
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
60
- if (typeof messageOrOptions === 'object') {
63
+ if (isObject(messageOrOptions)) {
61
64
  const {
62
65
  component,
63
66
  identifier,
@@ -66,7 +69,9 @@ class ElementError extends GOVUKFrontendError {
66
69
  } = messageOrOptions;
67
70
  message = identifier;
68
71
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
69
- message = formatErrorMessage(component, message);
72
+ if (component) {
73
+ message = formatErrorMessage(component, message);
74
+ }
70
75
  }
71
76
  super(message);
72
77
  this.name = 'ElementError';
@@ -1,10 +1,9 @@
1
1
  @include govuk-exports("govuk/component/skip-link") {
2
2
  .govuk-skip-link {
3
3
  @include govuk-visually-hidden-focusable;
4
- @include govuk-typography-common;
5
4
  @include govuk-link-decoration;
6
5
  @include govuk-link-style-text;
7
- @include govuk-font-size($size: 16);
6
+ @include govuk-font($size: 16);
8
7
 
9
8
  display: block;
10
9
  padding: govuk-spacing(2) govuk-spacing(3);
@@ -4,12 +4,6 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function getFragmentFromUrl(url) {
8
- if (!url.includes('#')) {
9
- return undefined;
10
- }
11
- return url.split('#').pop();
12
- }
13
7
  function setFocus($element, options = {}) {
14
8
  var _options$onBeforeFocu;
15
9
  const isFocusable = $element.getAttribute('tabindex');
@@ -53,6 +47,12 @@
53
47
  }
54
48
  return $scope.classList.contains('govuk-frontend-supported');
55
49
  }
50
+ function isArray(option) {
51
+ return Array.isArray(option);
52
+ }
53
+ function isObject(option) {
54
+ return !!option && typeof option === 'object' && !isArray(option);
55
+ }
56
56
  function formatErrorMessage(Component, message) {
57
57
  return `${Component.moduleName}: ${message}`;
58
58
  }
@@ -60,9 +60,6 @@
60
60
  * @typedef ComponentWithModuleName
61
61
  * @property {string} moduleName - Name of the component
62
62
  */
63
- /**
64
- * @import { ObjectNested } from './configuration.mjs'
65
- */
66
63
 
67
64
  class GOVUKFrontendError extends Error {
68
65
  constructor(...args) {
@@ -85,7 +82,7 @@
85
82
  class ElementError extends GOVUKFrontendError {
86
83
  constructor(messageOrOptions) {
87
84
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
88
- if (typeof messageOrOptions === 'object') {
85
+ if (isObject(messageOrOptions)) {
89
86
  const {
90
87
  component,
91
88
  identifier,
@@ -94,7 +91,9 @@
94
91
  } = messageOrOptions;
95
92
  message = identifier;
96
93
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
97
- message = formatErrorMessage(component, message);
94
+ if (component) {
95
+ message = formatErrorMessage(component, message);
96
+ }
98
97
  }
99
98
  super(message);
100
99
  this.name = 'ElementError';
@@ -184,16 +183,10 @@
184
183
  super($root);
185
184
  const hash = this.$root.hash;
186
185
  const href = (_this$$root$getAttrib = this.$root.getAttribute('href')) != null ? _this$$root$getAttrib : '';
187
- let url;
188
- try {
189
- url = new window.URL(this.$root.href);
190
- } catch (error) {
191
- throw new ElementError(`Skip link: Target link (\`href="${href}"\`) is invalid`);
192
- }
193
- if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) {
186
+ if (this.$root.origin !== window.location.origin || this.$root.pathname !== window.location.pathname) {
194
187
  return;
195
188
  }
196
- const linkedElementId = getFragmentFromUrl(hash);
189
+ const linkedElementId = hash.replace('#', '');
197
190
  if (!linkedElementId) {
198
191
  throw new ElementError(`Skip link: Target link (\`href="${href}"\`) has no hash fragment`);
199
192
  }