govuk_publishing_components 40.1.0 → 41.1.0
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/components/accordion.js +1 -79
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -34
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +0 -17
- data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +0 -6
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +0 -7
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +8 -74
- data/app/assets/javascripts/govuk_publishing_components/dependencies.js +0 -4
- data/app/assets/javascripts/govuk_publishing_components/domain-config.js +0 -8
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +0 -4
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js +0 -14
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +0 -20
- data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +0 -33
- data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +0 -25
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +192 -171
- data/app/assets/stylesheets/component_guide/application.scss +10 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +47 -22
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss +1 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_cross-service-header.scss +19 -19
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +14 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +16 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +33 -35
- data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +13 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +6 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +4 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +3 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +10 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +5 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +5 -5
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +1 -8
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_cards.html.erb +6 -11
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -15
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +3 -19
- data/app/views/govuk_publishing_components/components/_details.html.erb +9 -11
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -5
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +4 -4
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -21
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +1 -26
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -5
- data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -7
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -10
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +1 -3
- data/app/views/govuk_publishing_components/components/_search.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_select.html.erb +1 -2
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -10
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +1 -24
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -14
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -4
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +1 -7
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +1 -60
- data/app/views/govuk_publishing_components/components/docs/big_number.yml +2 -6
- data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +0 -1
- data/app/views/govuk_publishing_components/components/docs/button.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/cards.yml +41 -20
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +0 -33
- data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/details.yml +0 -15
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +11 -18
- data/app/views/govuk_publishing_components/components/docs/error_alert.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -11
- data/app/views/govuk_publishing_components/components/docs/image_card.yml +0 -31
- data/app/views/govuk_publishing_components/components/docs/intervention.yml +0 -26
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +0 -2
- data/app/views/govuk_publishing_components/components/docs/option_select.yml +4 -16
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +0 -15
- data/app/views/govuk_publishing_components/components/docs/print_link.yml +2 -9
- data/app/views/govuk_publishing_components/components/docs/select.yml +0 -36
- data/app/views/govuk_publishing_components/components/docs/share_links.yml +2 -4
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +2 -25
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +0 -23
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +0 -10
- data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +3 -15
- data/app/views/govuk_publishing_components/components/docs/table.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +3 -27
- data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +1 -5
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +0 -10
- data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +0 -5
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +0 -7
- data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -19
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +1 -15
- data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +2 -24
- data/lib/govuk_publishing_components/presenters/select_helper.rb +0 -4
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +0 -5
- data/lib/govuk_publishing_components/presenters/translation_nav_helper.rb +0 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +4 -26
- data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +0 -92
- data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +0 -221
- data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +0 -30
- data/app/assets/javascripts/govuk_publishing_components/analytics/cross-domain-tracking.js +0 -55
- data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +0 -133
- data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +0 -46
- data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +0 -101
- data/app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js +0 -51
- data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +0 -88
- data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +0 -68
- data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +0 -220
- data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +0 -60
- data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +0 -135
- data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +0 -43
- data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +0 -160
- data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +0 -115
- data/app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js +0 -39
- data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +0 -132
- data/app/assets/javascripts/govuk_publishing_components/analytics/track-click.js +0 -75
- data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +0 -56
- data/app/assets/javascripts/govuk_publishing_components/analytics.js +0 -23
- data/app/assets/javascripts/govuk_publishing_components/components/details.js +0 -48
@@ -22,6 +22,140 @@
|
|
22
22
|
(function () {
|
23
23
|
'use strict';
|
24
24
|
|
25
|
+
function floor(x) {
|
26
|
+
return Math.floor(x);
|
27
|
+
}
|
28
|
+
var max = Math.max;
|
29
|
+
var round = Math.round;
|
30
|
+
/**
|
31
|
+
* Clamp a number so that it is never less than 0
|
32
|
+
*/
|
33
|
+
function clamp(x) {
|
34
|
+
return max(0, x);
|
35
|
+
}
|
36
|
+
function sortNumeric(a, b) {
|
37
|
+
return a - b;
|
38
|
+
}
|
39
|
+
|
40
|
+
function now() {
|
41
|
+
return Date.now ? Date.now() : +new Date();
|
42
|
+
}
|
43
|
+
|
44
|
+
var scriptStartTime = now();
|
45
|
+
|
46
|
+
var _a;
|
47
|
+
// If the various performance APIs aren't available, we export an empty object to
|
48
|
+
// prevent having to make regular typeof checks.
|
49
|
+
var performance = window.performance || {};
|
50
|
+
var timing = performance.timing || {
|
51
|
+
activationStart: 0,
|
52
|
+
// If performance.timing isn't available, we attempt to polyfill the navigationStart value.
|
53
|
+
// Our first attempt is from LUX.ns, which is the time that the snippet execution began. If this
|
54
|
+
// is not available, we fall back to the time that the current script execution began.
|
55
|
+
navigationStart: ((_a = window.LUX) === null || _a === void 0 ? void 0 : _a.ns) || scriptStartTime,
|
56
|
+
};
|
57
|
+
function navigationType() {
|
58
|
+
if (performance.navigation && typeof performance.navigation.type !== "undefined") {
|
59
|
+
return performance.navigation.type;
|
60
|
+
}
|
61
|
+
return "";
|
62
|
+
}
|
63
|
+
function getNavigationEntry() {
|
64
|
+
var navEntries = getEntriesByType("navigation");
|
65
|
+
if (navEntries.length) {
|
66
|
+
var nativeEntry = navEntries[0];
|
67
|
+
var entry_1 = {
|
68
|
+
navigationStart: 0,
|
69
|
+
activationStart: 0,
|
70
|
+
};
|
71
|
+
for (var key in nativeEntry) {
|
72
|
+
entry_1[key] = nativeEntry[key];
|
73
|
+
}
|
74
|
+
return entry_1;
|
75
|
+
}
|
76
|
+
var navType = navigationType();
|
77
|
+
var entry = {
|
78
|
+
navigationStart: 0,
|
79
|
+
activationStart: 0,
|
80
|
+
startTime: 0,
|
81
|
+
type: navType == 2 ? "back_forward" : navType === 1 ? "reload" : "navigate",
|
82
|
+
};
|
83
|
+
if (true) {
|
84
|
+
for (var key in timing) {
|
85
|
+
if (typeof timing[key] === "number" && key !== "navigationStart") {
|
86
|
+
entry[key] = floor(timing[key] - timing.navigationStart);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
return entry;
|
91
|
+
}
|
92
|
+
/**
|
93
|
+
* Simple wrapper around performance.getEntriesByType to provide fallbacks for
|
94
|
+
* legacy browsers, and work around edge cases where undefined is returned instead
|
95
|
+
* of an empty PerformanceEntryList.
|
96
|
+
*/
|
97
|
+
function getEntriesByType(type) {
|
98
|
+
if (typeof performance.getEntriesByType === "function") {
|
99
|
+
var entries = performance.getEntriesByType(type);
|
100
|
+
if (entries && entries.length) {
|
101
|
+
return entries;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
return [];
|
105
|
+
}
|
106
|
+
/**
|
107
|
+
* Simple wrapper around performance.getEntriesByName to provide fallbacks for
|
108
|
+
* legacy browsers, and work around edge cases where undefined is returned instead
|
109
|
+
* of an empty PerformanceEntryList.
|
110
|
+
*/
|
111
|
+
function getEntriesByName(type) {
|
112
|
+
if (typeof performance.getEntriesByName === "function") {
|
113
|
+
var entries = performance.getEntriesByName(type);
|
114
|
+
if (entries && entries.length) {
|
115
|
+
return entries;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
return [];
|
119
|
+
}
|
120
|
+
|
121
|
+
function isVisible() {
|
122
|
+
if (document.visibilityState) {
|
123
|
+
return document.visibilityState === "visible";
|
124
|
+
}
|
125
|
+
// For browsers that don't support document.visibilityState, we assume the page is visible.
|
126
|
+
return true;
|
127
|
+
}
|
128
|
+
function onVisible(cb) {
|
129
|
+
afterPrerender(function () {
|
130
|
+
if (isVisible()) {
|
131
|
+
cb();
|
132
|
+
}
|
133
|
+
else {
|
134
|
+
var onVisibleCallback_1 = function () {
|
135
|
+
if (isVisible()) {
|
136
|
+
cb();
|
137
|
+
removeEventListener("visibilitychange", onVisibleCallback_1);
|
138
|
+
}
|
139
|
+
};
|
140
|
+
addEventListener("visibilitychange", onVisibleCallback_1, true);
|
141
|
+
}
|
142
|
+
});
|
143
|
+
}
|
144
|
+
function afterPrerender(cb) {
|
145
|
+
if (document.prerendering) {
|
146
|
+
document.addEventListener("prerenderingchange", cb, true);
|
147
|
+
}
|
148
|
+
else {
|
149
|
+
cb();
|
150
|
+
}
|
151
|
+
}
|
152
|
+
function wasPrerendered() {
|
153
|
+
return document.prerendering || getNavigationEntry().activationStart > 0;
|
154
|
+
}
|
155
|
+
function wasRedirected() {
|
156
|
+
return getNavigationEntry().redirectCount > 0 || timing.redirectEnd > 0;
|
157
|
+
}
|
158
|
+
|
25
159
|
var Flags = {
|
26
160
|
InitCalled: 1 << 0,
|
27
161
|
NavTimingNotSupported: 1 << 1,
|
@@ -64,10 +198,6 @@
|
|
64
198
|
}
|
65
199
|
}
|
66
200
|
|
67
|
-
function now() {
|
68
|
-
return Date.now ? Date.now() : +new Date();
|
69
|
-
}
|
70
|
-
|
71
201
|
var LogEvent = {
|
72
202
|
// Internal events
|
73
203
|
EvaluationStart: 1,
|
@@ -136,98 +266,6 @@
|
|
136
266
|
var END_MARK = "LUX_end";
|
137
267
|
var BOOLEAN_TRUE = "true";
|
138
268
|
|
139
|
-
function floor(x) {
|
140
|
-
return Math.floor(x);
|
141
|
-
}
|
142
|
-
var max = Math.max;
|
143
|
-
var round = Math.round;
|
144
|
-
/**
|
145
|
-
* Clamp a number so that it is never less than 0
|
146
|
-
*/
|
147
|
-
function clamp(x) {
|
148
|
-
return max(0, x);
|
149
|
-
}
|
150
|
-
function sortNumeric(a, b) {
|
151
|
-
return a - b;
|
152
|
-
}
|
153
|
-
|
154
|
-
var scriptStartTime = now();
|
155
|
-
|
156
|
-
var _a;
|
157
|
-
// If the various performance APIs aren't available, we export an empty object to
|
158
|
-
// prevent having to make regular typeof checks.
|
159
|
-
var performance = window.performance || {};
|
160
|
-
var timing = performance.timing || {
|
161
|
-
activationStart: 0,
|
162
|
-
// If performance.timing isn't available, we attempt to polyfill the navigationStart value.
|
163
|
-
// Our first attempt is from LUX.ns, which is the time that the snippet execution began. If this
|
164
|
-
// is not available, we fall back to the time that the current script execution began.
|
165
|
-
navigationStart: ((_a = window.LUX) === null || _a === void 0 ? void 0 : _a.ns) || scriptStartTime,
|
166
|
-
};
|
167
|
-
function navigationType() {
|
168
|
-
if (performance.navigation && typeof performance.navigation.type !== "undefined") {
|
169
|
-
return performance.navigation.type;
|
170
|
-
}
|
171
|
-
return "";
|
172
|
-
}
|
173
|
-
function getNavigationEntry() {
|
174
|
-
var navEntries = getEntriesByType("navigation");
|
175
|
-
if (navEntries.length) {
|
176
|
-
var nativeEntry = navEntries[0];
|
177
|
-
var entry_1 = {
|
178
|
-
navigationStart: 0,
|
179
|
-
activationStart: 0,
|
180
|
-
};
|
181
|
-
for (var key in nativeEntry) {
|
182
|
-
entry_1[key] = nativeEntry[key];
|
183
|
-
}
|
184
|
-
return entry_1;
|
185
|
-
}
|
186
|
-
var navType = navigationType();
|
187
|
-
var entry = {
|
188
|
-
navigationStart: 0,
|
189
|
-
activationStart: 0,
|
190
|
-
startTime: 0,
|
191
|
-
type: navType == 2 ? "back_forward" : navType === 1 ? "reload" : "navigate",
|
192
|
-
};
|
193
|
-
if (true) {
|
194
|
-
for (var key in timing) {
|
195
|
-
if (typeof timing[key] === "number" && key !== "navigationStart") {
|
196
|
-
entry[key] = floor(timing[key] - timing.navigationStart);
|
197
|
-
}
|
198
|
-
}
|
199
|
-
}
|
200
|
-
return entry;
|
201
|
-
}
|
202
|
-
/**
|
203
|
-
* Simple wrapper around performance.getEntriesByType to provide fallbacks for
|
204
|
-
* legacy browsers, and work around edge cases where undefined is returned instead
|
205
|
-
* of an empty PerformanceEntryList.
|
206
|
-
*/
|
207
|
-
function getEntriesByType(type) {
|
208
|
-
if (typeof performance.getEntriesByType === "function") {
|
209
|
-
var entries = performance.getEntriesByType(type);
|
210
|
-
if (entries && entries.length) {
|
211
|
-
return entries;
|
212
|
-
}
|
213
|
-
}
|
214
|
-
return [];
|
215
|
-
}
|
216
|
-
/**
|
217
|
-
* Simple wrapper around performance.getEntriesByName to provide fallbacks for
|
218
|
-
* legacy browsers, and work around edge cases where undefined is returned instead
|
219
|
-
* of an empty PerformanceEntryList.
|
220
|
-
*/
|
221
|
-
function getEntriesByName(type) {
|
222
|
-
if (typeof performance.getEntriesByName === "function") {
|
223
|
-
var entries = performance.getEntriesByName(type);
|
224
|
-
if (entries && entries.length) {
|
225
|
-
return entries;
|
226
|
-
}
|
227
|
-
}
|
228
|
-
return [];
|
229
|
-
}
|
230
|
-
|
231
269
|
/**
|
232
270
|
* Milliseconds since navigationStart representing when the page was restored from the bfcache
|
233
271
|
*/
|
@@ -283,7 +321,7 @@
|
|
283
321
|
return str;
|
284
322
|
}
|
285
323
|
|
286
|
-
var VERSION = "4.0.
|
324
|
+
var VERSION = "4.0.25";
|
287
325
|
/**
|
288
326
|
* Returns the version of the script as a float to be stored in legacy systems that do not support
|
289
327
|
* string versions.
|
@@ -303,6 +341,13 @@
|
|
303
341
|
};
|
304
342
|
var sendBeacon = "sendBeacon" in navigator ? navigator.sendBeacon.bind(navigator) : sendBeaconFallback;
|
305
343
|
/**
|
344
|
+
* Some values should only be reported if they are non-zero. The exception to this is when the page
|
345
|
+
* was prerendered or restored from BF cache
|
346
|
+
*/
|
347
|
+
function shouldReportValue(value) {
|
348
|
+
return value > 0 || getPageRestoreTime() || wasPrerendered();
|
349
|
+
}
|
350
|
+
/**
|
306
351
|
* Fit an array of user timing delimited strings into a URL and return both the entries that fit and
|
307
352
|
* the remaining entries that didn't fit.
|
308
353
|
*/
|
@@ -338,7 +383,7 @@
|
|
338
383
|
_this.logger.logEvent(LogEvent.PostBeaconTimeoutReached);
|
339
384
|
_this.stopRecording();
|
340
385
|
_this.send();
|
341
|
-
}, this.config.maxMeasureTime);
|
386
|
+
}, this.config.maxMeasureTime - msSincePageInit());
|
342
387
|
addListener("securitypolicyviolation", function (e) {
|
343
388
|
if (e.disposition !== "report" && e.blockedURI === _this.config.beaconUrlV2 && "URL" in self) {
|
344
389
|
// Some websites might have CSP rules that allow the GET beacon, but not the POST beacon.
|
@@ -541,44 +586,6 @@
|
|
541
586
|
return encodeURIComponent(strings.join(","));
|
542
587
|
}
|
543
588
|
|
544
|
-
function isVisible() {
|
545
|
-
if (document.visibilityState) {
|
546
|
-
return document.visibilityState === "visible";
|
547
|
-
}
|
548
|
-
// For browsers that don't support document.visibilityState, we assume the page is visible.
|
549
|
-
return true;
|
550
|
-
}
|
551
|
-
function onVisible(cb) {
|
552
|
-
afterPrerender(function () {
|
553
|
-
if (isVisible()) {
|
554
|
-
cb();
|
555
|
-
}
|
556
|
-
else {
|
557
|
-
var onVisibleCallback_1 = function () {
|
558
|
-
if (isVisible()) {
|
559
|
-
cb();
|
560
|
-
removeEventListener("visibilitychange", onVisibleCallback_1);
|
561
|
-
}
|
562
|
-
};
|
563
|
-
addEventListener("visibilitychange", onVisibleCallback_1, true);
|
564
|
-
}
|
565
|
-
});
|
566
|
-
}
|
567
|
-
function afterPrerender(cb) {
|
568
|
-
if (document.prerendering) {
|
569
|
-
document.addEventListener("prerenderingchange", cb, true);
|
570
|
-
}
|
571
|
-
else {
|
572
|
-
cb();
|
573
|
-
}
|
574
|
-
}
|
575
|
-
function wasPrerendered() {
|
576
|
-
return document.prerendering || getNavigationEntry().activationStart > 0;
|
577
|
-
}
|
578
|
-
function wasRedirected() {
|
579
|
-
return getNavigationEntry().redirectCount > 0 || timing.redirectEnd > 0;
|
580
|
-
}
|
581
|
-
|
582
589
|
function getClosestScTrackAttribute(el) {
|
583
590
|
var _a;
|
584
591
|
if (el.hasAttribute("data-sctrack")) {
|
@@ -603,7 +610,8 @@
|
|
603
610
|
function getNodeSelector(node, selector) {
|
604
611
|
if (selector === void 0) { selector = ""; }
|
605
612
|
try {
|
606
|
-
if (selector &&
|
613
|
+
if (selector &&
|
614
|
+
(node.nodeType === 9 || selector.length > MAX_SELECTOR_LENGTH || !node.parentNode)) {
|
607
615
|
// Final selector.
|
608
616
|
return selector;
|
609
617
|
}
|
@@ -659,27 +667,27 @@
|
|
659
667
|
elementSelector: getNodeSelector(source.node),
|
660
668
|
elementType: source.node.nodeName,
|
661
669
|
}); })
|
662
|
-
|
670
|
+
: [];
|
663
671
|
if (sessionEntries.length &&
|
664
672
|
(entry.startTime - latestEntry.startTime >= 1000 ||
|
665
673
|
entry.startTime - firstEntry.startTime >= 5000)) {
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
largestEntry = entry;
|
670
|
-
}
|
671
|
-
else {
|
672
|
-
sessionValue += entry.value;
|
673
|
-
sessionEntries.push(entry);
|
674
|
-
sessionAttributions = sessionAttributions.concat(sources);
|
675
|
-
if (!largestEntry || entry.value > largestEntry.value) {
|
674
|
+
sessionValue = entry.value;
|
675
|
+
sessionEntries = [entry];
|
676
|
+
sessionAttributions = sources;
|
676
677
|
largestEntry = entry;
|
677
678
|
}
|
678
|
-
|
679
|
-
|
679
|
+
else {
|
680
|
+
sessionValue += entry.value;
|
681
|
+
sessionEntries.push(entry);
|
682
|
+
sessionAttributions = sessionAttributions.concat(sources);
|
683
|
+
if (!largestEntry || entry.value > largestEntry.value) {
|
684
|
+
largestEntry = entry;
|
685
|
+
}
|
686
|
+
}
|
687
|
+
maximumSessionValue = max(maximumSessionValue, sessionValue);
|
680
688
|
}
|
681
689
|
}
|
682
|
-
function reset$
|
690
|
+
function reset$2() {
|
683
691
|
sessionValue = 0;
|
684
692
|
sessionEntries = [];
|
685
693
|
maximumSessionValue = 0;
|
@@ -711,7 +719,7 @@
|
|
711
719
|
var slowestEntriesMap = {};
|
712
720
|
// The total number of interactions recorded on the page
|
713
721
|
var interactionCountEstimate = 0;
|
714
|
-
function reset() {
|
722
|
+
function reset$1() {
|
715
723
|
interactionCountEstimate = 0;
|
716
724
|
slowestEntries = [];
|
717
725
|
slowestEntriesMap = {};
|
@@ -808,6 +816,9 @@
|
|
808
816
|
lcpEntry = entry;
|
809
817
|
}
|
810
818
|
}
|
819
|
+
function reset() {
|
820
|
+
lcpEntry = undefined;
|
821
|
+
}
|
811
822
|
function getData() {
|
812
823
|
if (!lcpEntry) {
|
813
824
|
return undefined;
|
@@ -831,8 +842,14 @@
|
|
831
842
|
};
|
832
843
|
}
|
833
844
|
}
|
845
|
+
var value = processTimeMetric(lcpEntry.startTime);
|
846
|
+
if (!shouldReportValue(value)) {
|
847
|
+
// It's possible the LCP entry we have occurred before the current page was initialised. In
|
848
|
+
// this case, we don't want to report the LCP value.
|
849
|
+
return undefined;
|
850
|
+
}
|
834
851
|
return {
|
835
|
-
value:
|
852
|
+
value: value,
|
836
853
|
subParts: subParts,
|
837
854
|
attribution: lcpEntry.element
|
838
855
|
? {
|
@@ -846,7 +863,7 @@
|
|
846
863
|
var ALL_ENTRIES = [];
|
847
864
|
function observe(type, callback, options) {
|
848
865
|
if (typeof PerformanceObserver === "function" &&
|
849
|
-
|
866
|
+
PerformanceObserver.supportedEntryTypes.includes(type)) {
|
850
867
|
var po = new PerformanceObserver(function (list) {
|
851
868
|
list.getEntries().forEach(function (entry) { return callback(entry); });
|
852
869
|
});
|
@@ -1011,6 +1028,9 @@
|
|
1011
1028
|
var gUid = refreshUniqueId(gSyncId); // cookie for this session ("Unique ID")
|
1012
1029
|
var gCustomDataTimeout; // setTimeout timer for sending a Custom data beacon after onload
|
1013
1030
|
var gMaxMeasureTimeout; // setTimeout timer for sending the beacon after a maximum measurement time
|
1031
|
+
// Storing the customer ID in a local variable makes it possible to run multiple instances of lux.js
|
1032
|
+
// on the same page.
|
1033
|
+
var _thisCustomerId = LUX.customerid;
|
1014
1034
|
var initPostBeacon = function () {
|
1015
1035
|
return new Beacon({
|
1016
1036
|
config: globalConfig,
|
@@ -1031,7 +1051,6 @@
|
|
1031
1051
|
};
|
1032
1052
|
try {
|
1033
1053
|
observe("longtask", processAndLogEntry);
|
1034
|
-
observe("largest-contentful-paint", processAndLogEntry);
|
1035
1054
|
observe("element", processAndLogEntry);
|
1036
1055
|
observe("paint", processAndLogEntry);
|
1037
1056
|
observe("largest-contentful-paint", function (entry) {
|
@@ -1083,13 +1102,6 @@
|
|
1083
1102
|
catch (e) {
|
1084
1103
|
logger.logEvent(LogEvent.PerformanceObserverError, [e]);
|
1085
1104
|
}
|
1086
|
-
/**
|
1087
|
-
* Some values should only be reported if they are non-zero. The exception to this is when the page
|
1088
|
-
* was prerendered or restored from BF cache
|
1089
|
-
*/
|
1090
|
-
var shouldReportValue = function (value) {
|
1091
|
-
return value > 0 || getPageRestoreTime() || wasPrerendered();
|
1092
|
-
};
|
1093
1105
|
if (_sample()) {
|
1094
1106
|
logger.logEvent(LogEvent.SessionIsSampled, [globalConfig.samplerate]);
|
1095
1107
|
}
|
@@ -1263,8 +1275,8 @@
|
|
1263
1275
|
var endTime = typeof endMarkName === "number" ? endMarkName : msSincePageInit();
|
1264
1276
|
var throwError = function (missingMark) {
|
1265
1277
|
throw new DOMException("Failed to execute 'measure' on 'Performance': The mark '" +
|
1266
|
-
|
1267
|
-
|
1278
|
+
missingMark +
|
1279
|
+
"' does not exist");
|
1268
1280
|
};
|
1269
1281
|
if (typeof startMarkName === "string") {
|
1270
1282
|
var startMark = _getMark(startMarkName);
|
@@ -1531,7 +1543,7 @@
|
|
1531
1543
|
// Track how long it took lux.js to load via Resource Timing.
|
1532
1544
|
function selfLoading() {
|
1533
1545
|
var sLuxjs = "";
|
1534
|
-
if (performance.getEntriesByName) {
|
1546
|
+
if (gbFirstPV && performance.getEntriesByName) {
|
1535
1547
|
// Get the lux script URL (including querystring params).
|
1536
1548
|
var aResources = performance.getEntriesByName(thisScript.src);
|
1537
1549
|
if (aResources && aResources.length) {
|
@@ -1568,6 +1580,8 @@
|
|
1568
1580
|
"";
|
1569
1581
|
}
|
1570
1582
|
}
|
1583
|
+
// How long data was collected before the beacon was sent
|
1584
|
+
sLuxjs += "m" + msSincePageInit();
|
1571
1585
|
return sLuxjs;
|
1572
1586
|
}
|
1573
1587
|
// _clearIx
|
@@ -1632,6 +1646,11 @@
|
|
1632
1646
|
_mark(START_MARK);
|
1633
1647
|
}
|
1634
1648
|
logger.logEvent(LogEvent.InitCalled);
|
1649
|
+
// This is an edge case where LUX.auto = true but LUX.init() has been called. In this case, the
|
1650
|
+
// POST beacon will not be sent automatically, so we need to send it here.
|
1651
|
+
if (globalConfig.auto && !beacon.isSent) {
|
1652
|
+
beacon.send();
|
1653
|
+
}
|
1635
1654
|
// Clear all interactions from the previous "page".
|
1636
1655
|
_clearIx();
|
1637
1656
|
// Since we actively disable IX handlers, we re-add them each time.
|
@@ -1644,8 +1663,9 @@
|
|
1644
1663
|
gbFirstPV = 0;
|
1645
1664
|
gSyncId = createSyncId();
|
1646
1665
|
gUid = refreshUniqueId(gSyncId);
|
1647
|
-
reset$1();
|
1648
1666
|
reset();
|
1667
|
+
reset$2();
|
1668
|
+
reset$1();
|
1649
1669
|
nErrors = 0;
|
1650
1670
|
gFirstInputDelay = undefined;
|
1651
1671
|
beacon = initPostBeacon();
|
@@ -1676,9 +1696,9 @@
|
|
1676
1696
|
!e.async &&
|
1677
1697
|
!e.defer &&
|
1678
1698
|
0 !== (e.compareDocumentPosition(lastViewportElem) & 4)) {
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1699
|
+
// If the script has a SRC and async is false and it occurs BEFORE the last viewport element,
|
1700
|
+
// then increment the counter.
|
1701
|
+
num++;
|
1682
1702
|
}
|
1683
1703
|
}
|
1684
1704
|
return num;
|
@@ -1697,7 +1717,7 @@
|
|
1697
1717
|
"style" === e.as ||
|
1698
1718
|
(typeof e.onload === "function" && e.media === "all")) ;
|
1699
1719
|
else {
|
1700
|
-
|
1720
|
+
nBlocking++;
|
1701
1721
|
}
|
1702
1722
|
}
|
1703
1723
|
}
|
@@ -2167,7 +2187,8 @@
|
|
2167
2187
|
var metricsQueryString =
|
2168
2188
|
// only send Nav Timing and lux.js metrics on initial pageload (not for SPA page views)
|
2169
2189
|
(gbNavSent ? "" : "&NT=" + getNavTiming()) +
|
2170
|
-
|
2190
|
+
"&LJS=" +
|
2191
|
+
sLuxjs +
|
2171
2192
|
// Page Stats
|
2172
2193
|
"&PS=ns" +
|
2173
2194
|
numScripts() +
|
@@ -13,8 +13,8 @@ $gem-guide-border-width: 1px;
|
|
13
13
|
@extend %govuk-list--bullet;
|
14
14
|
|
15
15
|
li {
|
16
|
-
@include govuk-font($size: 19);
|
17
16
|
margin-bottom: $govuk-gutter-half;
|
17
|
+
@include govuk-font($size: 19);
|
18
18
|
}
|
19
19
|
|
20
20
|
p {
|
@@ -44,28 +44,28 @@ $gem-guide-border-width: 1px;
|
|
44
44
|
}
|
45
45
|
|
46
46
|
.component-violation {
|
47
|
-
@include govuk-text-colour;
|
48
47
|
border: 3px solid $govuk-error-colour;
|
49
48
|
margin: 0 0 $govuk-gutter;
|
50
49
|
padding: $govuk-gutter $govuk-gutter;
|
50
|
+
@include govuk-text-colour;
|
51
51
|
|
52
52
|
.component-violation__title {
|
53
|
-
@include govuk-font($size: 24, $weight: bold);
|
54
53
|
margin: 0;
|
54
|
+
@include govuk-font($size: 24, $weight: bold);
|
55
55
|
}
|
56
56
|
|
57
57
|
.component-violation__link {
|
58
58
|
display: block;
|
59
|
-
@include govuk-font($size: 19, $weight: bold);
|
60
59
|
color: $govuk-error-colour;
|
61
60
|
margin: $govuk-gutter-half 0;
|
61
|
+
@include govuk-font($size: 19, $weight: bold);
|
62
62
|
}
|
63
63
|
}
|
64
64
|
|
65
65
|
.component-doc-h2 {
|
66
|
+
margin: ($govuk-gutter * 1.5) 0 $govuk-gutter;
|
66
67
|
@include govuk-text-colour;
|
67
68
|
@include govuk-font($size: 27, $weight: bold);
|
68
|
-
margin: ($govuk-gutter * 1.5) 0 $govuk-gutter;
|
69
69
|
|
70
70
|
small {
|
71
71
|
@include govuk-font($size: 16, $weight: bold);
|
@@ -73,8 +73,8 @@ $gem-guide-border-width: 1px;
|
|
73
73
|
}
|
74
74
|
|
75
75
|
.component-doc-h3 {
|
76
|
-
@include govuk-text-colour;
|
77
76
|
margin: $govuk-gutter 0 $govuk-gutter-half;
|
77
|
+
@include govuk-text-colour;
|
78
78
|
@include govuk-font($size: 19, $weight: bold);
|
79
79
|
}
|
80
80
|
|
@@ -149,9 +149,9 @@ $gem-guide-border-width: 1px;
|
|
149
149
|
|
150
150
|
.component-guide-preview--violation,
|
151
151
|
.component-guide-preview--warning {
|
152
|
-
@include govuk-text-colour;
|
153
152
|
margin-top: -$gem-guide-border-width;
|
154
153
|
|
154
|
+
@include govuk-text-colour;
|
155
155
|
@include govuk-font($size: 19);
|
156
156
|
|
157
157
|
&:empty {
|
@@ -185,13 +185,12 @@ $gem-guide-border-width: 1px;
|
|
185
185
|
}
|
186
186
|
|
187
187
|
&::before {
|
188
|
-
@include govuk-font($size: 16);
|
189
188
|
content: attr(data-content);
|
190
189
|
position: absolute;
|
191
190
|
top: 0;
|
192
191
|
left: 0;
|
193
192
|
padding: .2105em .7894em;
|
194
|
-
font
|
193
|
+
@include govuk-font($size: 16, $weight: bold);
|
195
194
|
}
|
196
195
|
}
|
197
196
|
|
@@ -217,9 +216,9 @@ $gem-guide-border-width: 1px;
|
|
217
216
|
margin: 0 0 $govuk-gutter * 1.5;
|
218
217
|
|
219
218
|
.example-title {
|
219
|
+
margin: $govuk-gutter-half 0;
|
220
220
|
@include govuk-text-colour;
|
221
221
|
@include govuk-font($size: 24, $weight: bold);
|
222
|
-
margin: $govuk-gutter-half 0;
|
223
222
|
}
|
224
223
|
|
225
224
|
.example-title small {
|
@@ -508,8 +507,8 @@ $code-delete-bg: #fadddd;
|
|
508
507
|
|
509
508
|
.component__application-name {
|
510
509
|
display: block;
|
511
|
-
@include govuk-font($size: 16);
|
512
510
|
font-weight: normal;
|
511
|
+
@include govuk-font($size: 16);
|
513
512
|
}
|
514
513
|
|
515
514
|
.component__count {
|
@@ -31,7 +31,7 @@
|
|
31
31
|
// Change the summary subheading size.
|
32
32
|
.govuk-accordion__section-summary {
|
33
33
|
@include govuk-typography-common;
|
34
|
-
@include govuk-
|
34
|
+
@include govuk-font-size($size: 16, $important: true);
|
35
35
|
}
|
36
36
|
|
37
37
|
// Hide the unusable "Show all" and "Show" sections.
|
@@ -26,9 +26,9 @@
|
|
26
26
|
}
|
27
27
|
|
28
28
|
.gem-c-action-link__link-wrapper {
|
29
|
-
@include govuk-font(19, $weight: bold, $line-height: 1.3);
|
30
29
|
display: table-cell;
|
31
30
|
vertical-align: middle;
|
31
|
+
@include govuk-font(19, $weight: bold, $line-height: 1.3);
|
32
32
|
}
|
33
33
|
|
34
34
|
.gem-c-action-link__link {
|
@@ -73,10 +73,9 @@
|
|
73
73
|
}
|
74
74
|
|
75
75
|
.gem-c-action-link__subtext {
|
76
|
-
@include govuk-font(19);
|
77
76
|
display: block;
|
78
|
-
font-weight: normal;
|
79
77
|
color: inherit;
|
78
|
+
@include govuk-font(19);
|
80
79
|
|
81
80
|
@include govuk-media-query($from: tablet) {
|
82
81
|
position: relative;
|
@@ -10,9 +10,9 @@ $thumbnail-shadow-width: 0 2px 2px;
|
|
10
10
|
$thumbnail-icon-border-colour: govuk-colour("mid-grey");
|
11
11
|
|
12
12
|
.gem-c-attachment {
|
13
|
+
position: relative;
|
13
14
|
@include govuk-font(19);
|
14
15
|
@include govuk-clearfix;
|
15
|
-
position: relative;
|
16
16
|
|
17
17
|
.govuk-details {
|
18
18
|
margin: govuk-spacing(3) 0;
|
@@ -51,8 +51,8 @@ $thumbnail-icon-border-colour: govuk-colour("mid-grey");
|
|
51
51
|
}
|
52
52
|
|
53
53
|
.gem-c-attachment__title {
|
54
|
-
@include govuk-font($size: 27);
|
55
54
|
margin: 0 0 govuk-spacing(3);
|
55
|
+
@include govuk-font($size: 27);
|
56
56
|
}
|
57
57
|
|
58
58
|
.gem-c-attachment__link {
|
@@ -60,9 +60,9 @@ $thumbnail-icon-border-colour: govuk-colour("mid-grey");
|
|
60
60
|
}
|
61
61
|
|
62
62
|
.gem-c-attachment__metadata {
|
63
|
-
@include govuk-font($size: 19);
|
64
63
|
margin: 0 0 govuk-spacing(3);
|
65
64
|
color: $govuk-secondary-text-colour;
|
65
|
+
@include govuk-font($size: 19);
|
66
66
|
|
67
67
|
&:last-of-type {
|
68
68
|
margin-bottom: 0;
|