jekyll-vitepress-theme 1.3.0 → 1.4.0

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: 647316f68a7edd8f657e980003c6b064bab2c69b0e1f279047cd6bd9199c5102
4
- data.tar.gz: 3a9e1bed45e86b11d8df502f9f1f2916191965ed377ceedaa7df0f1cec15725e
3
+ metadata.gz: f175074cdc25f3c9545388ece6e5140ac1b31e514641a6c1ab66612b996ba5fc
4
+ data.tar.gz: 98d3593dae2959af719fe81d7b01cba9d7a8ca739cb6bd573d9a710d653b96be
5
5
  SHA512:
6
- metadata.gz: 6539cb54e120f1cfc45506c1f94e844ae35d21048908a46aa9865a05ad35adb12d24db70a5750ebddb41f6278c39bd8c35ae15a39a718685c4905058e2014d48
7
- data.tar.gz: e4e66dcbb3631ae7cdf5f6751e6ba47e6da64ec3e97f9350c1ef53e6b08e84a13ba78bf9d579376a2142cc1217d93ea94ba831e7c4ed66df1b65a01cb302283c
6
+ metadata.gz: 44d14ac6e9e6785003b8e9d99e53961f6a6b8c0d4559f5e77f5ee4ff159ff69cc412a03377ce70d6087db59b795ee86f01fcd3816c0b00aea3c1c76040f4d6b5
7
+ data.tar.gz: 1ea58cd6c5e5f2326bf166bbebd6fb6aed35c851ede6a8715116f32a5c24409f176df8794efff35d3070ab484553d7317e371c9f6b237fc7ff0359a299cdf9ec
data/README.md CHANGED
@@ -23,7 +23,7 @@ The unusual part is navigation. Internal docs links use Turbo Frames, so page ch
23
23
 
24
24
  ## Why Use It
25
25
 
26
- - **VitePress-like UX:** top nav, persistent sidebar, right outline, doc footer pager, search modal, and theme toggle.
26
+ - **VitePress-like UX:** top nav, persistent sidebar, right outline, doc footer pager, search modal, theme toggle, and optional GitHub Star/Sponsor buttons.
27
27
  - **Turbo page navigation:** only the docs content frame swaps, so the shell stays in place and page changes feel fast.
28
28
  - **Jekyll-native setup:** configure everything with `_config.yml`, `_data/*.yml`, collections, includes, and frontmatter.
29
29
  - **Ruby syntax pipeline:** Rouge powers light and dark syntax themes without a separate JavaScript build.
data/_includes/nav.html CHANGED
@@ -29,6 +29,29 @@
29
29
  {% if github_star_enabled %}
30
30
  {% assign github_star_url = 'https://github.com/' | append: github_star_repository %}
31
31
  {% endif %}
32
+ {% assign github_sponsor_config = theme.github_sponsor %}
33
+ {% assign github_sponsor_enabled = false %}
34
+ {% assign github_sponsor_url = nil %}
35
+ {% assign github_sponsor_text = 'Sponsor' %}
36
+ {% assign github_sponsor_label = 'Sponsor on GitHub' %}
37
+ {% if github_sponsor_config and github_sponsor_config != false %}
38
+ {% assign github_sponsor_user = github_sponsor_config.user | default: github_sponsor_config.username | default: github_sponsor_config.account %}
39
+ {% assign github_sponsor_url = github_sponsor_config.url %}
40
+ {% if github_sponsor_url == nil or github_sponsor_url == '' %}
41
+ {% if github_sponsor_user %}
42
+ {% assign github_sponsor_url = 'https://github.com/sponsors/' | append: github_sponsor_user %}
43
+ {% endif %}
44
+ {% endif %}
45
+ {% if github_sponsor_config.text %}
46
+ {% assign github_sponsor_text = github_sponsor_config.text %}
47
+ {% endif %}
48
+ {% if github_sponsor_config.label %}
49
+ {% assign github_sponsor_label = github_sponsor_config.label %}
50
+ {% endif %}
51
+ {% if github_sponsor_config.enabled != false and github_sponsor_url %}
52
+ {% assign github_sponsor_enabled = true %}
53
+ {% endif %}
54
+ {% endif %}
32
55
 
33
56
  <header class="VPNav">
34
57
  <div class="VPNavBar{% if include.has_sidebar %} has-sidebar{% endif %}{% if include.is_home %} home{% endif %} top" id="vp-nav-bar">
@@ -151,6 +174,18 @@
151
174
  </a>
152
175
  </div>
153
176
  {% endif %}
177
+ {% if github_sponsor_enabled %}
178
+ <div class="VPNavBarStar VPNavBarSponsor">
179
+ <a class="VPLink link no-icon VPNavBarStarLink VPNavBarSponsorLink" href="{{ github_sponsor_url }}" aria-label="{{ github_sponsor_label | escape }}" target="_blank" rel="noreferrer noopener">
180
+ <span class="VPNavBarSponsorIcon" aria-hidden="true">
181
+ <svg viewBox="0 0 16 16" focusable="false">
182
+ <path d="M8 13.25l-.7-.64C3.1 8.79 1 6.88 1 4.5 1 2.56 2.56 1 4.5 1c1.1 0 2.15.51 2.83 1.31A3.76 3.76 0 0 1 10.5 1C12.44 1 14 2.56 14 4.5c0 2.38-2.1 4.29-6.3 8.11l-.7.64z"></path>
183
+ </svg>
184
+ </span>
185
+ <span class="VPNavBarStarText">{{ github_sponsor_text }}</span>
186
+ </a>
187
+ </div>
188
+ {% endif %}
154
189
 
155
190
  {% for social in social_links %}
156
191
  {% assign social_icon_name = social.icon %}
@@ -196,6 +231,18 @@
196
231
  </a>
197
232
  </div>
198
233
  {% endif %}
234
+ {% if github_sponsor_enabled %}
235
+ <div class="VPNavBarStar VPNavBarSponsor" id="vp-nav-sponsor">
236
+ <a class="VPLink link no-icon VPNavBarStarLink VPNavBarSponsorLink" href="{{ github_sponsor_url }}" aria-label="{{ github_sponsor_label | escape }}" target="_blank" rel="noreferrer noopener">
237
+ <span class="VPNavBarSponsorIcon" aria-hidden="true">
238
+ <svg viewBox="0 0 16 16" focusable="false">
239
+ <path d="M8 13.25l-.7-.64C3.1 8.79 1 6.88 1 4.5 1 2.56 2.56 1 4.5 1c1.1 0 2.15.51 2.83 1.31A3.76 3.76 0 0 1 10.5 1C12.44 1 14 2.56 14 4.5c0 2.38-2.1 4.29-6.3 8.11l-.7.64z"></path>
240
+ </svg>
241
+ </span>
242
+ <span class="VPNavBarStarText">{{ github_sponsor_text }}</span>
243
+ </a>
244
+ </div>
245
+ {% endif %}
199
246
  {% for social in social_links %}
200
247
  {% assign social_icon_name = social.icon %}
201
248
  {% assign social_icon_svg = social.icon_svg %}
@@ -304,6 +351,18 @@
304
351
  </a>
305
352
  </div>
306
353
  {% endif %}
354
+ {% if github_sponsor_enabled %}
355
+ <div class="VPNavBarStar VPNavScreenStar VPNavBarSponsor">
356
+ <a class="VPLink link no-icon VPNavBarStarLink VPNavScreenStarLink VPNavBarSponsorLink" href="{{ github_sponsor_url }}" aria-label="{{ github_sponsor_label | escape }}" target="_blank" rel="noreferrer noopener">
357
+ <span class="VPNavBarSponsorIcon" aria-hidden="true">
358
+ <svg viewBox="0 0 16 16" focusable="false">
359
+ <path d="M8 13.25l-.7-.64C3.1 8.79 1 6.88 1 4.5 1 2.56 2.56 1 4.5 1c1.1 0 2.15.51 2.83 1.31A3.76 3.76 0 0 1 10.5 1C12.44 1 14 2.56 14 4.5c0 2.38-2.1 4.29-6.3 8.11l-.7.64z"></path>
360
+ </svg>
361
+ </span>
362
+ <span class="VPNavBarStarText">{{ github_sponsor_text }}</span>
363
+ </a>
364
+ </div>
365
+ {% endif %}
307
366
  {% for social in social_links %}
308
367
  {% assign social_icon_name = social.icon %}
309
368
  {% assign social_icon_svg = social.icon_svg %}
@@ -302,6 +302,20 @@ body.vp-nav-screen-open .VPNav {
302
302
  color: currentcolor;
303
303
  }
304
304
 
305
+ .VPNavBarSponsorIcon {
306
+ display: inline-flex;
307
+ width: 20px;
308
+ height: 20px;
309
+ color: currentcolor;
310
+ }
311
+
312
+ .VPNavBarSponsorIcon svg {
313
+ display: block;
314
+ width: 100%;
315
+ height: 100%;
316
+ fill: currentcolor;
317
+ }
318
+
305
319
  .VPNavBarStarText,
306
320
  .VPNavBarStarCount {
307
321
  display: none;
@@ -338,6 +352,11 @@ body.vp-nav-screen-open .VPNav {
338
352
  height: 14px;
339
353
  }
340
354
 
355
+ .VPNavBarSponsorIcon {
356
+ width: 14px;
357
+ height: 14px;
358
+ }
359
+
341
360
  .VPNavBarStarText {
342
361
  display: inline;
343
362
  }
@@ -498,6 +517,11 @@ body.vp-nav-screen-open .VPNav {
498
517
  height: 14px;
499
518
  }
500
519
 
520
+ .VPNavScreenSocialLinks .VPNavBarSponsorIcon {
521
+ width: 14px;
522
+ height: 14px;
523
+ }
524
+
501
525
  .VPNavScreenSocialLinks .VPNavBarStarText,
502
526
  .VPNavScreenSocialLinks .VPNavBarStarCount {
503
527
  display: inline;
@@ -1945,6 +1945,23 @@
1945
1945
  syncPersistentNavState();
1946
1946
 
1947
1947
  if (window.Turbo) {
1948
+ document.addEventListener('turbo:frame-missing', function (event) {
1949
+ if (!event.target || event.target.id !== 'vp-content-frame') {
1950
+ return;
1951
+ }
1952
+
1953
+ event.preventDefault();
1954
+
1955
+ if (event.detail && typeof event.detail.visit === 'function' && event.detail.response) {
1956
+ event.detail.visit(event.detail.response);
1957
+ return;
1958
+ }
1959
+
1960
+ if (event.detail && event.detail.response && event.detail.response.url) {
1961
+ window.location.href = event.detail.response.url;
1962
+ }
1963
+ });
1964
+
1948
1965
  document.addEventListener('turbo:frame-load', function (event) {
1949
1966
  if (!event.target || event.target.id !== 'vp-content-frame') {
1950
1967
  return;
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module VitePressTheme
3
- VERSION = "1.3.0".freeze
3
+ VERSION = "1.4.0".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.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carmine Paolino