jekyll-vitepress-theme 1.5.0 → 1.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39b278e0794a067003ad3429adb3ff6069023850168c8fea94a41c97e0e02aaa
4
- data.tar.gz: c19f3340ff9d10dbd175daff50bfcbe6800ada67f8922eac7217b2882e853d75
3
+ metadata.gz: 9311e77e3a4da8bb4c4bd8b72b998c102ed866ea9f454f7c0351b1d066bb96c1
4
+ data.tar.gz: e6284f81f16507c6bd4e12558add7a268aa8e6b448d4573cab3e0402cab91ed5
5
5
  SHA512:
6
- metadata.gz: 6fe07bde949fe99f69ea54a28736b0a3742e4608c548e34d1969df70f80119c4833437696c0bc22ada0e8b9d37ff089f36db52c15db64aba2a69c2a043043ebf
7
- data.tar.gz: cc5f979de2a06f80e598cc1b98fbd4767e4a15be238a638f5932e0f8d799757169431043ab7922709c51a0503d1cd294203251fac2582d5c5639a7966a0cb5c7
6
+ metadata.gz: f05628791f3a073c68aeb0d740a99df887ea30076429ddbba09a8aab1e5471d6a622480c1dc6dd493825662d42b4460b2b43b99946582a404875a7928f8408f4
7
+ data.tar.gz: bb7392a9115e82189d6f3424c4852a4b4992025a80211de84cca09a404fcd12ad63b241db91f4ed756d3a5fd1cf474f9ece61cc5376245a3c2a0d4a36e028d6c
@@ -4,13 +4,13 @@
4
4
  {% endif %}
5
5
  <div class="copy-md-group">
6
6
  <button class="copy-md-btn" type="button" title="Copy page as Markdown">
7
- <span class="vpi-copy"></span>
8
- <span class="copy-md-label">Copy page</span>
7
+ <span class="vpi-copy copy-md-icon" aria-hidden="true"></span>
8
+ <span class="copy-md-label" aria-live="polite">Copy page</span>
9
9
  </button>
10
10
  <button class="copy-md-toggle" type="button" aria-label="More options" aria-expanded="false">
11
11
  <span class="vpi-chevron-down copy-md-chevron"></span>
12
12
  </button>
13
- <div class="copy-md-dropdown" hidden>
13
+ <div class="copy-md-dropdown vp-menu-transition" aria-hidden="true">
14
14
  <button class="copy-md-dropdown-item" type="button" data-action="copy">
15
15
  <span class="vpi-copy copy-md-dropdown-icon"></span>
16
16
  <div class="copy-md-dropdown-text">
data/_includes/nav.html CHANGED
@@ -144,7 +144,7 @@
144
144
  <button type="button" class="button" id="vp-nav-extra-button" aria-haspopup="true" aria-expanded="false" aria-controls="vp-nav-extra-menu" aria-label="extra navigation">
145
145
  <span class="vpi-more-horizontal icon" aria-hidden="true"></span>
146
146
  </button>
147
- <div class="menu" id="vp-nav-extra-menu" aria-hidden="true">
147
+ <div class="menu vp-menu-transition" id="vp-nav-extra-menu" aria-hidden="true">
148
148
  <div class="VPMenu">
149
149
  <div class="group">
150
150
  <div class="item appearance">
@@ -46,6 +46,23 @@ body.vp-nav-screen-open .VPNav {
46
46
  pointer-events: auto;
47
47
  }
48
48
 
49
+ .vp-menu-transition {
50
+ opacity: 0;
51
+ visibility: hidden;
52
+ transform: translateY(-4px);
53
+ pointer-events: none;
54
+ transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
55
+ }
56
+
57
+ .vp-menu-transition[aria-hidden="false"],
58
+ .VPNavBarExtra:hover > .vp-menu-transition,
59
+ .VPNavBarExtra.open > .vp-menu-transition {
60
+ opacity: 1;
61
+ visibility: visible;
62
+ transform: translateY(0);
63
+ pointer-events: auto;
64
+ }
65
+
49
66
  .VPNavBar > .wrapper > .container > .title,
50
67
  .VPNavBar > .wrapper > .container > .content > .content-body,
51
68
  .vp-doc div[class*='language-'],
@@ -394,16 +411,6 @@ body.vp-nav-screen-open .VPNav {
394
411
  top: calc(var(--vp-nav-height) / 2 + 20px);
395
412
  right: 0;
396
413
  z-index: calc(var(--vp-z-index-nav) + 1);
397
- opacity: 0;
398
- visibility: hidden;
399
- transform: translateY(0);
400
- transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
401
- }
402
-
403
- .VPNavBarExtra:hover .menu,
404
- .VPNavBarExtra.open .menu {
405
- opacity: 1;
406
- visibility: visible;
407
414
  }
408
415
 
409
416
  .VPNavBarExtra .VPMenu {
@@ -1117,6 +1124,10 @@ body.vp-search-open {
1117
1124
  font-variant-numeric: tabular-nums;
1118
1125
  }
1119
1126
 
1127
+ .VPButton.VPMetricButton .VPMetricButtonCount {
1128
+ color: inherit;
1129
+ }
1130
+
1120
1131
  .VPMetricButtonText[hidden],
1121
1132
  .VPMetricButtonCount[hidden] {
1122
1133
  display: none !important;
@@ -1786,6 +1797,18 @@ html.dark .only-light {
1786
1797
  margin-left: 8px;
1787
1798
  }
1788
1799
 
1800
+ .vp-doc h2.d-inline-block + p.label {
1801
+ margin-top: 73px;
1802
+ }
1803
+
1804
+ .vp-doc h3.d-inline-block + p.label {
1805
+ margin-top: 32px;
1806
+ }
1807
+
1808
+ .vp-doc h4.d-inline-block + p.label {
1809
+ margin-top: 24px;
1810
+ }
1811
+
1789
1812
  .vp-doc :is(p, blockquote):is(.info, .note, .tip, .important, .warning, .danger, .caution) {
1790
1813
  border: 1px solid transparent;
1791
1814
  border-radius: 8px;
@@ -1915,8 +1938,7 @@ html.dark .only-light {
1915
1938
  }
1916
1939
 
1917
1940
  /* Copy as Markdown button group */
1918
- .vp-doc-header,
1919
- .vp-doc-title-row {
1941
+ .vp-doc-header {
1920
1942
  display: flex;
1921
1943
  align-items: center;
1922
1944
  justify-content: space-between;
@@ -1924,16 +1946,24 @@ html.dark .only-light {
1924
1946
  flex-wrap: wrap;
1925
1947
  }
1926
1948
 
1927
- .vp-doc-header h1,
1928
- .vp-doc-title-row h1 {
1949
+ .vp-doc-header:not(:has(> h1)) {
1950
+ float: right;
1951
+ justify-content: flex-end;
1952
+ margin: 0 0 16px 24px;
1953
+ }
1954
+
1955
+ .vp-doc-header h1 {
1929
1956
  margin-top: 0;
1930
1957
  margin-bottom: 0;
1931
1958
  flex: 1 1 320px;
1932
1959
  min-width: 0;
1933
1960
  }
1934
1961
 
1935
- .vp-doc-header .copy-md-group,
1936
- .vp-doc-title-row .copy-md-group {
1962
+ .vp-doc-header:not(:has(> h1)) .copy-md-group {
1963
+ margin-left: 0;
1964
+ }
1965
+
1966
+ .vp-doc-header .copy-md-group {
1937
1967
  margin-left: auto;
1938
1968
  }
1939
1969
 
@@ -1942,6 +1972,10 @@ html.dark .only-light {
1942
1972
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/g%3E%3C/svg%3E");
1943
1973
  }
1944
1974
 
1975
+ .vpi-check {
1976
+ --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m20 6l-11 11l-5-5'/%3E%3C/svg%3E");
1977
+ }
1978
+
1945
1979
  .vpi-file-text {
1946
1980
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/g%3E%3C/svg%3E");
1947
1981
  }
@@ -1955,11 +1989,12 @@ html.dark .only-light {
1955
1989
  border: 1px solid var(--vp-c-divider);
1956
1990
  border-radius: 6px;
1957
1991
  background: var(--vp-c-bg-soft);
1958
- transition: color 0.25s, border-color 0.25s, background-color 0.25s;
1992
+ transition: border-color 0.25s, background-color 0.25s;
1959
1993
  }
1960
1994
 
1961
1995
  .copy-md-group:hover {
1962
1996
  border-color: var(--vp-c-brand-1);
1997
+ background: var(--vp-c-bg-elv);
1963
1998
  }
1964
1999
 
1965
2000
  .copy-md-btn {
@@ -1978,7 +2013,7 @@ html.dark .only-light {
1978
2013
  white-space: nowrap;
1979
2014
  }
1980
2015
 
1981
- .copy-md-btn .vpi-copy {
2016
+ .copy-md-icon {
1982
2017
  width: 14px;
1983
2018
  height: 14px;
1984
2019
  }
@@ -1988,10 +2023,6 @@ html.dark .only-light {
1988
2023
  background: var(--vp-c-bg-elv);
1989
2024
  }
1990
2025
 
1991
- .copy-md-btn.copied {
1992
- color: var(--vp-c-green-1, #42b883);
1993
- }
1994
-
1995
2026
  .copy-md-toggle {
1996
2027
  display: inline-flex;
1997
2028
  align-items: center;
@@ -302,7 +302,8 @@
302
302
  return;
303
303
  }
304
304
 
305
- var formatted = formatGitHubStarCount(value);
305
+ var metricButton = button.classList.contains('VPMetricButton');
306
+ var formatted = metricButton ? formatExactCount(value) : formatGitHubStarCount(value);
306
307
  if (!formatted) {
307
308
  return;
308
309
  }
@@ -310,12 +311,11 @@
310
311
  countElement.textContent = formatted;
311
312
  countElement.hidden = false;
312
313
 
313
- if (button.classList.contains('VPMetricButton')) {
314
+ if (metricButton) {
314
315
  var repository = button.getAttribute('data-github-star-repo');
315
- var exactCount = formatExactCount(value);
316
- button.title = exactCount + ' GitHub stars';
316
+ button.title = formatted + ' GitHub stars';
317
317
  if (repository) {
318
- button.setAttribute('aria-label', 'Star ' + repository + ' on GitHub: ' + exactCount + ' stars');
318
+ button.setAttribute('aria-label', 'Star ' + repository + ' on GitHub: ' + formatted + ' stars');
319
319
  }
320
320
  }
321
321
  }
@@ -1403,35 +1403,6 @@
1403
1403
  return null;
1404
1404
  }
1405
1405
 
1406
- function alignCopyPageButtonWithHeading() {
1407
- var header = document.querySelector('.vp-doc-header');
1408
- var group = header && header.querySelector('.copy-md-group');
1409
- if (!header || !group || header.querySelector('h1')) {
1410
- return;
1411
- }
1412
-
1413
- var titleHeading = resolveCopyPageTitleHeading();
1414
- if (!titleHeading) {
1415
- return;
1416
- }
1417
-
1418
- var titleRow = titleHeading.closest('.vp-doc-title-row');
1419
- if (!titleRow) {
1420
- titleRow = document.createElement('div');
1421
- titleRow.className = 'vp-doc-title-row';
1422
- titleHeading.parentNode.insertBefore(titleRow, titleHeading);
1423
- titleRow.appendChild(titleHeading);
1424
- }
1425
-
1426
- titleRow.appendChild(group);
1427
-
1428
- if (!header.querySelector('*')) {
1429
- header.hidden = true;
1430
- }
1431
- }
1432
-
1433
- alignCopyPageButtonWithHeading();
1434
-
1435
1406
  function copyPageMarkdown(btn) {
1436
1407
  if (!btn) return;
1437
1408
 
@@ -1449,15 +1420,23 @@
1449
1420
  }
1450
1421
  }
1451
1422
 
1423
+ var icon = btn.querySelector('.copy-md-icon');
1452
1424
  var label = btn.querySelector('.copy-md-label');
1425
+ function setCopied(copied) {
1426
+ btn.classList.toggle('copied', copied);
1427
+ if (icon) {
1428
+ icon.classList.toggle('vpi-copy', !copied);
1429
+ icon.classList.toggle('vpi-check', copied);
1430
+ }
1431
+ if (label) label.textContent = copied ? 'Copied' : 'Copy page';
1432
+ }
1433
+
1453
1434
  writeToClipboard(md)
1454
1435
  .then(function () {
1455
- btn.classList.add('copied');
1456
- if (label) label.textContent = 'Copied';
1436
+ setCopied(true);
1457
1437
  if (btn._copyTimeout) window.clearTimeout(btn._copyTimeout);
1458
1438
  btn._copyTimeout = window.setTimeout(function () {
1459
- btn.classList.remove('copied');
1460
- if (label) label.textContent = 'Copy page';
1439
+ setCopied(false);
1461
1440
  }, 2000);
1462
1441
  })
1463
1442
  .catch(function () {});
@@ -1468,7 +1447,33 @@
1468
1447
  var dropdown = document.querySelector('.copy-md-dropdown');
1469
1448
  var dropdownCopy = dropdown ? dropdown.querySelector('[data-action="copy"]') : null;
1470
1449
 
1450
+ function setCopyPageDropdownOpen(open) {
1451
+ if (!dropdown || !toggle) {
1452
+ return;
1453
+ }
1454
+
1455
+ if (dropdown.hidden) {
1456
+ dropdown.hidden = false;
1457
+ }
1458
+
1459
+ dropdown.setAttribute('aria-hidden', String(!open));
1460
+ toggle.setAttribute('aria-expanded', String(open));
1461
+ }
1462
+
1463
+ function isCopyPageDropdownOpen() {
1464
+ return !!(dropdown && dropdown.getAttribute('aria-hidden') === 'false');
1465
+ }
1466
+
1471
1467
  function bindCopyPageControls() {
1468
+ if (dropdown) {
1469
+ if (dropdown.hidden) {
1470
+ dropdown.hidden = false;
1471
+ }
1472
+ if (!dropdown.hasAttribute('aria-hidden')) {
1473
+ dropdown.setAttribute('aria-hidden', 'true');
1474
+ }
1475
+ }
1476
+
1472
1477
  if (copyMdBtn && !copyMdBtn.hasAttribute('data-vp-bound')) {
1473
1478
  copyMdBtn.setAttribute('data-vp-bound', 'true');
1474
1479
  copyMdBtn.addEventListener('click', function () {
@@ -1480,9 +1485,7 @@
1480
1485
  toggle.setAttribute('data-vp-bound', 'true');
1481
1486
  toggle.addEventListener('click', function (e) {
1482
1487
  e.stopPropagation();
1483
- var open = !dropdown.hidden;
1484
- dropdown.hidden = !dropdown.hidden;
1485
- toggle.setAttribute('aria-expanded', String(!open));
1488
+ setCopyPageDropdownOpen(!isCopyPageDropdownOpen());
1486
1489
  });
1487
1490
  }
1488
1491
 
@@ -1490,10 +1493,7 @@
1490
1493
  if (dropdownCopy && !dropdownCopy.hasAttribute('data-vp-bound')) {
1491
1494
  dropdownCopy.setAttribute('data-vp-bound', 'true');
1492
1495
  dropdownCopy.addEventListener('click', function () {
1493
- dropdown.hidden = true;
1494
- if (toggle) {
1495
- toggle.setAttribute('aria-expanded', 'false');
1496
- }
1496
+ setCopyPageDropdownOpen(false);
1497
1497
  copyPageMarkdown(copyMdBtn);
1498
1498
  });
1499
1499
  }
@@ -1502,19 +1502,17 @@
1502
1502
  bindCopyPageControls();
1503
1503
 
1504
1504
  document.addEventListener('click', function (e) {
1505
- if (!dropdown || !toggle || dropdown.hidden) {
1505
+ if (!dropdown || !toggle || !isCopyPageDropdownOpen()) {
1506
1506
  return;
1507
1507
  }
1508
1508
  if (!dropdown.contains(e.target) && !toggle.contains(e.target)) {
1509
- dropdown.hidden = true;
1510
- toggle.setAttribute('aria-expanded', 'false');
1509
+ setCopyPageDropdownOpen(false);
1511
1510
  }
1512
1511
  });
1513
1512
 
1514
1513
  document.addEventListener('keydown', function (e) {
1515
- if (e.key === 'Escape' && dropdown && toggle && !dropdown.hidden) {
1516
- dropdown.hidden = true;
1517
- toggle.setAttribute('aria-expanded', 'false');
1514
+ if (e.key === 'Escape' && dropdown && toggle && isCopyPageDropdownOpen()) {
1515
+ setCopyPageDropdownOpen(false);
1518
1516
  toggle.focus();
1519
1517
  }
1520
1518
  });
@@ -2256,7 +2254,6 @@
2256
2254
  bindCopyPageControls();
2257
2255
 
2258
2256
  addCopyButtons();
2259
- alignCopyPageButtonWithHeading();
2260
2257
  enhanceDocFrameLinks();
2261
2258
 
2262
2259
  content = document.querySelector('.vp-doc');
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module VitePressTheme
3
- VERSION = "1.5.0".freeze
3
+ VERSION = "1.5.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-vitepress-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carmine Paolino