govuk_publishing_components 35.3.3 → 35.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +4 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/init-ga4.js +1 -1
- data/app/assets/stylesheets/component_guide/application.scss +37 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +10 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +0 -24
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -3
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +5 -5
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +1 -0
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -1
- data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -0
- data/config/locales/en.yml +2 -2
- data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +4 -0
- data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/axe.d.ts +77 -6
- data/node_modules/axe-core/axe.js +955 -600
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/locales/_template.json +6 -6
- data/node_modules/axe-core/locales/ja.json +91 -11
- data/node_modules/axe-core/package.json +5 -5
- data/node_modules/axe-core/sri-history.json +4 -0
- data/node_modules/govuk-frontend/README.md +4 -5
- data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
- data/node_modules/govuk-frontend/govuk/all.js +738 -258
- data/node_modules/govuk-frontend/govuk/all.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +11 -7
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
- data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/common/index.js +16 -4
- data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +20 -10
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/common.js +16 -4
- data/node_modules/govuk-frontend/govuk/common.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +3 -3
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +234 -86
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +32 -13
- data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +8 -2
- data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +12 -12
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +8 -6
- data/node_modules/govuk-frontend/govuk/components/button/button.js +54 -19
- data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +11 -1
- data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/button/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +170 -76
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +3 -3
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +75 -24
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +47 -47
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +3 -3
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +26 -26
- data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/details.js +39 -13
- data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +10 -10
- data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +67 -27
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +19 -19
- data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +19 -19
- data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +14 -14
- data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
- data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +24 -24
- data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +22 -22
- data/node_modules/govuk-frontend/govuk/components/header/header.js +46 -14
- data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
- data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +54 -41
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/input/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +6 -6
- data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +49 -22
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +16 -16
- data/node_modules/govuk-frontend/govuk/components/pagination/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +10 -10
- data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
- data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +46 -46
- data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +65 -22
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -2
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
- data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +19 -20
- data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/select/template.njk +5 -2
- data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +41 -13
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +34 -34
- data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +21 -21
- data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +15 -15
- data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +178 -60
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
- data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +18 -18
- data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +2 -1
- data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +9 -5
- data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +3 -3
- data/node_modules/govuk-frontend/govuk/components/warning-text/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
- data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
- data/node_modules/govuk-frontend/govuk/i18n.js +38 -30
- data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/macros/i18n.njk +12 -11
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
- data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
- data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
- data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +10 -3
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +13 -7
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +8 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +8 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +10 -3
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +4 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +3 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +2 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -1
- data/node_modules/govuk-frontend/govuk-esm/all.mjs +81 -60
- data/node_modules/govuk-frontend/govuk-esm/all.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs +12 -8
- data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs +9 -0
- data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +44 -29
- data/node_modules/govuk-frontend/govuk-esm/common/index.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +15 -9
- data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/common.mjs +3 -5
- data/node_modules/govuk-frontend/govuk-esm/common.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +319 -211
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +47 -30
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +169 -115
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +88 -51
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +64 -54
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +69 -50
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +59 -35
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +36 -25
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +67 -38
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +49 -32
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +263 -163
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +68 -57
- data/node_modules/govuk-frontend/govuk-esm/i18n.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs +5 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs +7 -4
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs +13 -10
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs +6 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs +6 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs +7 -4
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs +5 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs +5 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs +4 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs.map +1 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +2 -1
- data/node_modules/govuk-frontend/package.json +3 -2
- metadata +44 -7
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px.png → dbt_crest_13px.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px_x2.png → dbt_crest_13px_x2.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px.png → dbt_crest_18px.png} +0 -0
- /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px_x2.png → dbt_crest_18px_x2.png} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"closest-attribute-value.mjs","sources":["../../../src/govuk/common/closest-attribute-value.mjs"],"sourcesContent":["import '../vendor/polyfills/Element/prototype/closest.mjs'\n\n/**\n * Returns the value of the given attribute closest to the given element (including itself)\n *\n * @deprecated Will be made private in v5.0\n * @param {Element} $element - The element to start walking the DOM tree up\n * @param {string} attributeName - The name of the attribute\n * @returns {string | null} Attribute value\n */\nexport function closestAttributeValue ($element, attributeName) {\n var $closestElementWithAttribute = $element.closest('[' + attributeName + ']')\n return $closestElementWithAttribute\n ? $closestElementWithAttribute.getAttribute(attributeName)\n : null\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;AAQA,AAAO,SAAS,qBAAqB,EAAE,QAAQ,EAAE,aAAa,EAAE;EAC9D,IAAI,4BAA4B,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,GAAG,aAAa,GAAG,GAAG,EAAC;EAC9E,OAAO,4BAA4B;MAC/B,4BAA4B,CAAC,YAAY,CAAC,aAAa,CAAC;MACxD,IAAI;CACT;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"govuk-frontend-version.mjs","sources":["../../../src/govuk/common/govuk-frontend-version.mjs"],"sourcesContent":["/*\n * This variable is automatically overwritten during builds and releases.\n * It doesn't need to be updated manually.\n */\n\nexport var version = 'development'\n"],"names":[],"mappings":"AAAA;;;;;AAKA,AAAU,IAAC,OAAO,GAAG,OAAa;;;;"}
|
@@ -13,16 +13,18 @@
|
|
13
13
|
* This seems to fail in IE8, requires more investigation.
|
14
14
|
* See: https://github.com/imagitama/nodelist-foreach-polyfill
|
15
15
|
*
|
16
|
-
* @
|
17
|
-
* @
|
16
|
+
* @deprecated Will be made private in v5.0
|
17
|
+
* @template {Node} ElementType
|
18
|
+
* @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
|
19
|
+
* @param {nodeListIterator<ElementType>} callback - Callback function to run for each node
|
18
20
|
* @returns {void}
|
19
21
|
*/
|
20
|
-
|
22
|
+
function nodeListForEach (nodes, callback) {
|
21
23
|
if (window.NodeList.prototype.forEach) {
|
22
24
|
return nodes.forEach(callback)
|
23
25
|
}
|
24
26
|
for (var i = 0; i < nodes.length; i++) {
|
25
|
-
callback.call(window, nodes[i], i, nodes)
|
27
|
+
callback.call(window, nodes[i], i, nodes);
|
26
28
|
}
|
27
29
|
}
|
28
30
|
|
@@ -31,16 +33,17 @@ export function nodeListForEach (nodes, callback) {
|
|
31
33
|
* without them conflicting with each other.
|
32
34
|
* https://stackoverflow.com/a/8809472
|
33
35
|
*
|
36
|
+
* @deprecated Will be made private in v5.0
|
34
37
|
* @returns {string} Unique ID
|
35
38
|
*/
|
36
|
-
|
37
|
-
var d = new Date().getTime()
|
39
|
+
function generateUniqueID () {
|
40
|
+
var d = new Date().getTime();
|
38
41
|
if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
|
39
|
-
d += window.performance.now() // use high-precision timer if available
|
42
|
+
d += window.performance.now(); // use high-precision timer if available
|
40
43
|
}
|
41
44
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
42
|
-
var r = (d + Math.random() * 16) % 16 | 0
|
43
|
-
d = Math.floor(d / 16)
|
45
|
+
var r = (d + Math.random() * 16) % 16 | 0;
|
46
|
+
d = Math.floor(d / 16);
|
44
47
|
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
|
45
48
|
})
|
46
49
|
}
|
@@ -52,9 +55,10 @@ export function generateUniqueID () {
|
|
52
55
|
* (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
|
53
56
|
* greatest priority on the LAST item passed in.
|
54
57
|
*
|
58
|
+
* @deprecated Will be made private in v5.0
|
55
59
|
* @returns {Object<string, unknown>} A flattened object of key-value pairs.
|
56
60
|
*/
|
57
|
-
|
61
|
+
function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
|
58
62
|
/**
|
59
63
|
* Function to take nested objects and flatten them to a dot-separated keyed
|
60
64
|
* object. Doing this means we don't need to do any deep/recursive merging of
|
@@ -66,7 +70,8 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
|
|
66
70
|
*/
|
67
71
|
var flattenObject = function (configObject) {
|
68
72
|
// Prepare an empty return object
|
69
|
-
|
73
|
+
/** @type {Object<string, unknown>} */
|
74
|
+
var flattenedObject = {};
|
70
75
|
|
71
76
|
/**
|
72
77
|
* Our flattening function, this is called recursively for each level of
|
@@ -84,34 +89,35 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
|
|
84
89
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
85
90
|
continue
|
86
91
|
}
|
87
|
-
var value = obj[key]
|
88
|
-
var prefixedKey = prefix ? prefix + '.' + key : key
|
92
|
+
var value = obj[key];
|
93
|
+
var prefixedKey = prefix ? prefix + '.' + key : key;
|
89
94
|
if (typeof value === 'object') {
|
90
95
|
// If the value is a nested object, recurse over that too
|
91
|
-
flattenLoop(value, prefixedKey)
|
96
|
+
flattenLoop(value, prefixedKey);
|
92
97
|
} else {
|
93
98
|
// Otherwise, add this value to our return object
|
94
|
-
flattenedObject[prefixedKey] = value
|
99
|
+
flattenedObject[prefixedKey] = value;
|
95
100
|
}
|
96
101
|
}
|
97
|
-
}
|
102
|
+
};
|
98
103
|
|
99
104
|
// Kick off the recursive loop
|
100
|
-
flattenLoop(configObject)
|
105
|
+
flattenLoop(configObject);
|
101
106
|
return flattenedObject
|
102
|
-
}
|
107
|
+
};
|
103
108
|
|
104
109
|
// Start with an empty object as our base
|
105
|
-
|
110
|
+
/** @type {Object<string, unknown>} */
|
111
|
+
var formattedConfigObject = {};
|
106
112
|
|
107
113
|
// Loop through each of the remaining passed objects and push their keys
|
108
114
|
// one-by-one into configObject. Any duplicate keys will override the existing
|
109
115
|
// key with the new value.
|
110
116
|
for (var i = 0; i < arguments.length; i++) {
|
111
|
-
var obj = flattenObject(arguments[i])
|
117
|
+
var obj = flattenObject(arguments[i]);
|
112
118
|
for (var key in obj) {
|
113
119
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
114
|
-
formattedConfigObject[key] = obj[key]
|
120
|
+
formattedConfigObject[key] = obj[key];
|
115
121
|
}
|
116
122
|
}
|
117
123
|
}
|
@@ -123,44 +129,53 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
|
|
123
129
|
* Extracts keys starting with a particular namespace from a flattened config
|
124
130
|
* object, removing the namespace in the process.
|
125
131
|
*
|
132
|
+
* @deprecated Will be made private in v5.0
|
126
133
|
* @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.
|
127
134
|
* @param {string} namespace - The namespace to filter keys with.
|
128
135
|
* @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed
|
129
136
|
* @throws {Error} Config object required
|
130
137
|
* @throws {Error} Namespace string required
|
131
138
|
*/
|
132
|
-
|
139
|
+
function extractConfigByNamespace (configObject, namespace) {
|
133
140
|
// Check we have what we need
|
134
141
|
if (!configObject || typeof configObject !== 'object') {
|
135
142
|
throw new Error('Provide a `configObject` of type "object".')
|
136
143
|
}
|
144
|
+
|
137
145
|
if (!namespace || typeof namespace !== 'string') {
|
138
146
|
throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.')
|
139
147
|
}
|
140
|
-
|
148
|
+
|
149
|
+
/** @type {Object<string, unknown>} */
|
150
|
+
var newObject = {};
|
151
|
+
|
141
152
|
for (var key in configObject) {
|
142
153
|
// Split the key into parts, using . as our namespace separator
|
143
|
-
var keyParts = key.split('.')
|
154
|
+
var keyParts = key.split('.');
|
144
155
|
// Check if the first namespace matches the configured namespace
|
145
156
|
if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {
|
146
157
|
// Remove the first item (the namespace) from the parts array,
|
147
158
|
// but only if there is more than one part (we don't want blank keys!)
|
148
159
|
if (keyParts.length > 1) {
|
149
|
-
keyParts.shift()
|
160
|
+
keyParts.shift();
|
150
161
|
}
|
151
162
|
// Join the remaining parts back together
|
152
|
-
var newKey = keyParts.join('.')
|
163
|
+
var newKey = keyParts.join('.');
|
153
164
|
// Add them to our new object
|
154
|
-
newObject[newKey] = configObject[key]
|
165
|
+
newObject[newKey] = configObject[key];
|
155
166
|
}
|
156
167
|
}
|
157
168
|
return newObject
|
158
169
|
}
|
159
170
|
|
160
171
|
/**
|
172
|
+
* @template {Node} ElementType
|
161
173
|
* @callback nodeListIterator
|
162
|
-
* @param {
|
174
|
+
* @param {ElementType} value - The current node being iterated on
|
163
175
|
* @param {number} index - The current index in the iteration
|
164
|
-
* @param {NodeListOf<
|
176
|
+
* @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
|
165
177
|
* @returns {void}
|
166
178
|
*/
|
179
|
+
|
180
|
+
export { nodeListForEach, generateUniqueID, mergeConfigs, extractConfigByNamespace };
|
181
|
+
//# sourceMappingURL=common/index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/govuk/common/index.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n *\n * @module common/index\n */\n\n/**\n * TODO: Ideally this would be a NodeList.prototype.forEach polyfill\n * This seems to fail in IE8, requires more investigation.\n * See: https://github.com/imagitama/nodelist-foreach-polyfill\n *\n * @deprecated Will be made private in v5.0\n * @template {Node} ElementType\n * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()\n * @param {nodeListIterator<ElementType>} callback - Callback function to run for each node\n * @returns {void}\n */\nexport function nodeListForEach (nodes, callback) {\n if (window.NodeList.prototype.forEach) {\n return nodes.forEach(callback)\n }\n for (var i = 0; i < nodes.length; i++) {\n callback.call(window, nodes[i], i, nodes)\n }\n}\n\n/**\n * Used to generate a unique string, allows multiple instances of the component\n * without them conflicting with each other.\n * https://stackoverflow.com/a/8809472\n *\n * @deprecated Will be made private in v5.0\n * @returns {string} Unique ID\n */\nexport function generateUniqueID () {\n var d = new Date().getTime()\n if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {\n d += window.performance.now() // use high-precision timer if available\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0\n d = Math.floor(d / 16)\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)\n })\n}\n\n/**\n * Config flattening function\n *\n * Takes any number of objects, flattens them into namespaced key-value pairs,\n * (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @deprecated Will be made private in v5.0\n * @returns {Object<string, unknown>} A flattened object of key-value pairs.\n */\nexport function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {\n /**\n * Function to take nested objects and flatten them to a dot-separated keyed\n * object. Doing this means we don't need to do any deep/recursive merging of\n * each of our objects, nor transform our dataset from a flat list into a\n * nested object.\n *\n * @param {Object<string, unknown>} configObject - Deeply nested object\n * @returns {Object<string, unknown>} Flattened object with dot-separated keys\n */\n var flattenObject = function (configObject) {\n // Prepare an empty return object\n /** @type {Object<string, unknown>} */\n var flattenedObject = {}\n\n /**\n * Our flattening function, this is called recursively for each level of\n * depth in the object. At each level we prepend the previous level names to\n * the key using `prefix`.\n *\n * @param {Partial<Object<string, unknown>>} obj - Object to flatten\n * @param {string} [prefix] - Optional dot-separated prefix\n */\n var flattenLoop = function (obj, prefix) {\n // Loop through keys...\n for (var key in obj) {\n // Check to see if this is a prototypical key/value,\n // if it is, skip it.\n if (!Object.prototype.hasOwnProperty.call(obj, key)) {\n continue\n }\n var value = obj[key]\n var prefixedKey = prefix ? prefix + '.' + key : key\n if (typeof value === 'object') {\n // If the value is a nested object, recurse over that too\n flattenLoop(value, prefixedKey)\n } else {\n // Otherwise, add this value to our return object\n flattenedObject[prefixedKey] = value\n }\n }\n }\n\n // Kick off the recursive loop\n flattenLoop(configObject)\n return flattenedObject\n }\n\n // Start with an empty object as our base\n /** @type {Object<string, unknown>} */\n var formattedConfigObject = {}\n\n // Loop through each of the remaining passed objects and push their keys\n // one-by-one into configObject. Any duplicate keys will override the existing\n // key with the new value.\n for (var i = 0; i < arguments.length; i++) {\n var obj = flattenObject(arguments[i])\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n formattedConfigObject[key] = obj[key]\n }\n }\n }\n\n return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from a flattened config\n * object, removing the namespace in the process.\n *\n * @deprecated Will be made private in v5.0\n * @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.\n * @param {string} namespace - The namespace to filter keys with.\n * @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed\n * @throws {Error} Config object required\n * @throws {Error} Namespace string required\n */\nexport function extractConfigByNamespace (configObject, namespace) {\n // Check we have what we need\n if (!configObject || typeof configObject !== 'object') {\n throw new Error('Provide a `configObject` of type \"object\".')\n }\n\n if (!namespace || typeof namespace !== 'string') {\n throw new Error('Provide a `namespace` of type \"string\" to filter the `configObject` by.')\n }\n\n /** @type {Object<string, unknown>} */\n var newObject = {}\n\n for (var key in configObject) {\n // Split the key into parts, using . as our namespace separator\n var keyParts = key.split('.')\n // Check if the first namespace matches the configured namespace\n if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {\n // Remove the first item (the namespace) from the parts array,\n // but only if there is more than one part (we don't want blank keys!)\n if (keyParts.length > 1) {\n keyParts.shift()\n }\n // Join the remaining parts back together\n var newKey = keyParts.join('.')\n // Add them to our new object\n newObject[newKey] = configObject[key]\n }\n }\n return newObject\n}\n\n/**\n * @template {Node} ElementType\n * @callback nodeListIterator\n * @param {ElementType} value - The current node being iterated on\n * @param {number} index - The current index in the iteration\n * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()\n * @returns {void}\n */\n"],"names":[],"mappings":"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"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
import '../vendor/polyfills/Element/prototype/dataset.mjs';
|
2
|
+
import '../vendor/polyfills/String/prototype/trim.mjs';
|
2
3
|
|
3
|
-
|
4
|
-
import '../vendor/polyfills/String/prototype/trim.mjs'
|
4
|
+
/* eslint-disable es-x/no-string-prototype-trim -- Polyfill imported */
|
5
5
|
|
6
6
|
/**
|
7
7
|
* Normalise string
|
@@ -14,15 +14,16 @@ import '../vendor/polyfills/String/prototype/trim.mjs'
|
|
14
14
|
* Designed to be used to convert config passed via data attributes (which are
|
15
15
|
* always strings) into something sensible.
|
16
16
|
*
|
17
|
+
* @deprecated Will be made private in v5.0
|
17
18
|
* @param {string} value - The value to normalise
|
18
19
|
* @returns {string | boolean | number | undefined} Normalised data
|
19
20
|
*/
|
20
|
-
|
21
|
+
function normaliseString (value) {
|
21
22
|
if (typeof value !== 'string') {
|
22
23
|
return value
|
23
24
|
}
|
24
25
|
|
25
|
-
var trimmedValue = value.trim()
|
26
|
+
var trimmedValue = value.trim();
|
26
27
|
|
27
28
|
if (trimmedValue === 'true') {
|
28
29
|
return true
|
@@ -34,7 +35,7 @@ export function normaliseString (value) {
|
|
34
35
|
|
35
36
|
// Empty / whitespace-only strings are considered finite so we need to check
|
36
37
|
// the length of the trimmed string as well
|
37
|
-
if (trimmedValue.length > 0 && isFinite(trimmedValue)) {
|
38
|
+
if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
|
38
39
|
return Number(trimmedValue)
|
39
40
|
}
|
40
41
|
|
@@ -46,15 +47,20 @@ export function normaliseString (value) {
|
|
46
47
|
*
|
47
48
|
* Loop over an object and normalise each value using normaliseData function
|
48
49
|
*
|
50
|
+
* @deprecated Will be made private in v5.0
|
49
51
|
* @param {DOMStringMap} dataset - HTML element dataset
|
50
52
|
* @returns {Object<string, unknown>} Normalised dataset
|
51
53
|
*/
|
52
|
-
|
53
|
-
|
54
|
+
function normaliseDataset (dataset) {
|
55
|
+
/** @type {Object<string, unknown>} */
|
56
|
+
var out = {};
|
54
57
|
|
55
58
|
for (var key in dataset) {
|
56
|
-
out[key] = normaliseString(dataset[key])
|
59
|
+
out[key] = normaliseString(dataset[key]);
|
57
60
|
}
|
58
61
|
|
59
62
|
return out
|
60
63
|
}
|
64
|
+
|
65
|
+
export { normaliseString, normaliseDataset };
|
66
|
+
//# sourceMappingURL=common/normalise-dataset.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalise-dataset.mjs","sources":["../../../src/govuk/common/normalise-dataset.mjs"],"sourcesContent":["/* eslint-disable es-x/no-string-prototype-trim -- Polyfill imported */\n\nimport '../vendor/polyfills/Element/prototype/dataset.mjs'\nimport '../vendor/polyfills/String/prototype/trim.mjs'\n\n/**\n * Normalise string\n *\n * 'If it looks like a duck, and it quacks like a duck…' 🦆\n *\n * If the passed value looks like a boolean or a number, convert it to a boolean\n * or number.\n *\n * Designed to be used to convert config passed via data attributes (which are\n * always strings) into something sensible.\n *\n * @deprecated Will be made private in v5.0\n * @param {string} value - The value to normalise\n * @returns {string | boolean | number | undefined} Normalised data\n */\nexport function normaliseString (value) {\n if (typeof value !== 'string') {\n return value\n }\n\n var trimmedValue = value.trim()\n\n if (trimmedValue === 'true') {\n return true\n }\n\n if (trimmedValue === 'false') {\n return false\n }\n\n // Empty / whitespace-only strings are considered finite so we need to check\n // the length of the trimmed string as well\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n return Number(trimmedValue)\n }\n\n return value\n}\n\n/**\n * Normalise dataset\n *\n * Loop over an object and normalise each value using normaliseData function\n *\n * @deprecated Will be made private in v5.0\n * @param {DOMStringMap} dataset - HTML element dataset\n * @returns {Object<string, unknown>} Normalised dataset\n */\nexport function normaliseDataset (dataset) {\n /** @type {Object<string, unknown>} */\n var out = {}\n\n for (var key in dataset) {\n out[key] = normaliseString(dataset[key])\n }\n\n return out\n}\n"],"names":[],"mappings":";;;AAAA;AACA,AAGA;;;;;;;;;;;;;;;;AAgBA,AAAO,SAAS,eAAe,EAAE,KAAK,EAAE;EACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO,KAAK;GACb;;EAED,IAAI,YAAY,GAAG,KAAK,CAAC,IAAI,GAAE;;EAE/B,IAAI,YAAY,KAAK,MAAM,EAAE;IAC3B,OAAO,IAAI;GACZ;;EAED,IAAI,YAAY,KAAK,OAAO,EAAE;IAC5B,OAAO,KAAK;GACb;;;;EAID,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE;IAC7D,OAAO,MAAM,CAAC,YAAY,CAAC;GAC5B;;EAED,OAAO,KAAK;CACb;;;;;;;;;;;AAWD,AAAO,SAAS,gBAAgB,EAAE,OAAO,EAAE;;EAEzC,IAAI,GAAG,GAAG,GAAE;;EAEZ,KAAK,IAAI,GAAG,IAAI,OAAO,EAAE;IACvB,GAAG,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;GACzC;;EAED,OAAO,GAAG;CACX;;;;"}
|
@@ -1,6 +1,4 @@
|
|
1
|
+
export { nodeListForEach, generateUniqueID, mergeConfigs, extractConfigByNamespace } from './common/index.mjs';
|
2
|
+
|
1
3
|
// Implementation of common function is gathered in the `common` folder
|
2
|
-
|
3
|
-
// they require.
|
4
|
-
// This module exports the non polyfilled methods as they used to be
|
5
|
-
// to avoid breaking changes
|
6
|
-
export * from './common/index.mjs'
|
4
|
+
//# sourceMappingURL=common.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.mjs","sources":["../../src/govuk/common.mjs"],"sourcesContent":["// Implementation of common function is gathered in the `common` folder\n// as some are split in their own modules to limit impacts of the polyfills\n// they require.\n// This module exports the non polyfilled methods as they used to be\n// to avoid breaking changes\nexport * from './common/index.mjs'\n"],"names":[],"mappings":";;AAAA,uEAAuE"}
|