hexo-theme-gnix 5.0.2 → 5.0.3

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.
@@ -34,7 +34,7 @@ module.exports = class extends Component {
34
34
  return (
35
35
  <Fragment>
36
36
  {/* Main content */}
37
- <div class="card article-wrapper">
37
+ <div class="card">
38
38
  {/* Cover image */}
39
39
  {cover ? (
40
40
  <ArticleCover
@@ -38,23 +38,8 @@ class Navbar extends Component {
38
38
  return (
39
39
  <nav class="navbar navbar-main" onclick="handleNavbarClick(event);">
40
40
  <div class="navbar-container">
41
- <a href={siteUrl}>
42
- <svg
43
- fill="var(--flamingo)"
44
- viewBox="0 0 1182.000000 750.000000"
45
- width="5em"
46
- height="100%"
47
- role="img"
48
- aria-label="Blog Logo"
49
- >
50
- <g
51
- transform="translate(0.000000,930.000000) scale(0.100000,-0.100000)"
52
- stroke="none"
53
- >
54
- <path d="M4915 7175 c-238 -39 -533 -139 -794 -270 -549 -275 -1067 -758 -1291 -1205 -73 -145 -95 -225 -94 -345 0 -120 23 -188 86 -260 203 -231 774 -132 1521 262 185 97 298 161 372 209 l30 19 -19 -30 c-11 -16 -50 -74 -88 -130 l-69 -100 -102 -46 c-564 -253 -1269 -905 -1508 -1394 -118 -241 -121 -414 -9 -525 149 -150 390 -86 629 165 150 158 405 524 664 951 80 132 212 348 294 480 l148 239 70 24 c84 28 203 38 262 22 57 -16 100 -54 115 -102 20 -69 78 -90 123 -45 l24 24 15 -22 c9 -15 11 -28 5 -37 -16 -26 -9 -34 10 -11 12 13 31 22 48 22 39 0 46 6 88 78 73 125 268 348 406 464 115 98 227 147 230 101 3 -48 -7 -88 -58 -232 -91 -257 -76 -348 63 -374 88 -17 295 69 544 226 l135 85 5 -92 c10 -163 74 -226 232 -226 155 0 283 58 523 235 61 45 141 107 179 138 38 32 72 57 76 57 4 0 18 -31 30 -69 l22 -70 -79 -93 c-139 -162 -240 -309 -300 -433 -48 -101 -43 -157 17 -170 44 -10 77 15 91 67 18 70 161 276 292 423 l44 50 41 -37 c102 -92 323 -101 573 -22 97 30 292 121 394 184 98 60 293 207 306 231 17 33 7 80 -22 102 -35 25 -52 19 -136 -50 -232 -191 -517 -330 -761 -370 -130 -21 -200 -13 -248 29 -18 16 -34 36 -34 44 0 7 55 63 123 125 304 277 553 444 736 495 61 17 62 17 77 -4 10 -14 26 -22 45 -22 45 0 67 16 75 56 5 29 2 40 -17 61 -41 43 -92 63 -162 63 -174 0 -434 -158 -805 -491 -68 -61 -125 -109 -126 -107 -1 1 -17 34 -35 71 -34 70 -76 108 -133 122 -22 6 -36 -3 -99 -60 -97 -89 -338 -270 -433 -324 -144 -82 -255 -110 -304 -75 -44 30 -24 141 53 294 24 47 52 94 64 104 29 26 26 52 -8 87 -22 21 -39 29 -66 29 -49 0 -69 -12 -104 -63 -33 -48 -307 -240 -486 -340 -108 -60 -241 -117 -274 -117 -27 0 -26 12 5 85 99 233 127 382 85 462 -33 66 -73 88 -156 88 -106 -1 -183 -45 -337 -194 -43 -41 -78 -71 -78 -68 0 10 60 118 82 146 63 82 -57 168 -131 94 -33 -34 -137 -260 -241 -522 l-77 -194 -17 49 c-22 68 -63 115 -134 152 -70 37 -173 54 -266 45 l-60 -6 79 114 c143 210 249 343 339 429 229 217 236 225 242 257 5 26 1 37 -19 57 -16 16 -37 26 -54 26 -39 0 -142 -80 -250 -193 -99 -104 -201 -187 -378 -305 -429 -286 -1057 -565 -1435 -636 -95 -18 -257 -21 -315 -5 -51 14 -110 73 -124 124 -47 168 80 462 316 736 425 490 995 840 1638 1004 235 60 436 71 493 27 23 -17 27 -26 24 -61 -3 -52 9 -76 47 -89 60 -21 101 26 101 116 0 85 -34 132 -125 174 -45 20 -68 23 -215 25 -107 1 -197 -3 -255 -12z m-536 -2152 c-13 -21 -54 -87 -93 -148 -38 -60 -130 -211 -204 -335 -156 -261 -360 -571 -492 -750 -203 -275 -393 -411 -497 -356 -117 60 -104 230 34 458 176 292 619 737 985 990 88 61 271 177 281 177 5 1 -2 -16 -14 -36z" />{" "}
55
- <path d="M7073 6016 c-60 -27 -83 -120 -42 -165 49 -53 119 -51 168 5 82 93 -11 212 -126 160z" />{" "}
56
- </g>
57
- </svg>
41
+ <a href={siteUrl} style={"font-family: homemade-apple; color: var(--text); display: flex; align-items: center; padding: 0 1em;"}>
42
+ GnixAij
58
43
  </a>
59
44
  <div class="navbar-menu">
60
45
  {Object.keys(menu).length ? (
package/layout/layout.jsx CHANGED
@@ -19,7 +19,7 @@ module.exports = class extends Component {
19
19
  <Navbar config={config} helper={helper} page={page} />
20
20
  <ThemeSelector />
21
21
  <section class="section">
22
- <div class="main-content" dangerouslySetInnerHTML={{ __html: body }} ></div>
22
+ <div class="main-content" id="swup" dangerouslySetInnerHTML={{ __html: body }} ></div>
23
23
  </section>
24
24
  <Footer site={site} config={config} helper={helper} />
25
25
  <Scripts site={site} config={config} helper={helper} page={page} />
@@ -6,12 +6,22 @@ class Swup extends Component {
6
6
  return null;
7
7
  }
8
8
 
9
- const swupScript =
10
- 'const swup = new Swup({ containers: [".main-content"], });';
9
+ const swupScript = `
10
+ const swup = new Swup({
11
+ containers: ["#swup"],
12
+ cache: true,
13
+ plugins: [
14
+ new SwupHeadPlugin({
15
+ persistTags: true
16
+ })
17
+ ]
18
+ });
19
+ `;
11
20
  return (
12
21
  <Fragment>
13
22
  <script src="/js/host/swup/Swup.umd.min.js"></script>
14
- <script dangerouslySetInnerHTML={{ __html: swupScript }}> </script>
23
+ <script src="/js/host/swup/head-plugin.umd.min.js"></script>
24
+ <script dangerouslySetInnerHTML={{ __html: swupScript }}></script>
15
25
  </Fragment>
16
26
  );
17
27
  }
package/layout/tag.jsx CHANGED
@@ -1,5 +1,33 @@
1
1
  const { Component, Fragment } = require("../include/util/common");
2
2
  const Index = require("./index");
3
+ const breadcrumb_css = `
4
+ .breadcrumb {
5
+ color: var(--blue);
6
+ white-space: nowrap;
7
+ font-family: Monaspace Radon, var(--font-mono);
8
+
9
+ a {
10
+ align-items: center;
11
+ display: flex;
12
+ justify-content: center;
13
+ padding: 0 0.1em;
14
+ }
15
+
16
+ ul {
17
+ align-items: flex-start;
18
+ display: flex;
19
+ flex-wrap: wrap;
20
+ justify-content: flex-start;
21
+ }
22
+
23
+ li {
24
+ align-items: center;
25
+ display: flex;
26
+ a {
27
+ color: var(--yellow);
28
+ }
29
+ }
30
+ }`;
3
31
 
4
32
  module.exports = class extends Component {
5
33
  render() {
@@ -8,15 +36,15 @@ module.exports = class extends Component {
8
36
 
9
37
  return (
10
38
  <Fragment>
39
+ <style>{breadcrumb_css}</style>
11
40
  <nav class="breadcrumb" aria-label="breadcrumbs">
12
41
  <ul>
13
42
  <li>
14
- {" "}
15
43
  <font style="color: var(--green)">$</font>&nbsp;ls&nbsp;
16
- <a href={url_for("/tags/")}>{_p("common.tag", Infinity)}</a>
44
+ <a href={url_for("/tags/")}>{_p("common.tag", Infinity)}/</a>
17
45
  </li>
18
- <li class="is-active">
19
- <a href="#" aria-current="page">
46
+ <li>
47
+ <a href="#" aria-current="page" style="cursor: default; pointer-events: none; color: var(--mauve);">
20
48
  {page.tag}
21
49
  </a>
22
50
  </li>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-gnix",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "author": "Efterklang <gaojiaxing0220@gmail.com>",
5
5
  "license": "MIT",
6
6
  "description": "Second generation of Hexo theme Icarus, now with Catppuccin flavor and night mode support.",
@@ -14,6 +14,8 @@
14
14
  "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
15
15
  "Source Han Sans CN", sans-serif;
16
16
  --font-handwriting: "Bradley Hand", "homemade-apple", cursive;
17
+ --radius: 12px;
18
+ --spaceing: 0.25rem;
17
19
  }
18
20
 
19
21
  /* #region Color */
@@ -225,7 +227,7 @@ mark {
225
227
  .navbar-main,
226
228
  .navbar-menu {
227
229
  user-select: none;
228
- background: hsl(from var(--mantle) h s l / 0.95);
230
+ background: var(--mantle);
229
231
  }
230
232
 
231
233
  body {
@@ -233,19 +235,11 @@ body {
233
235
  color: var(--text);
234
236
  }
235
237
 
236
- .card {
237
- border: 0.5px dashed var(--surface0);
238
- }
239
-
240
238
  input.task-list-item-checkbox:checked {
241
239
  background-color: var(--green);
242
240
  border-color: var(--green);
243
241
  }
244
242
 
245
- .navbar-item {
246
- color: var(--text);
247
- }
248
-
249
243
  hr {
250
244
  background-color: var(--surface0);
251
245
  }
@@ -324,10 +318,10 @@ input:-webkit-autofill {
324
318
 
325
319
  @font-face {
326
320
  font-family: homemade-apple;
327
- font-style: normal;
328
- font-weight: 400;
329
- font-display: swap;
330
- src: url(/css/font/woff2/HomemadeApple.woff2) format("woff2");
321
+ src:
322
+ local("Homemade Apple"),
323
+ local("HomemadeApple-Regular"),
324
+ url(/css/font/woff2/HomemadeApple.woff2) format("woff2");
331
325
  }
332
326
 
333
327
  /* #endregion */
@@ -385,7 +379,6 @@ body {
385
379
  flex-direction: column;
386
380
  }
387
381
 
388
- .breadcrumb,
389
382
  .pagination-ellipsis,
390
383
  .pagination-link,
391
384
  .pagination-next,
@@ -397,49 +390,10 @@ body {
397
390
  user-select: none;
398
391
  }
399
392
 
400
- .breadcrumb:not(:last-child),
401
393
  .pagination:not(:last-child) {
402
394
  margin-bottom: 0.5rem;
403
395
  }
404
396
 
405
- .breadcrumb {
406
- white-space: nowrap;
407
- font-family: "Monaspace Radon", var(--font-mono);
408
- }
409
-
410
- .breadcrumb a {
411
- align-items: center;
412
- display: flex;
413
- justify-content: center;
414
- padding: 0 0.1em;
415
- }
416
-
417
- .breadcrumb li {
418
- align-items: center;
419
- display: flex;
420
- }
421
-
422
- .breadcrumb li:first-child a {
423
- padding-left: 0;
424
- }
425
-
426
- .breadcrumb li.is-active a {
427
- cursor: default;
428
- pointer-events: none;
429
- }
430
-
431
- .breadcrumb li + li::before {
432
- content: "\0002f";
433
- }
434
-
435
- .breadcrumb ol,
436
- .breadcrumb ul {
437
- align-items: flex-start;
438
- display: flex;
439
- flex-wrap: wrap;
440
- justify-content: flex-start;
441
- }
442
-
443
397
  .toc-text,
444
398
  .footer,
445
399
  .widget {
@@ -449,8 +403,9 @@ body {
449
403
  .card {
450
404
  max-width: 100%;
451
405
  position: relative;
452
- border-radius: 24px;
453
406
  overflow: visible;
407
+ border-radius: var(--radius);
408
+ border: 0.5px dashed var(--surface0);
454
409
  }
455
410
 
456
411
  .card + .card {
@@ -473,6 +428,7 @@ body {
473
428
  transition: transform 0.3s ease-in-out;
474
429
  z-index: 100;
475
430
  font-family: var(--font-sans-serif);
431
+ border-bottom: 0.5px solid var(--surface0);
476
432
  }
477
433
 
478
434
  .navbar-container {
@@ -493,27 +449,18 @@ body {
493
449
  transform: translateY(-100%);
494
450
  }
495
451
 
496
- .navbar-menu {
497
- display: none;
498
- }
499
-
500
452
  .navbar-item {
453
+ color: var(--subtext1);
501
454
  align-items: center;
502
455
  display: flex;
503
456
  font-size: 1.1rem;
504
- padding: 0 0.4rem;
457
+ padding: 0 0.5rem;
505
458
  position: relative;
506
459
  flex-grow: 0;
507
460
  flex-shrink: 0;
508
- }
509
-
510
- .navbar-item svg {
511
- width: 15px;
512
- }
513
-
514
- .navbar-menu {
515
- flex-grow: 1;
516
- flex-shrink: 0;
461
+ svg {
462
+ width: 15px;
463
+ }
517
464
  }
518
465
 
519
466
  /* #endregion Navbar */
@@ -757,7 +704,7 @@ body {
757
704
  flex-grow: 1;
758
705
  margin: 0 auto;
759
706
  position: relative;
760
- max-width: 980px;
707
+ max-width: 1080px;
761
708
  }
762
709
 
763
710
  /* #region Footer */
@@ -846,6 +793,7 @@ body {
846
793
 
847
794
  a.header-anchor {
848
795
  color: var(--text);
796
+
849
797
  &:hover::after {
850
798
  margin-left: 0.2em;
851
799
  color: var(--surface0);
@@ -873,6 +821,7 @@ body {
873
821
  line-height: 1.25;
874
822
  letter-spacing: -0.015em;
875
823
  margin: 1.2rem 0 1rem;
824
+
876
825
  > a.header-anchor {
877
826
  &:hover::after {
878
827
  content: "###";
@@ -886,6 +835,7 @@ body {
886
835
  line-height: 1.25;
887
836
  letter-spacing: -0.01em;
888
837
  margin: 1.2rem 0 1rem;
838
+
889
839
  > a.header-anchor {
890
840
  &:hover::after {
891
841
  content: "####";
@@ -899,6 +849,7 @@ body {
899
849
  line-height: 1.25;
900
850
  letter-spacing: -0.005em;
901
851
  margin: 1.2rem 0 1rem;
852
+
902
853
  > a.header-anchor {
903
854
  &:hover::after {
904
855
  content: "#####";
@@ -911,6 +862,7 @@ body {
911
862
  font-weight: 600;
912
863
  line-height: 1.25;
913
864
  margin: 1.2rem 0 1rem;
865
+
914
866
  > a.header-anchor {
915
867
  &:hover::after {
916
868
  content: "######";
@@ -939,13 +891,18 @@ body {
939
891
  video {
940
892
  display: block;
941
893
  max-width: 100%;
942
- margin: 1em auto;
894
+ margin: 0 auto;
943
895
 
944
896
  &:hover {
945
897
  cursor: pointer;
946
898
  }
947
899
  }
948
900
 
901
+ video,
902
+ .pic {
903
+ margin: 1em auto;
904
+ }
905
+
949
906
  ol {
950
907
  list-style-position: outside;
951
908
  padding-left: 2em;
@@ -1111,6 +1068,7 @@ blockquote {
1111
1068
  border-left: 2px solid var(--red);
1112
1069
  border-radius: 0 8px 8px 0;
1113
1070
  font-family: var(--font-serif);
1071
+
1114
1072
  &:before {
1115
1073
  content: "”";
1116
1074
  color: var(--red);
@@ -1240,7 +1198,7 @@ section {
1240
1198
  letter-spacing: -0.02em;
1241
1199
  margin-bottom: 0.3em;
1242
1200
  color: var(--text);
1243
- word-break: break-word;
1201
+
1244
1202
  > a {
1245
1203
  color: inherit;
1246
1204
  }
@@ -1447,7 +1405,7 @@ input.searchbox-input {
1447
1405
  position: relative;
1448
1406
  display: block;
1449
1407
  overflow: hidden;
1450
- border-radius: 24px 24px 0 0;
1408
+ border-radius: var(--radius) var(--radius) 0 0;
1451
1409
  height: 380px;
1452
1410
 
1453
1411
  .cover-image-placeholder {
@@ -12,28 +12,28 @@
12
12
  }
13
13
 
14
14
  /* navbar */
15
- .navbar-main .navbar-menu,
16
- .navbar-main .navbar-start,
17
- .navbar-main .navbar-end {
15
+ .navbar-menu,
16
+ .navbar-start,
17
+ .navbar-end {
18
18
  align-items: stretch;
19
19
  display: flex;
20
20
  padding: 0;
21
21
  flex-shrink: 0;
22
22
  }
23
23
 
24
- .navbar-main .navbar-menu {
24
+ .navbar-menu {
25
25
  flex-grow: 1;
26
26
  flex-shrink: 0;
27
27
  overflow-x: auto;
28
28
  background-color: transparent;
29
29
  }
30
30
 
31
- .navbar-main .navbar-start {
31
+ .navbar-start {
32
32
  justify-content: flex-start;
33
33
  margin-right: auto;
34
34
  }
35
35
 
36
- .navbar-main .navbar-end {
36
+ .navbar-end {
37
37
  justify-content: flex-end;
38
38
  margin-left: auto;
39
39
  }
@@ -161,4 +161,4 @@
161
161
  padding: 0;
162
162
  margin: 0;
163
163
  display: contents;
164
- }
164
+ }
@@ -13,6 +13,7 @@ span.year {
13
13
 
14
14
  table {
15
15
  font-size: 14px;
16
+ word-wrap: break-word;
16
17
  }
17
18
 
18
19
  table th,
@@ -1,7 +1,8 @@
1
1
  /* This is used for mobile and tablet devices */
2
2
  /* #region Navbar */
3
3
  /* Navbar Burger */
4
- .navbar-main .navbar-menu {
4
+ .navbar-menu {
5
+ display: none;
5
6
  padding: 0.5rem 0;
6
7
  }
7
8
 
@@ -39,6 +39,25 @@ figure.shiki {
39
39
  overflow: auto;
40
40
  background: var(--mantle);
41
41
  color: var(--text);
42
+
43
+ iconify-icon {
44
+ color: transparent;
45
+ cursor: pointer;
46
+ transition:
47
+ color 0.3s,
48
+ transform 0.3s ease;
49
+ }
50
+
51
+ &:hover {
52
+ iconify-icon {
53
+ color: var(--text);
54
+
55
+ &:hover {
56
+ color: var(--blue);
57
+ transform: scale(1.2);
58
+ }
59
+ }
60
+ }
42
61
  }
43
62
 
44
63
  .shiki-tools {
@@ -46,7 +65,7 @@ figure.shiki {
46
65
  min-height: 1.5em;
47
66
  justify-content: space-between;
48
67
  font-family: var(--font-mono);
49
- padding: 0 15px;
68
+ padding: 0.3em 1em;
50
69
  user-select: none;
51
70
  overflow: hidden;
52
71
  position: relative;
@@ -66,18 +85,6 @@ figure.shiki {
66
85
  min-width: 0;
67
86
  }
68
87
 
69
- iconify-icon {
70
- cursor: pointer;
71
- transition:
72
- color 0.3s,
73
- transform 0.3s ease;
74
-
75
- &:hover {
76
- transform: scale(1.1);
77
- color: var(--blue);
78
- }
79
- }
80
-
81
88
  > .right {
82
89
  gap: 10px;
83
90
  display: flex;
@@ -85,15 +92,6 @@ figure.shiki {
85
92
  }
86
93
  }
87
94
 
88
- .shiki-tools .expand {
89
- font-size: 1.2em;
90
- margin-left: -2px;
91
- }
92
-
93
- .shiki-tools .expand.closed {
94
- transform: rotate(90deg);
95
- }
96
-
97
95
  .shiki-tools > .right > .copy-notice {
98
96
  position: absolute;
99
97
  white-space: nowrap;
@@ -115,15 +113,14 @@ figure.shiki {
115
113
  .traffic-lights {
116
114
  display: flex;
117
115
  align-items: center;
118
- padding-right: 8px;
119
- margin-left: -7px;
116
+ margin-left: -0.5em;
120
117
  }
121
118
 
122
119
  .traffic-light {
123
- width: 14px;
124
- height: 14px;
120
+ width: 0.8em;
121
+ height: 0.8em;
125
122
  border-radius: 50%;
126
- margin-left: 8px;
123
+ margin-left: 0.5em;
127
124
  position: relative;
128
125
 
129
126
  &.red {
@@ -186,22 +183,6 @@ pre.shiki {
186
183
  width: 100%;
187
184
  margin: 0;
188
185
  font-family: var(--font-mono);
189
-
190
- > span.line {
191
- display: block;
192
- width: fit-content;
193
- min-width: 100%;
194
-
195
- &:before {
196
- content: counter(step);
197
- counter-increment: step;
198
- width: 1.2rem;
199
- margin-right: 1.2rem;
200
- display: inline-block;
201
- text-align: right;
202
- color: #738a9466;
203
- }
204
- }
205
186
  }
206
187
  }
207
188
 
@@ -237,6 +218,22 @@ figure.shiki[data-collapsible="true"].expanded > .code-expand-btn {
237
218
  transform: translateY(0);
238
219
  }
239
220
 
221
+ span.line {
222
+ display: block;
223
+ width: fit-content;
224
+ min-width: 100%;
225
+
226
+ &:before {
227
+ content: counter(step);
228
+ counter-increment: step;
229
+ width: 1.2rem;
230
+ margin-right: 1.2rem;
231
+ display: inline-block;
232
+ text-align: right;
233
+ color: var(--subtext0);
234
+ }
235
+ }
236
+
240
237
  span.line.diff {
241
238
  &.remove {
242
239
  background-color: hsl(from var(--red) h s l / 0.2);
@@ -1657,4 +1654,3 @@ pre.shiki.has-focused > code {
1657
1654
  --shiki-tokyo: #89ddff;
1658
1655
  --shiki-tokyo-font-weight: bold;
1659
1656
  }
1660
-
@@ -0,0 +1,2 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).SwupHeadPlugin=t()}(this,function(){function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.apply(this,arguments)}const t=e=>String(e).split(".").map(e=>String(parseInt(e||"0",10))).concat(["0","0"]).slice(0,3).join(".");class n{constructor(){this.isSwupPlugin=!0,this.swup=void 0,this.version=void 0,this.requires={},this.handlersToUnregister=[]}mount(){}unmount(){this.handlersToUnregister.forEach(e=>e()),this.handlersToUnregister=[]}_beforeMount(){if(!this.name)throw new Error("You must define a name of plugin when creating a class.")}_afterUnmount(){}_checkRequirements(){return"object"!=typeof this.requires||Object.entries(this.requires).forEach(([e,n])=>{if(!function(e,n,r){const s=function(e,t){var n;if("swup"===e)return null!=(n=t.version)?n:"";{var r;const n=t.findPlugin(e);return null!=(r=null==n?void 0:n.version)?r:""}}(e,r);return!!s&&((e,n)=>n.every(n=>{const[,r,s]=n.match(/^([\D]+)?(.*)$/)||[];var o,i;return((e,t)=>{const n={"":e=>0===e,">":e=>e>0,">=":e=>e>=0,"<":e=>e<0,"<=":e=>e<=0};return(n[t]||n[""])(e)})((i=s,o=t(o=e),i=t(i),o.localeCompare(i,void 0,{numeric:!0})),r||">=")}))(s,n)}(e,n=Array.isArray(n)?n:[n],this.swup)){const t=`${e} ${n.join(", ")}`;throw new Error(`Plugin version mismatch: ${this.name} requires ${t}`)}}),!0}on(e,t,n={}){var r;t=!(r=t).name.startsWith("bound ")||r.hasOwnProperty("prototype")?t.bind(this):t;const s=this.swup.hooks.on(e,t,n);return this.handlersToUnregister.push(s),s}once(t,n,r={}){return this.on(t,n,e({},r,{once:!0}))}before(t,n,r={}){return this.on(t,n,e({},r,{before:!0}))}replace(t,n,r={}){return this.on(t,n,e({},r,{replace:!0}))}off(e,t){return this.swup.hooks.off(e,t)}}function r(e){return"title"!==e.localName&&!e.matches("[data-swup-theme]")}function s(e,t){return e.outerHTML===t.outerHTML}function o(e,t){void 0===t&&(t=[]);const n=Array.from(e.attributes);return t.length?n.filter(e=>{let{name:n}=e;return t.some(e=>e instanceof RegExp?e.test(n):n===e)}):n}function i(e){return e.matches("link[rel=stylesheet][href]")}return class extends n{constructor(e){void 0===e&&(e={}),super();const t=this;this.name="SwupHeadPlugin",this.requires={swup:">=4.6"},this.defaults={persistTags:!1,persistAssets:!1,awaitAssets:!1,attributes:["lang","dir"],timeout:3e3},this.options=void 0,this.updateHead=function(e,n){try{const{awaitAssets:n,attributes:u,timeout:a}=t.options,l=e.to.document,{removed:c,added:h}=function(e,t,n){let{shouldPersist:o=()=>!1}=void 0===n?{}:n;const i=Array.from(e.children),u=Array.from(t.children),a=(l=i,u.reduce((e,t,n)=>(l.some(e=>s(t,e))||e.push({el:t,index:n}),e),[]));var l;const c=function(e,t){return e.reduce((e,n)=>(t.some(e=>s(n,e))||e.push({el:n}),e),[])}(i,u);c.reverse().filter(e=>{let{el:t}=e;return r(t)}).filter(e=>{let{el:t}=e;return!o(t)}).forEach(t=>{let{el:n}=t;return e.removeChild(n)});const h=a.filter(e=>{let{el:t}=e;return r(t)}).map(t=>{let n=t.el.cloneNode(!0);return e.insertBefore(n,e.children[(t.index||0)+1]||null),{...t,el:n}});return{removed:c.map(e=>{let{el:t}=e;return t}),added:h.map(e=>{let{el:t}=e;return t})}}(document.head,l.head,{shouldPersist:e=>t.isPersistentTag(e)});t.swup.log(`Removed ${c.length} / added ${h.length} tags in head`),u?.length&&function(e,t,n){void 0===n&&(n=[]);const r=new Set;for(const{name:s,value:i}of o(t,n))e.setAttribute(s,i),r.add(s);for(const{name:t}of o(e,n))r.has(t)||e.removeAttribute(t)}(document.documentElement,l.documentElement,u);const d=function(){if(n){const n=(void 0===(e=a)&&(e=0),h.filter(i).map(t=>function(e,t){let n;void 0===t&&(t=0);const r=t=>{e.sheet?t():n=setTimeout(()=>r(t),10)};return new Promise(s=>{r(()=>s(e)),t>0&&setTimeout(()=>{n&&clearTimeout(n),s(e)},t)})}(t,e))),r=function(){if(n.length)return t.swup.log(`Waiting for ${n.length} assets to load`),Promise.resolve(Promise.all(n)).then(function(){})}();if(r&&r.then)return r.then(function(){})}var e}();return Promise.resolve(d&&d.then?d.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},this.options={...this.defaults,...e},this.options.persistAssets&&!this.options.persistTags&&(this.options.persistTags="link[rel=stylesheet], script[src], style")}mount(){this.before("content:replace",this.updateHead)}isPersistentTag(e){const{persistTags:t}=this.options;return"function"==typeof t?t(e):"string"==typeof t&&t.length>0?e.matches(t):Boolean(t)}}});
2
+ //# sourceMappingURL=index.umd.js.map