govuk_tech_docs 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -0
  4. data/lib/govuk_tech_docs/version.rb +1 -1
  5. data/lib/source/favicon.ico +0 -0
  6. data/lib/source/layouts/_header.erb +13 -15
  7. data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
  8. data/node_modules/govuk-frontend/govuk/all.js +4918 -3796
  9. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +54 -49
  10. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
  11. data/node_modules/govuk-frontend/govuk/common/index.js +172 -152
  12. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +334 -321
  13. data/node_modules/govuk-frontend/govuk/common.js +171 -151
  14. data/node_modules/govuk-frontend/govuk/components/_all.scss +3 -2
  15. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +26 -7
  16. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +2203 -1650
  17. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +24 -16
  18. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +34 -11
  19. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +49 -9
  20. data/node_modules/govuk-frontend/govuk/components/button/button.js +961 -916
  21. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +2142 -2038
  22. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
  23. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +1204 -1145
  24. data/node_modules/govuk-frontend/govuk/components/details/details.js +826 -799
  25. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +1097 -1044
  26. data/node_modules/govuk-frontend/govuk/components/exit-this-page/_exit-this-page.scss +2 -0
  27. data/node_modules/govuk-frontend/govuk/components/exit-this-page/_index.scss +97 -0
  28. data/node_modules/govuk-frontend/govuk/components/exit-this-page/exit-this-page.js +2120 -0
  29. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
  30. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
  31. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +6 -0
  32. data/node_modules/govuk-frontend/govuk/components/header/header.js +683 -1003
  33. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
  34. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +786 -751
  35. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
  36. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +1151 -1105
  37. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
  38. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1045 -1014
  39. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +107 -0
  40. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +1514 -1268
  41. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
  42. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
  43. data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
  44. data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
  45. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
  46. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
  47. data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
  48. data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +12 -0
  49. data/node_modules/govuk-frontend/govuk/i18n.js +371 -364
  50. data/node_modules/govuk-frontend/govuk/objects/_template.scss +20 -0
  51. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
  52. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
  53. data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
  54. data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
  55. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +5 -5
  56. data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
  57. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +243 -241
  58. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +14 -12
  59. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +18 -16
  60. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +553 -545
  61. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +40 -36
  62. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +257 -250
  63. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +22 -20
  64. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +204 -197
  65. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +204 -197
  66. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +109 -105
  67. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +407 -399
  68. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +242 -238
  69. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +73 -71
  70. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +15 -13
  71. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +18 -16
  72. data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
  73. data/package-lock.json +7 -7
  74. data/package.json +1 -1
  75. metadata +8 -3
@@ -1,70 +1,75 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
- (factory((global.GOVUKFrontend = {})));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
+ (factory((global.GOVUKFrontend = {})));
5
5
  }(this, (function (exports) { 'use strict';
6
6
 
7
- (function(undefined) {
7
+ // @ts-nocheck
8
+ (function (undefined) {
8
9
 
9
- // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/detect.js
10
- var detect = (
11
- 'document' in this && "matches" in document.documentElement
12
- );
10
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/detect.js
11
+ var detect = (
12
+ 'document' in this && "matches" in document.documentElement
13
+ );
13
14
 
14
- if (detect) return
15
+ if (detect) return
15
16
 
16
- // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/polyfill.js
17
- Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function matches(selector) {
18
- var element = this;
19
- var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
20
- var index = 0;
17
+ // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/polyfill.js
18
+ Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function matches(selector) {
19
+ var element = this;
20
+ var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
21
+ var index = 0;
21
22
 
22
- while (elements[index] && elements[index] !== element) {
23
- ++index;
24
- }
23
+ while (elements[index] && elements[index] !== element) {
24
+ ++index;
25
+ }
25
26
 
26
- return !!elements[index];
27
- };
27
+ return !!elements[index];
28
+ };
28
29
 
29
- }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
30
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
30
31
 
31
- (function(undefined) {
32
+ // @ts-nocheck
32
33
 
33
- // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/detect.js
34
- var detect = (
35
- 'document' in this && "closest" in document.documentElement
36
- );
34
+ (function(undefined) {
37
35
 
38
- if (detect) return
36
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/detect.js
37
+ var detect = (
38
+ 'document' in this && "closest" in document.documentElement
39
+ );
39
40
 
40
- // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/polyfill.js
41
- Element.prototype.closest = function closest(selector) {
42
- var node = this;
41
+ if (detect) return
43
42
 
44
- while (node) {
45
- if (node.matches(selector)) return node;
46
- else node = 'SVGElement' in window && node instanceof SVGElement ? node.parentNode : node.parentElement;
47
- }
43
+ // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/polyfill.js
44
+ Element.prototype.closest = function closest(selector) {
45
+ var node = this;
48
46
 
49
- return null;
50
- };
47
+ while (node) {
48
+ if (node.matches(selector)) return node;
49
+ else node = 'SVGElement' in window && node instanceof SVGElement ? node.parentNode : node.parentElement;
50
+ }
51
51
 
52
- }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
52
+ return null;
53
+ };
53
54
 
54
- /**
55
- * Returns the value of the given attribute closest to the given element (including itself)
56
- *
57
- * @param {HTMLElement} $element - The element to start walking the DOM tree up
58
- * @param {string} attributeName - The name of the attribute
59
- * @returns {string | undefined} Attribute value
60
- */
61
- function closestAttributeValue ($element, attributeName) {
62
- var closestElementWithAttribute = $element.closest('[' + attributeName + ']');
63
- if (closestElementWithAttribute) {
64
- return closestElementWithAttribute.getAttribute(attributeName)
55
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
56
+
57
+ /**
58
+ * Returns the value of the given attribute closest to the given element (including itself)
59
+ *
60
+ * @deprecated Will be made private in v5.0
61
+ * @param {Element} $element - The element to start walking the DOM tree up
62
+ * @param {string} attributeName - The name of the attribute
63
+ * @returns {string | null} Attribute value
64
+ */
65
+ function closestAttributeValue ($element, attributeName) {
66
+ var $closestElementWithAttribute = $element.closest('[' + attributeName + ']');
67
+ return $closestElementWithAttribute
68
+ ? $closestElementWithAttribute.getAttribute(attributeName)
69
+ : null
65
70
  }
66
- }
67
71
 
68
- exports.closestAttributeValue = closestAttributeValue;
72
+ exports.closestAttributeValue = closestAttributeValue;
69
73
 
70
74
  })));
75
+ //# sourceMappingURL=closest-attribute-value.js.map
@@ -0,0 +1,17 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
+ (factory((global.GOVUKFrontend = {})));
5
+ }(this, (function (exports) { 'use strict';
6
+
7
+ /*
8
+ * This variable is automatically overwritten during builds and releases.
9
+ * It doesn't need to be updated manually.
10
+ */
11
+
12
+ var version = '4.7.0';
13
+
14
+ exports.version = version;
15
+
16
+ })));
17
+ //# sourceMappingURL=govuk-frontend-version.js.map
@@ -1,172 +1,192 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
- (factory((global.GOVUKFrontend = {})));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
+ (factory((global.GOVUKFrontend = {})));
5
5
  }(this, (function (exports) { 'use strict';
6
6
 
7
- /**
8
- * Common helpers which do not require polyfill.
9
- *
10
- * IMPORTANT: If a helper require a polyfill, please isolate it in its own module
11
- * so that the polyfill can be properly tree-shaken and does not burden
12
- * the components that do not need that helper
13
- *
14
- * @module common/index
15
- */
16
-
17
- /**
18
- * TODO: Ideally this would be a NodeList.prototype.forEach polyfill
19
- * This seems to fail in IE8, requires more investigation.
20
- * See: https://github.com/imagitama/nodelist-foreach-polyfill
21
- *
22
- * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
23
- * @param {nodeListIterator} callback - Callback function to run for each node
24
- * @returns {undefined}
25
- */
26
- function nodeListForEach (nodes, callback) {
27
- if (window.NodeList.prototype.forEach) {
28
- return nodes.forEach(callback)
29
- }
30
- for (var i = 0; i < nodes.length; i++) {
31
- callback.call(window, nodes[i], i, nodes);
7
+ /**
8
+ * Common helpers which do not require polyfill.
9
+ *
10
+ * IMPORTANT: If a helper require a polyfill, please isolate it in its own module
11
+ * so that the polyfill can be properly tree-shaken and does not burden
12
+ * the components that do not need that helper
13
+ *
14
+ * @module common/index
15
+ */
16
+
17
+ /**
18
+ * TODO: Ideally this would be a NodeList.prototype.forEach polyfill
19
+ * This seems to fail in IE8, requires more investigation.
20
+ * See: https://github.com/imagitama/nodelist-foreach-polyfill
21
+ *
22
+ * @deprecated Will be made private in v5.0
23
+ * @template {Node} ElementType
24
+ * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
25
+ * @param {nodeListIterator<ElementType>} callback - Callback function to run for each node
26
+ * @returns {void}
27
+ */
28
+ function nodeListForEach (nodes, callback) {
29
+ if (window.NodeList.prototype.forEach) {
30
+ return nodes.forEach(callback)
31
+ }
32
+ for (var i = 0; i < nodes.length; i++) {
33
+ callback.call(window, nodes[i], i, nodes);
34
+ }
32
35
  }
33
- }
34
-
35
- /**
36
- * Used to generate a unique string, allows multiple instances of the component
37
- * without them conflicting with each other.
38
- * https://stackoverflow.com/a/8809472
39
- *
40
- * @returns {string} Unique ID
41
- */
42
- function generateUniqueID () {
43
- var d = new Date().getTime();
44
- if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
45
- d += window.performance.now(); // use high-precision timer if available
36
+
37
+ /**
38
+ * Used to generate a unique string, allows multiple instances of the component
39
+ * without them conflicting with each other.
40
+ * https://stackoverflow.com/a/8809472
41
+ *
42
+ * @deprecated Will be made private in v5.0
43
+ * @returns {string} Unique ID
44
+ */
45
+ function generateUniqueID () {
46
+ var d = new Date().getTime();
47
+ if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
48
+ d += window.performance.now(); // use high-precision timer if available
49
+ }
50
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
51
+ var r = (d + Math.random() * 16) % 16 | 0;
52
+ d = Math.floor(d / 16);
53
+ return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
54
+ })
46
55
  }
47
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
48
- var r = (d + Math.random() * 16) % 16 | 0;
49
- d = Math.floor(d / 16);
50
- return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
51
- })
52
- }
53
-
54
- /**
55
- * Config flattening function
56
- *
57
- * Takes any number of objects, flattens them into namespaced key-value pairs,
58
- * (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
59
- * greatest priority on the LAST item passed in.
60
- *
61
- * @returns {object} A flattened object of key-value pairs.
62
- */
63
- function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
56
+
64
57
  /**
65
- * Function to take nested objects and flatten them to a dot-separated keyed
66
- * object. Doing this means we don't need to do any deep/recursive merging of
67
- * each of our objects, nor transform our dataset from a flat list into a
68
- * nested object.
58
+ * Config flattening function
59
+ *
60
+ * Takes any number of objects, flattens them into namespaced key-value pairs,
61
+ * (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
62
+ * greatest priority on the LAST item passed in.
69
63
  *
70
- * @param {object} configObject - Deeply nested object
71
- * @returns {object} Flattened object with dot-separated keys
64
+ * @deprecated Will be made private in v5.0
65
+ * @returns {Object<string, unknown>} A flattened object of key-value pairs.
72
66
  */
73
- var flattenObject = function (configObject) {
74
- // Prepare an empty return object
75
- var flattenedObject = {};
76
-
77
- // Our flattening function, this is called recursively for each level of
78
- // depth in the object. At each level we prepend the previous level names to
79
- // the key using `prefix`.
80
- var flattenLoop = function (obj, prefix) {
81
- // Loop through keys...
82
- for (var key in obj) {
83
- // Check to see if this is a prototypical key/value,
84
- // if it is, skip it.
85
- if (!Object.prototype.hasOwnProperty.call(obj, key)) {
86
- continue
87
- }
88
- var value = obj[key];
89
- var prefixedKey = prefix ? prefix + '.' + key : key;
90
- if (typeof value === 'object') {
91
- // If the value is a nested object, recurse over that too
92
- flattenLoop(value, prefixedKey);
93
- } else {
94
- // Otherwise, add this value to our return object
95
- flattenedObject[prefixedKey] = value;
67
+ function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
68
+ /**
69
+ * Function to take nested objects and flatten them to a dot-separated keyed
70
+ * object. Doing this means we don't need to do any deep/recursive merging of
71
+ * each of our objects, nor transform our dataset from a flat list into a
72
+ * nested object.
73
+ *
74
+ * @param {Object<string, unknown>} configObject - Deeply nested object
75
+ * @returns {Object<string, unknown>} Flattened object with dot-separated keys
76
+ */
77
+ var flattenObject = function (configObject) {
78
+ // Prepare an empty return object
79
+ /** @type {Object<string, unknown>} */
80
+ var flattenedObject = {};
81
+
82
+ /**
83
+ * Our flattening function, this is called recursively for each level of
84
+ * depth in the object. At each level we prepend the previous level names to
85
+ * the key using `prefix`.
86
+ *
87
+ * @param {Partial<Object<string, unknown>>} obj - Object to flatten
88
+ * @param {string} [prefix] - Optional dot-separated prefix
89
+ */
90
+ var flattenLoop = function (obj, prefix) {
91
+ // Loop through keys...
92
+ for (var key in obj) {
93
+ // Check to see if this is a prototypical key/value,
94
+ // if it is, skip it.
95
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
96
+ continue
97
+ }
98
+ var value = obj[key];
99
+ var prefixedKey = prefix ? prefix + '.' + key : key;
100
+ if (typeof value === 'object') {
101
+ // If the value is a nested object, recurse over that too
102
+ flattenLoop(value, prefixedKey);
103
+ } else {
104
+ // Otherwise, add this value to our return object
105
+ flattenedObject[prefixedKey] = value;
106
+ }
96
107
  }
97
- }
108
+ };
109
+
110
+ // Kick off the recursive loop
111
+ flattenLoop(configObject);
112
+ return flattenedObject
98
113
  };
99
114
 
100
- // Kick off the recursive loop
101
- flattenLoop(configObject);
102
- return flattenedObject
103
- };
104
-
105
- // Start with an empty object as our base
106
- var formattedConfigObject = {};
107
-
108
- // Loop through each of the remaining passed objects and push their keys
109
- // one-by-one into configObject. Any duplicate keys will override the existing
110
- // key with the new value.
111
- for (var i = 0; i < arguments.length; i++) {
112
- var obj = flattenObject(arguments[i]);
113
- for (var key in obj) {
114
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
115
- formattedConfigObject[key] = obj[key];
115
+ // Start with an empty object as our base
116
+ /** @type {Object<string, unknown>} */
117
+ var formattedConfigObject = {};
118
+
119
+ // Loop through each of the remaining passed objects and push their keys
120
+ // one-by-one into configObject. Any duplicate keys will override the existing
121
+ // key with the new value.
122
+ for (var i = 0; i < arguments.length; i++) {
123
+ var obj = flattenObject(arguments[i]);
124
+ for (var key in obj) {
125
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
126
+ formattedConfigObject[key] = obj[key];
127
+ }
116
128
  }
117
129
  }
118
- }
119
130
 
120
- return formattedConfigObject
121
- }
122
-
123
- /**
124
- * Extracts keys starting with a particular namespace from a flattened config
125
- * object, removing the namespace in the process.
126
- *
127
- * @param {object} configObject - The object to extract key-value pairs from.
128
- * @param {string} namespace - The namespace to filter keys with.
129
- * @returns {object} Flattened object with dot-separated key namespace removed
130
- */
131
- function extractConfigByNamespace (configObject, namespace) {
132
- // Check we have what we need
133
- if (!configObject || typeof configObject !== 'object') {
134
- throw new Error('Provide a `configObject` of type "object".')
131
+ return formattedConfigObject
135
132
  }
136
- if (!namespace || typeof namespace !== 'string') {
137
- throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.')
138
- }
139
- var newObject = {};
140
- for (var key in configObject) {
141
- // Split the key into parts, using . as our namespace separator
142
- var keyParts = key.split('.');
143
- // Check if the first namespace matches the configured namespace
144
- if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {
145
- // Remove the first item (the namespace) from the parts array,
146
- // but only if there is more than one part (we don't want blank keys!)
147
- if (keyParts.length > 1) {
148
- keyParts.shift();
133
+
134
+ /**
135
+ * Extracts keys starting with a particular namespace from a flattened config
136
+ * object, removing the namespace in the process.
137
+ *
138
+ * @deprecated Will be made private in v5.0
139
+ * @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.
140
+ * @param {string} namespace - The namespace to filter keys with.
141
+ * @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed
142
+ * @throws {Error} Config object required
143
+ * @throws {Error} Namespace string required
144
+ */
145
+ function extractConfigByNamespace (configObject, namespace) {
146
+ // Check we have what we need
147
+ if (!configObject || typeof configObject !== 'object') {
148
+ throw new Error('Provide a `configObject` of type "object".')
149
+ }
150
+
151
+ if (!namespace || typeof namespace !== 'string') {
152
+ throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.')
153
+ }
154
+
155
+ /** @type {Object<string, unknown>} */
156
+ var newObject = {};
157
+
158
+ for (var key in configObject) {
159
+ // Split the key into parts, using . as our namespace separator
160
+ var keyParts = key.split('.');
161
+ // Check if the first namespace matches the configured namespace
162
+ if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {
163
+ // Remove the first item (the namespace) from the parts array,
164
+ // but only if there is more than one part (we don't want blank keys!)
165
+ if (keyParts.length > 1) {
166
+ keyParts.shift();
167
+ }
168
+ // Join the remaining parts back together
169
+ var newKey = keyParts.join('.');
170
+ // Add them to our new object
171
+ newObject[newKey] = configObject[key];
149
172
  }
150
- // Join the remaining parts back together
151
- var newKey = keyParts.join('.');
152
- // Add them to our new object
153
- newObject[newKey] = configObject[key];
154
173
  }
174
+ return newObject
155
175
  }
156
- return newObject
157
- }
158
-
159
- /**
160
- * @callback nodeListIterator
161
- * @param {Element} value - The current node being iterated on
162
- * @param {number} index - The current index in the iteration
163
- * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
164
- * @returns {undefined}
165
- */
166
-
167
- exports.nodeListForEach = nodeListForEach;
168
- exports.generateUniqueID = generateUniqueID;
169
- exports.mergeConfigs = mergeConfigs;
170
- exports.extractConfigByNamespace = extractConfigByNamespace;
176
+
177
+ /**
178
+ * @template {Node} ElementType
179
+ * @callback nodeListIterator
180
+ * @param {ElementType} value - The current node being iterated on
181
+ * @param {number} index - The current index in the iteration
182
+ * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
183
+ * @returns {void}
184
+ */
185
+
186
+ exports.nodeListForEach = nodeListForEach;
187
+ exports.generateUniqueID = generateUniqueID;
188
+ exports.mergeConfigs = mergeConfigs;
189
+ exports.extractConfigByNamespace = extractConfigByNamespace;
171
190
 
172
191
  })));
192
+ //# sourceMappingURL=index.js.map