@nationalarchives/frontend 0.22.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/nationalarchives/all+analytics.js +1 -1
  2. package/nationalarchives/all+analytics.js.map +1 -1
  3. package/nationalarchives/all.css +1 -1
  4. package/nationalarchives/all.css.map +1 -1
  5. package/nationalarchives/all.js +1 -1
  6. package/nationalarchives/all.js.map +1 -1
  7. package/nationalarchives/analytics.js +1 -1
  8. package/nationalarchives/analytics.js.map +1 -1
  9. package/nationalarchives/analytics.mjs +12 -4
  10. package/nationalarchives/assets/fonts/fa-brands-400.woff2 +0 -0
  11. package/nationalarchives/assets/fonts/fa-solid-900.woff2 +0 -0
  12. package/nationalarchives/components/accordion/accordion.js +1 -1
  13. package/nationalarchives/components/accordion/accordion.js.map +1 -1
  14. package/nationalarchives/components/accordion/accordion.mjs +1 -1
  15. package/nationalarchives/components/accordion/fixtures.json +26 -7
  16. package/nationalarchives/components/accordion/macro-options.json +9 -2
  17. package/nationalarchives/components/accordion/template.njk +2 -2
  18. package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
  19. package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
  20. package/nationalarchives/components/breadcrumbs/breadcrumbs.mjs +1 -0
  21. package/nationalarchives/components/card/card.css +1 -1
  22. package/nationalarchives/components/card/card.css.map +1 -1
  23. package/nationalarchives/components/card/card.scss +10 -4
  24. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  25. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  26. package/nationalarchives/components/cookie-banner/cookie-banner.mjs +1 -1
  27. package/nationalarchives/components/date-input/date-input.css +1 -1
  28. package/nationalarchives/components/date-input/date-input.css.map +1 -1
  29. package/nationalarchives/components/date-input/date-input.js +1 -1
  30. package/nationalarchives/components/date-input/date-input.js.map +1 -1
  31. package/nationalarchives/components/date-input/date-input.scss +4 -0
  32. package/nationalarchives/components/error-summary/error-summary.js +1 -1
  33. package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
  34. package/nationalarchives/components/file-input/file-input.css.map +1 -1
  35. package/nationalarchives/components/file-input/file-input.js +1 -1
  36. package/nationalarchives/components/file-input/file-input.js.map +1 -1
  37. package/nationalarchives/components/file-input/file-input.scss +3 -3
  38. package/nationalarchives/components/footer/fixtures.json +3 -3
  39. package/nationalarchives/components/footer/footer.js +1 -1
  40. package/nationalarchives/components/footer/footer.js.map +1 -1
  41. package/nationalarchives/components/footer/template.njk +1 -1
  42. package/nationalarchives/components/gallery/gallery.css +1 -1
  43. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  44. package/nationalarchives/components/gallery/gallery.js +1 -1
  45. package/nationalarchives/components/gallery/gallery.js.map +1 -1
  46. package/nationalarchives/components/gallery/gallery.scss +2 -2
  47. package/nationalarchives/components/global-header/global-header.js +1 -1
  48. package/nationalarchives/components/global-header/global-header.js.map +1 -1
  49. package/nationalarchives/components/header/header.js +1 -1
  50. package/nationalarchives/components/header/header.js.map +1 -1
  51. package/nationalarchives/components/hero/fixtures.json +7 -7
  52. package/nationalarchives/components/hero/hero.css +1 -1
  53. package/nationalarchives/components/hero/hero.css.map +1 -1
  54. package/nationalarchives/components/hero/hero.scss +20 -24
  55. package/nationalarchives/components/hero/template.njk +3 -3
  56. package/nationalarchives/components/picture/picture.css.map +1 -1
  57. package/nationalarchives/components/picture/picture.js +1 -1
  58. package/nationalarchives/components/picture/picture.js.map +1 -1
  59. package/nationalarchives/components/picture/picture.scss +2 -3
  60. package/nationalarchives/components/skip-link/skip-link.js +1 -1
  61. package/nationalarchives/components/skip-link/skip-link.js.map +1 -1
  62. package/nationalarchives/components/tabs/tabs.js +1 -1
  63. package/nationalarchives/components/tabs/tabs.js.map +1 -1
  64. package/nationalarchives/components/text-input/text-input.js +1 -1
  65. package/nationalarchives/components/text-input/text-input.js.map +1 -1
  66. package/nationalarchives/font-awesome.css +9 -9
  67. package/nationalarchives/font-awesome.css.map +1 -1
  68. package/nationalarchives/font-awesome.scss +6 -5
  69. package/nationalarchives/lib/analytics-helpers.mjs +9 -13
  70. package/nationalarchives/lib/cookies.mjs +69 -14
  71. package/nationalarchives/lib/font-awesome/_animated.scss +93 -98
  72. package/nationalarchives/lib/font-awesome/_bordered.scss +27 -0
  73. package/nationalarchives/lib/font-awesome/_core.scss +20 -40
  74. package/nationalarchives/lib/font-awesome/_fa.scss +3 -0
  75. package/nationalarchives/lib/font-awesome/_functions.scss +3 -52
  76. package/nationalarchives/lib/font-awesome/_icons.scss +6 -4
  77. package/nationalarchives/lib/font-awesome/_list.scss +9 -6
  78. package/nationalarchives/lib/font-awesome/_mixins.scss +23 -60
  79. package/nationalarchives/lib/font-awesome/_pulled.scss +15 -0
  80. package/nationalarchives/lib/font-awesome/_rotated-flipped.scss +10 -9
  81. package/nationalarchives/lib/font-awesome/_shims.scss +1255 -1250
  82. package/nationalarchives/lib/font-awesome/_sizing.scss +6 -4
  83. package/nationalarchives/lib/font-awesome/_stacked.scss +11 -10
  84. package/nationalarchives/lib/font-awesome/_variables.scss +5110 -5025
  85. package/nationalarchives/lib/font-awesome/_widths.scss +12 -0
  86. package/nationalarchives/lib/font-awesome/brands.css +3 -3
  87. package/nationalarchives/lib/font-awesome/brands.css.map +1 -1
  88. package/nationalarchives/lib/font-awesome/brands.scss +29 -16
  89. package/nationalarchives/lib/font-awesome/fontawesome.css +3 -3
  90. package/nationalarchives/lib/font-awesome/fontawesome.css.map +1 -1
  91. package/nationalarchives/lib/font-awesome/fontawesome.scss +12 -15
  92. package/nationalarchives/lib/font-awesome/solid.css +3 -3
  93. package/nationalarchives/lib/font-awesome/solid.css.map +1 -1
  94. package/nationalarchives/lib/font-awesome/solid.scss +39 -14
  95. package/nationalarchives/lib/font-awesome/v4-shims.css +3 -3
  96. package/nationalarchives/lib/font-awesome/v4-shims.css.map +1 -1
  97. package/nationalarchives/lib/font-awesome/v4-shims.scss +5 -5
  98. package/nationalarchives/prototype-kit.css +1 -1
  99. package/nationalarchives/prototype-kit.css.map +1 -1
  100. package/nationalarchives/templates/fixtures.json +6 -6
  101. package/nationalarchives/tools/_index.scss +1 -0
  102. package/nationalarchives/tools/_shadows.scss +5 -0
  103. package/nationalarchives/utilities/lists/_index.scss +0 -1
  104. package/package.json +2 -2
  105. package/nationalarchives/assets/fonts/fa-brands-400.ttf +0 -0
  106. package/nationalarchives/assets/fonts/fa-solid-900.ttf +0 -0
@@ -1,6 +1,7 @@
1
1
  @use "variables/assets";
2
-
3
- $fa-font-path: assets.$fa-font-path;
4
- @import "lib/font-awesome/fontawesome";
5
- @import "lib/font-awesome/solid";
6
- @import "lib/font-awesome/brands";
2
+ @use "lib/font-awesome/variables" with (
3
+ $font-path: assets.$fa-font-path
4
+ );
5
+ @use "lib/font-awesome/fontawesome";
6
+ @use "lib/font-awesome/solid";
7
+ @use "lib/font-awesome/brands";
@@ -26,23 +26,16 @@ const getXPathTo = ($element) => {
26
26
  }
27
27
  };
28
28
 
29
- const includesAny = (arr, values) => values.some((v) => arr.includes(v));
30
-
31
- const getClosestHeading = ($element) => {
29
+ const getClosestElement = ($startingElement, matchingElementSelectors) => {
32
30
  let heading = "";
33
- let $search = $element;
31
+ let $search = $startingElement;
34
32
  do {
35
33
  while ($search.previousElementSibling) {
36
34
  $search = $search.previousElementSibling;
37
35
  if (
38
- ["h1", "h2", "h3", "h4", "h5", "h6"].includes($search.tagName) ||
39
- ($search.classList.length &&
40
- includesAny(Array.from($search.classList), [
41
- "tna-heading-xl",
42
- "tna-heading-l",
43
- "tna-heading-m",
44
- "tna-heading-s",
45
- ]))
36
+ matchingElementSelectors.some((matchingElementSelector) =>
37
+ $search.matches(matchingElementSelector),
38
+ )
46
39
  ) {
47
40
  heading = $search.innerText;
48
41
  break;
@@ -53,6 +46,9 @@ const getClosestHeading = ($element) => {
53
46
  return heading;
54
47
  };
55
48
 
49
+ const getClosestHeading = ($element) =>
50
+ getClosestElement($element, ["h1", "h2", "h3", "h4", "h5", "h6"]);
51
+
56
52
  const valueGetters = {
57
53
  text: ($el) => $el.innerText.replace(/\n/g, " "),
58
54
  html: ($el) => $el.innerHTML,
@@ -71,4 +67,4 @@ const valueGetters = {
71
67
  xpath: ($el) => getXPathTo($el.target),
72
68
  };
73
69
 
74
- export { getXPathTo, getClosestHeading, valueGetters };
70
+ export { getXPathTo, getClosestElement, getClosestHeading, valueGetters };
@@ -4,14 +4,23 @@ window.TNAFrontendCookieEvents = window.TNAFrontendCookieEvents || null;
4
4
  export class CookieEventHandler {
5
5
  events = {};
6
6
  oneTimeEvents = {};
7
+ debug = false;
7
8
 
8
- constructor() {
9
+ constructor(debug = false) {
10
+ this.debug = debug;
9
11
  if (window.TNAFrontendCookieEvents) {
12
+ this.log("Using existing TNAFrontendCookieEvents instance");
10
13
  return window.TNAFrontendCookieEvents;
11
14
  }
12
15
  window.TNAFrontendCookieEvents = this;
13
16
  }
14
17
 
18
+ log(...args) {
19
+ if (this.debug) {
20
+ console.log("[TNA Frontend Cookie Events]", ...args);
21
+ }
22
+ }
23
+
15
24
  /**
16
25
  * Add an event listener.
17
26
  * @param {String} event - The event to add a listener for.
@@ -34,11 +43,13 @@ export class CookieEventHandler {
34
43
  /** @protected */
35
44
  trigger(event, data = {}) {
36
45
  if (Object.hasOwn(this.events, event)) {
46
+ this.log(`Triggering event: ${event}`, data);
37
47
  this.events[event].forEach((eventToTrigger) =>
38
48
  eventToTrigger.call(this, data),
39
49
  );
40
50
  }
41
51
  if (Object.hasOwn(this.oneTimeEvents, event)) {
52
+ this.log(`Triggering one-time event: ${event}`, data);
42
53
  for (let i = this.oneTimeEvents[event].length - 1; i >= 0; i--) {
43
54
  const eventToTrigger = this.oneTimeEvents[event][i];
44
55
  eventToTrigger.call(this, data);
@@ -70,7 +81,9 @@ export default class Cookies {
70
81
  /** @protected */
71
82
  defaultAge = null;
72
83
  /** @protected */
73
- completePoliciesOnInit = false;
84
+ policiesCorrectOnInit = false;
85
+ /** @protected */
86
+ debug = document.documentElement.dataset.tnaFrontendDebug === "true";
74
87
 
75
88
  /**
76
89
  * Create a cookie handler.
@@ -78,8 +91,8 @@ export default class Cookies {
78
91
  * @param {String} [options.path] - The domain to register the cookie with.
79
92
  * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.
80
93
  * @param {String} [options.policiesKey] - The name of the cookie.
81
- * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.
82
94
  * @param {Number} [options.defaultAge] - The default age of non-session cookies.
95
+ * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.
83
96
  * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.
84
97
  */
85
98
  constructor(options = {}) {
@@ -88,8 +101,8 @@ export default class Cookies {
88
101
  defaultPath,
89
102
  secure,
90
103
  policiesKey,
91
- newInstance = false,
92
104
  defaultAge,
105
+ newInstance = false,
93
106
  noInit = false,
94
107
  } = options;
95
108
  if (!newInstance && window.TNAFrontendCookies) {
@@ -97,7 +110,8 @@ export default class Cookies {
97
110
  }
98
111
  if (defaultDomain === undefined) {
99
112
  this.defaultDomain =
100
- document.documentElement.dataset.tnaCookiesDomain || "";
113
+ document.documentElement.dataset.tnaCookiesDomain ||
114
+ window.location.hostname;
101
115
  } else {
102
116
  this.defaultDomain = defaultDomain;
103
117
  }
@@ -126,28 +140,42 @@ export default class Cookies {
126
140
  } else {
127
141
  this.defaultAge = defaultAge;
128
142
  }
129
- this.events = new CookieEventHandler();
130
- this.completePoliciesOnInit =
143
+ this.events = new CookieEventHandler(this.debug);
144
+ this.policiesCorrectOnInit =
131
145
  Object.keys(this.policies).length === tnaCookiePolicies.length &&
132
146
  tnaCookiePolicies.every(
133
147
  (policy) =>
134
148
  Object.keys(this.policies).includes(policy) &&
135
149
  typeof this.policies[policy] === "boolean",
136
150
  );
137
- if (!this.completePoliciesOnInit && !noInit) {
151
+ if (!this.policiesCorrectOnInit && !noInit) {
138
152
  this.init();
139
153
  }
140
- window.TNAFrontendCookies = this;
154
+ this.log({
155
+ defaultDomain: this.defaultDomain,
156
+ defaultPath: this.defaultPath,
157
+ secure: this.secure,
158
+ policiesKey: this.policiesKey,
159
+ defaultAge: this.defaultAge,
160
+ policiesCorrectOnInit: this.policiesCorrectOnInit,
161
+ });
162
+ if (!newInstance && !window.TNAFrontendCookies) {
163
+ window.TNAFrontendCookies = this;
164
+ }
141
165
  }
142
166
 
143
167
  /** @protected */
144
168
  init() {
145
169
  const existingPolicies = this.policies;
170
+ this.log("Existing policies on init:", existingPolicies);
146
171
  const filteredExistingPolicies = Object.fromEntries(
147
172
  Object.keys(existingPolicies)
148
173
  .filter((policy) => tnaCookiePolicies.includes(policy))
149
174
  .map((policy) => [policy, existingPolicies[policy]]),
150
175
  );
176
+ if (Object.keys(filteredExistingPolicies).length > 0) {
177
+ this.log("Filtered existing policies:", filteredExistingPolicies);
178
+ }
151
179
  this.savePolicies({
152
180
  usage: false,
153
181
  settings: false,
@@ -157,7 +185,14 @@ export default class Cookies {
157
185
  });
158
186
  }
159
187
 
188
+ log(...args) {
189
+ if (this.debug) {
190
+ console.log("[TNA Frontend Cookies]", ...args, this.all);
191
+ }
192
+ }
193
+
160
194
  destroyInstance() {
195
+ this.log("Destroying TNAFrontendCookies instance");
161
196
  window.TNAFrontendCookies = null;
162
197
  }
163
198
 
@@ -238,12 +273,21 @@ export default class Cookies {
238
273
  if (!key) {
239
274
  return;
240
275
  }
241
- const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${
242
- domain ? ` domain=${domain}; ` : ""
243
- } samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : ""}${
276
+ const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; domain=${domain}; samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : ""}${
244
277
  secure ? "; secure" : ""
245
278
  }`;
246
279
  document.cookie = cookie;
280
+ this.log("Set cookie:", {
281
+ key,
282
+ value,
283
+ maxAge,
284
+ path,
285
+ sameSite,
286
+ domain,
287
+ secure,
288
+ session,
289
+ cookie,
290
+ });
247
291
  this.events.trigger("setCookie", {
248
292
  key,
249
293
  value,
@@ -262,19 +306,21 @@ export default class Cookies {
262
306
  * @param {String} key - The cookie name.
263
307
  * @param {String} [path=/] - The path to the cookie is registered on.
264
308
  */
265
- delete(key, path = "/", domain = null) {
309
+ delete(key, path = "/", domain = this.defaultDomain) {
266
310
  const options = { maxAge: -1, path, domain: domain || undefined };
267
311
  this.set(key, "", options);
312
+ this.log("Deleted cookie:", { key, path, domain, ...options });
268
313
  this.events.trigger("deleteCookie", { key, ...options });
269
314
  }
270
315
 
271
316
  /**
272
317
  * Delete all cookies.
273
318
  */
274
- deleteAll(path = "/", domain = null) {
319
+ deleteAll(path = "/", domain = this.defaultDomain) {
275
320
  Object.keys(this.all).forEach((cookie) => {
276
321
  this.delete(cookie, path, domain);
277
322
  });
323
+ this.log("Deleted all cookies", { path, domain });
278
324
  this.events.trigger("deleteAllCookies", { path, domain });
279
325
  }
280
326
 
@@ -283,6 +329,7 @@ export default class Cookies {
283
329
  * @param {String} policy - The name of the policy.
284
330
  */
285
331
  acceptPolicy(policy) {
332
+ this.log("Accepting policy:", policy);
286
333
  this.setPolicy(policy, true);
287
334
  this.events.trigger("acceptPolicy", policy);
288
335
  this.events.trigger("changePolicy", { [policy]: true });
@@ -293,6 +340,7 @@ export default class Cookies {
293
340
  * @param {String} policy - The name of the policy.
294
341
  */
295
342
  rejectPolicy(policy) {
343
+ this.log("Rejecting policy:", policy);
296
344
  this.setPolicy(policy, false);
297
345
  this.events.trigger("rejectPolicy", policy);
298
346
  this.events.trigger("changePolicy", { [policy]: false });
@@ -305,8 +353,10 @@ export default class Cookies {
305
353
  */
306
354
  setPolicy(policy, accepted) {
307
355
  if (policy === "essential") {
356
+ this.log("Cannot change essential policy, it is always accepted.");
308
357
  return;
309
358
  }
359
+ this.log(`Setting policy ${policy} to ${accepted}`);
310
360
  this.savePolicies({
311
361
  ...this.policies,
312
362
  [policy]: accepted,
@@ -319,6 +369,7 @@ export default class Cookies {
319
369
  * Accept all the cookie policies.
320
370
  */
321
371
  acceptAllPolicies() {
372
+ this.log("Accepting all policies");
322
373
  const allPolicies = Object.fromEntries(
323
374
  Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),
324
375
  );
@@ -331,6 +382,7 @@ export default class Cookies {
331
382
  * Reject all the cookie policies.
332
383
  */
333
384
  rejectAllPolicies() {
385
+ this.log("Rejecting all policies");
334
386
  const allPolicies = {
335
387
  ...Object.fromEntries(
336
388
  Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),
@@ -347,6 +399,7 @@ export default class Cookies {
347
399
  * @param {object} policies - The policies to commit.
348
400
  */
349
401
  savePolicies(policies) {
402
+ this.log("Saving policies:", policies);
350
403
  this.set(this.policiesKey, JSON.stringify(policies));
351
404
  }
352
405
 
@@ -367,6 +420,7 @@ export default class Cookies {
367
420
  * @param {Function} callback - The callback function to call when the event is triggered.
368
421
  */
369
422
  on(event, callback) {
423
+ this.log(`Adding event listener for: ${event}`);
370
424
  this.events.on(event, callback);
371
425
  }
372
426
 
@@ -376,6 +430,7 @@ export default class Cookies {
376
430
  * @param {Function} callback - The callback function to call when the event is triggered.
377
431
  */
378
432
  once(event, callback) {
433
+ this.log(`Adding one-time event listener for: ${event}`);
379
434
  this.events.once(event, callback);
380
435
  }
381
436
  }
@@ -1,183 +1,178 @@
1
1
  // animating icons
2
2
  // --------------------------
3
+ @use "variables" as v;
3
4
 
4
- .#{$fa-css-prefix}-beat {
5
- animation-name: #{$fa-css-prefix}-beat;
6
- animation-delay: var(--#{$fa-css-prefix}-animation-delay, 0s);
7
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
8
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 1s);
5
+ .#{v.$css-prefix}-beat {
6
+ animation-name: #{v.$css-prefix}-beat;
7
+ animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
8
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
9
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
9
10
  animation-iteration-count: var(
10
- --#{$fa-css-prefix}-animation-iteration-count,
11
+ --#{v.$css-prefix}-animation-iteration-count,
11
12
  infinite
12
13
  );
13
14
  animation-timing-function: var(
14
- --#{$fa-css-prefix}-animation-timing,
15
+ --#{v.$css-prefix}-animation-timing,
15
16
  ease-in-out
16
17
  );
17
18
  }
18
19
 
19
- .#{$fa-css-prefix}-bounce {
20
- animation-name: #{$fa-css-prefix}-bounce;
21
- animation-delay: var(--#{$fa-css-prefix}-animation-delay, 0s);
22
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
23
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 1s);
20
+ .#{v.$css-prefix}-bounce {
21
+ animation-name: #{v.$css-prefix}-bounce;
22
+ animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
23
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
24
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
24
25
  animation-iteration-count: var(
25
- --#{$fa-css-prefix}-animation-iteration-count,
26
+ --#{v.$css-prefix}-animation-iteration-count,
26
27
  infinite
27
28
  );
28
29
  animation-timing-function: var(
29
- --#{$fa-css-prefix}-animation-timing,
30
+ --#{v.$css-prefix}-animation-timing,
30
31
  cubic-bezier(0.28, 0.84, 0.42, 1)
31
32
  );
32
33
  }
33
34
 
34
- .#{$fa-css-prefix}-fade {
35
- animation-name: #{$fa-css-prefix}-fade;
36
- animation-delay: var(--#{$fa-css-prefix}-animation-delay, 0s);
37
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
38
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 1s);
35
+ .#{v.$css-prefix}-fade {
36
+ animation-name: #{v.$css-prefix}-fade;
37
+ animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
38
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
39
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
39
40
  animation-iteration-count: var(
40
- --#{$fa-css-prefix}-animation-iteration-count,
41
+ --#{v.$css-prefix}-animation-iteration-count,
41
42
  infinite
42
43
  );
43
44
  animation-timing-function: var(
44
- --#{$fa-css-prefix}-animation-timing,
45
+ --#{v.$css-prefix}-animation-timing,
45
46
  cubic-bezier(0.4, 0, 0.6, 1)
46
47
  );
47
48
  }
48
49
 
49
- .#{$fa-css-prefix}-beat-fade {
50
- animation-name: #{$fa-css-prefix}-beat-fade;
51
- animation-delay: var(--#{$fa-css-prefix}-animation-delay, 0s);
52
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
53
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 1s);
50
+ .#{v.$css-prefix}-beat-fade {
51
+ animation-name: #{v.$css-prefix}-beat-fade;
52
+ animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
53
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
54
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
54
55
  animation-iteration-count: var(
55
- --#{$fa-css-prefix}-animation-iteration-count,
56
+ --#{v.$css-prefix}-animation-iteration-count,
56
57
  infinite
57
58
  );
58
59
  animation-timing-function: var(
59
- --#{$fa-css-prefix}-animation-timing,
60
+ --#{v.$css-prefix}-animation-timing,
60
61
  cubic-bezier(0.4, 0, 0.6, 1)
61
62
  );
62
63
  }
63
64
 
64
- .#{$fa-css-prefix}-flip {
65
- animation-name: #{$fa-css-prefix}-flip;
66
- animation-delay: var(--#{$fa-css-prefix}-animation-delay, 0s);
67
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
68
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 1s);
65
+ .#{v.$css-prefix}-flip {
66
+ animation-name: #{v.$css-prefix}-flip;
67
+ animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
68
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
69
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
69
70
  animation-iteration-count: var(
70
- --#{$fa-css-prefix}-animation-iteration-count,
71
+ --#{v.$css-prefix}-animation-iteration-count,
71
72
  infinite
72
73
  );
73
74
  animation-timing-function: var(
74
- --#{$fa-css-prefix}-animation-timing,
75
+ --#{v.$css-prefix}-animation-timing,
75
76
  ease-in-out
76
77
  );
77
78
  }
78
79
 
79
- .#{$fa-css-prefix}-shake {
80
- animation-name: #{$fa-css-prefix}-shake;
81
- animation-delay: var(--#{$fa-css-prefix}-animation-delay, 0s);
82
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
83
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 1s);
80
+ .#{v.$css-prefix}-shake {
81
+ animation-name: #{v.$css-prefix}-shake;
82
+ animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
83
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
84
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
84
85
  animation-iteration-count: var(
85
- --#{$fa-css-prefix}-animation-iteration-count,
86
+ --#{v.$css-prefix}-animation-iteration-count,
86
87
  infinite
87
88
  );
88
- animation-timing-function: var(--#{$fa-css-prefix}-animation-timing, linear);
89
+ animation-timing-function: var(--#{v.$css-prefix}-animation-timing, linear);
89
90
  }
90
91
 
91
- .#{$fa-css-prefix}-spin {
92
- animation-name: #{$fa-css-prefix}-spin;
93
- animation-delay: var(--#{$fa-css-prefix}-animation-delay, 0s);
94
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
95
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 2s);
92
+ .#{v.$css-prefix}-spin {
93
+ animation-name: #{v.$css-prefix}-spin;
94
+ animation-delay: var(--#{v.$css-prefix}-animation-delay, 0s);
95
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
96
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 2s);
96
97
  animation-iteration-count: var(
97
- --#{$fa-css-prefix}-animation-iteration-count,
98
+ --#{v.$css-prefix}-animation-iteration-count,
98
99
  infinite
99
100
  );
100
- animation-timing-function: var(--#{$fa-css-prefix}-animation-timing, linear);
101
+ animation-timing-function: var(--#{v.$css-prefix}-animation-timing, linear);
101
102
  }
102
103
 
103
- .#{$fa-css-prefix}-spin-reverse {
104
- --#{$fa-css-prefix}-animation-direction: reverse;
104
+ .#{v.$css-prefix}-spin-reverse {
105
+ --#{v.$css-prefix}-animation-direction: reverse;
105
106
  }
106
107
 
107
- .#{$fa-css-prefix}-pulse,
108
- .#{$fa-css-prefix}-spin-pulse {
109
- animation-name: #{$fa-css-prefix}-spin;
110
- animation-direction: var(--#{$fa-css-prefix}-animation-direction, normal);
111
- animation-duration: var(--#{$fa-css-prefix}-animation-duration, 1s);
108
+ .#{v.$css-prefix}-pulse,
109
+ .#{v.$css-prefix}-spin-pulse {
110
+ animation-name: #{v.$css-prefix}-spin;
111
+ animation-direction: var(--#{v.$css-prefix}-animation-direction, normal);
112
+ animation-duration: var(--#{v.$css-prefix}-animation-duration, 1s);
112
113
  animation-iteration-count: var(
113
- --#{$fa-css-prefix}-animation-iteration-count,
114
+ --#{v.$css-prefix}-animation-iteration-count,
114
115
  infinite
115
116
  );
116
- animation-timing-function: var(
117
- --#{$fa-css-prefix}-animation-timing,
118
- steps(8)
119
- );
117
+ animation-timing-function: var(--#{v.$css-prefix}-animation-timing, steps(8));
120
118
  }
121
119
 
122
120
  // if agent or operating system prefers reduced motion, disable animations
123
121
  // see: https://www.smashingmagazine.com/2020/09/design-reduced-motion-sensitivities/
124
122
  // see: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
125
123
  @media (prefers-reduced-motion: reduce) {
126
- .#{$fa-css-prefix}-beat,
127
- .#{$fa-css-prefix}-bounce,
128
- .#{$fa-css-prefix}-fade,
129
- .#{$fa-css-prefix}-beat-fade,
130
- .#{$fa-css-prefix}-flip,
131
- .#{$fa-css-prefix}-pulse,
132
- .#{$fa-css-prefix}-shake,
133
- .#{$fa-css-prefix}-spin,
134
- .#{$fa-css-prefix}-spin-pulse {
135
- animation-delay: -1ms;
136
- animation-duration: 1ms;
137
- animation-iteration-count: 1;
138
- transition-delay: 0s;
139
- transition-duration: 0s;
124
+ .#{v.$css-prefix}-beat,
125
+ .#{v.$css-prefix}-bounce,
126
+ .#{v.$css-prefix}-fade,
127
+ .#{v.$css-prefix}-beat-fade,
128
+ .#{v.$css-prefix}-flip,
129
+ .#{v.$css-prefix}-pulse,
130
+ .#{v.$css-prefix}-shake,
131
+ .#{v.$css-prefix}-spin,
132
+ .#{v.$css-prefix}-spin-pulse {
133
+ animation: none !important;
134
+ transition: none !important;
140
135
  }
141
136
  }
142
137
 
143
- @keyframes #{$fa-css-prefix}-beat {
138
+ @keyframes #{v.$css-prefix}-beat {
144
139
  0%,
145
140
  90% {
146
141
  transform: scale(1);
147
142
  }
148
143
  45% {
149
- transform: scale(var(--#{$fa-css-prefix}-beat-scale, 1.25));
144
+ transform: scale(var(--#{v.$css-prefix}-beat-scale, 1.25));
150
145
  }
151
146
  }
152
147
 
153
- @keyframes #{$fa-css-prefix}-bounce {
148
+ @keyframes #{v.$css-prefix}-bounce {
154
149
  0% {
155
150
  transform: scale(1, 1) translateY(0);
156
151
  }
157
152
  10% {
158
153
  transform: scale(
159
- var(--#{$fa-css-prefix}-bounce-start-scale-x, 1.1),
160
- var(--#{$fa-css-prefix}-bounce-start-scale-y, 0.9)
154
+ var(--#{v.$css-prefix}-bounce-start-scale-x, 1.1),
155
+ var(--#{v.$css-prefix}-bounce-start-scale-y, 0.9)
161
156
  )
162
157
  translateY(0);
163
158
  }
164
159
  30% {
165
160
  transform: scale(
166
- var(--#{$fa-css-prefix}-bounce-jump-scale-x, 0.9),
167
- var(--#{$fa-css-prefix}-bounce-jump-scale-y, 1.1)
161
+ var(--#{v.$css-prefix}-bounce-jump-scale-x, 0.9),
162
+ var(--#{v.$css-prefix}-bounce-jump-scale-y, 1.1)
168
163
  )
169
- translateY(var(--#{$fa-css-prefix}-bounce-height, -0.5em));
164
+ translateY(var(--#{v.$css-prefix}-bounce-height, -0.5em));
170
165
  }
171
166
  50% {
172
167
  transform: scale(
173
- var(--#{$fa-css-prefix}-bounce-land-scale-x, 1.05),
174
- var(--#{$fa-css-prefix}-bounce-land-scale-y, 0.95)
168
+ var(--#{v.$css-prefix}-bounce-land-scale-x, 1.05),
169
+ var(--#{v.$css-prefix}-bounce-land-scale-y, 0.95)
175
170
  )
176
171
  translateY(0);
177
172
  }
178
173
  57% {
179
174
  transform: scale(1, 1)
180
- translateY(var(--#{$fa-css-prefix}-bounce-rebound, -0.125em));
175
+ translateY(var(--#{v.$css-prefix}-bounce-rebound, -0.125em));
181
176
  }
182
177
  64% {
183
178
  transform: scale(1, 1) translateY(0);
@@ -187,36 +182,36 @@
187
182
  }
188
183
  }
189
184
 
190
- @keyframes #{$fa-css-prefix}-fade {
185
+ @keyframes #{v.$css-prefix}-fade {
191
186
  50% {
192
- opacity: var(--#{$fa-css-prefix}-fade-opacity, 0.4);
187
+ opacity: var(--#{v.$css-prefix}-fade-opacity, 0.4);
193
188
  }
194
189
  }
195
190
 
196
- @keyframes #{$fa-css-prefix}-beat-fade {
191
+ @keyframes #{v.$css-prefix}-beat-fade {
197
192
  0%,
198
193
  100% {
199
- opacity: var(--#{$fa-css-prefix}-beat-fade-opacity, 0.4);
194
+ opacity: var(--#{v.$css-prefix}-beat-fade-opacity, 0.4);
200
195
  transform: scale(1);
201
196
  }
202
197
  50% {
203
198
  opacity: 1;
204
- transform: scale(var(--#{$fa-css-prefix}-beat-fade-scale, 1.125));
199
+ transform: scale(var(--#{v.$css-prefix}-beat-fade-scale, 1.125));
205
200
  }
206
201
  }
207
202
 
208
- @keyframes #{$fa-css-prefix}-flip {
203
+ @keyframes #{v.$css-prefix}-flip {
209
204
  50% {
210
205
  transform: rotate3d(
211
- var(--#{$fa-css-prefix}-flip-x, 0),
212
- var(--#{$fa-css-prefix}-flip-y, 1),
213
- var(--#{$fa-css-prefix}-flip-z, 0),
214
- var(--#{$fa-css-prefix}-flip-angle, -180deg)
206
+ var(--#{v.$css-prefix}-flip-x, 0),
207
+ var(--#{v.$css-prefix}-flip-y, 1),
208
+ var(--#{v.$css-prefix}-flip-z, 0),
209
+ var(--#{v.$css-prefix}-flip-angle, -180deg)
215
210
  );
216
211
  }
217
212
  }
218
213
 
219
- @keyframes #{$fa-css-prefix}-shake {
214
+ @keyframes #{v.$css-prefix}-shake {
220
215
  0% {
221
216
  transform: rotate(-15deg);
222
217
  }
@@ -249,7 +244,7 @@
249
244
  }
250
245
  }
251
246
 
252
- @keyframes #{$fa-css-prefix}-spin {
247
+ @keyframes #{v.$css-prefix}-spin {
253
248
  0% {
254
249
  transform: rotate(0deg);
255
250
  }
@@ -0,0 +1,27 @@
1
+ // bordered icons
2
+ // -------------------------
3
+ @use "variables" as v;
4
+
5
+ /* Heads Up: Bordered Icons will not be supported in the future!
6
+ - This feature will be deprecated in the next major release of Font Awesome (v8)!
7
+ - You may continue to use it in this version *v7), but it will not be supported in Font Awesome v8.
8
+ */
9
+
10
+ /* Notes:
11
+ * --@{v.$css-prefix}-border-width = 1/16 by default (to render as ~1px based on a 16px default font-size)
12
+ * --@{v.$css-prefix}-border-padding =
13
+ ** 3/16 for vertical padding (to give ~2px of vertical whitespace around an icon considering it's vertical alignment)
14
+ ** 4/16 for horizontal padding (to give ~4px of horizontal whitespace around an icon)
15
+ */
16
+
17
+ .#{v.$css-prefix}-border {
18
+ border-color: var(--#{v.$css-prefix}-border-color, #{v.$border-color});
19
+ border-radius: var(--#{v.$css-prefix}-border-radius, #{v.$border-radius});
20
+ border-style: var(--#{v.$css-prefix}-border-style, #{v.$border-style});
21
+ border-width: var(--#{v.$css-prefix}-border-width, #{v.$border-width});
22
+ box-sizing: var(
23
+ --#{v.$css-prefix}-border-box-sizing,
24
+ #{v.$border-box-sizing}
25
+ );
26
+ padding: var(--#{v.$css-prefix}-border-padding, #{v.$border-padding});
27
+ }