bridgetown-stoa 0.3.0 → 0.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 +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +10 -1
- data/Gemfile +4 -0
- data/README.md +5 -2
- data/bridgetown-stoa.gemspec +1 -1
- data/components/bridgetown_stoa/sidebar.rb +66 -0
- data/components/bridgetown_stoa/sidebar.serb +25 -0
- data/layouts/bridgetown-stoa/layout.serb +17 -12
- data/lib/bridgetown-stoa/version.rb +1 -1
- data/lib/bridgetown-stoa.rb +2 -1
- data/package.json +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83deb70eb7aadf2b8a2a8330a4bd64538130c03b57caedeab8bb522189626f67
|
|
4
|
+
data.tar.gz: 9d6414ab667d5b31df27f139a5f8c642c2885e2c7f861ba1c61f041c5aa1803e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 874724dbda2bde6ed7151e0b66b48361631d691301c685e43d223582ae4892a0e285e00776dd81508e419b653508ebeb259cf6fcf7c6cb548f67a1ca5ee4ef81
|
|
7
|
+
data.tar.gz: 889ee47fb5f789c9c74c9ce2ed6d797e295c2642ac30e8402a45daa4656d7749ae7322c0ccbc82a76d48cdd1818ef032e097bff76422bcb777702bb1340ef844
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- `script/release` accepts `--otp CODE` and forwards it to `gem push` via `GEM_HOST_OTP_CODE`, so a TOTP code can stand in for the WebAuthn browser handoff.
|
|
11
|
+
|
|
12
|
+
## [0.4.0] - 2026-09-24
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- Sidebar navigation. `bridgetown-stoa/layout` now renders a `BridgetownStoa::Sidebar` component in a left-hand `<aside>` alongside the site title and footer, with the page body in `<main class="stoa-main">`. The sidebar lists every HTML resource that has a `title`, ordered by `nav_order` (then title), and nests a page under another by setting `parent:` to the parent's title; nested sections render as `<details>` and open automatically when the current page is inside them. Set `nav_exclude: true` in front matter to hide a page. The gem's `components/` directory is now registered on the source manifest so the component can be shadowed by the host site. (#14)
|
|
16
|
+
- `bin/dev` serves the `test/fixtures` site with the theme applied for browser previews. The fixture now carries a standard Bridgetown esbuild + Tailwind v4 (`@tailwindcss/postcss`) frontend, so `asset_path :css` / `:js` resolve to real bundles, and it watches the gem's `layouts/` directory so theme edits live-reload.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- README's Tailwind setup snippet placed `@source` between the two `@import` rules, which made Tailwind and postcss-import silently drop `@import "bridgetown-stoa"`. The imports now come first.
|
|
11
20
|
|
|
12
21
|
## [0.3.0] - 2026-05-22
|
|
13
22
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -34,12 +34,12 @@ Then in `frontend/styles/index.css`, after `@import "tailwindcss";`, add two lin
|
|
|
34
34
|
|
|
35
35
|
```css
|
|
36
36
|
@import "tailwindcss";
|
|
37
|
-
@source "../../node_modules/bridgetown-stoa/layouts/**/*.serb";
|
|
38
37
|
@import "bridgetown-stoa";
|
|
38
|
+
@source "../../node_modules/bridgetown-stoa/layouts/**/*.serb";
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
- `@import "bridgetown-stoa"` pulls in the `@theme` tokens (`--color-stoa-*`, `--font-stoa-*`) and a small `@layer base` that styles `html` with the theme colors. Keep it directly after the Tailwind import: CSS requires all `@import` rules to come before any other rule, and an `@import` placed after `@source` is silently dropped.
|
|
41
42
|
- `@source` tells Tailwind to scan Stoa's layouts for utility-class usage.
|
|
42
|
-
- `@import "bridgetown-stoa"` pulls in the `@theme` tokens (`--color-stoa-*`, `--font-stoa-*`) and a small `@layer base` that styles `html` with the theme colors.
|
|
43
43
|
|
|
44
44
|
Override any token by redeclaring it in your own `@theme` block after the import.
|
|
45
45
|
|
|
@@ -77,8 +77,11 @@ Requires Ruby ≥ 3.2 and Bridgetown ≥ 2.0.
|
|
|
77
77
|
```shell
|
|
78
78
|
bundle install
|
|
79
79
|
script/cibuild # rubocop + minitest
|
|
80
|
+
bin/dev # preview the theme at http://localhost:4000
|
|
80
81
|
```
|
|
81
82
|
|
|
83
|
+
`bin/dev` serves the site in `test/fixtures` with the theme applied, using a standard Bridgetown esbuild + Tailwind pipeline (it runs `bundle install` and `npm install` for you when needed). Edits to `layouts/` and `frontend/styles/` rebuild and live-reload. Extra arguments go to `bridgetown start`, e.g. `bin/dev -P 4001`.
|
|
84
|
+
|
|
82
85
|
Templates use [Serbea](https://www.bridgetownrb.com/docs/template-engines/erb-and-beyond), Bridgetown's ERB-with-Liquid-like-sugar engine. Stoa is **inspired by** just-the-docs, not a port of it — layouts are written idiomatically for Bridgetown rather than translated from upstream.
|
|
83
86
|
|
|
84
87
|
## License
|
data/bridgetown-stoa.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
spec.homepage = "https://github.com/Guided-Rails/bridgetown-stoa"
|
|
12
12
|
spec.license = "MIT"
|
|
13
13
|
|
|
14
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|frontend)/!) }
|
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|bin|spec|features|frontend)/!) }
|
|
15
15
|
spec.test_files = spec.files.grep(%r!^test/!)
|
|
16
16
|
spec.require_paths = ["lib"]
|
|
17
17
|
spec.metadata = {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class BridgetownStoa::Sidebar < Bridgetown::Component
|
|
4
|
+
Node = Struct.new(:title, :url, :order, :parent_title, :current, :children, keyword_init: true)
|
|
5
|
+
|
|
6
|
+
def initialize(site:, current_resource:)
|
|
7
|
+
super()
|
|
8
|
+
@site = site
|
|
9
|
+
@current_resource = current_resource
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def tree
|
|
13
|
+
@tree ||= build_tree
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def section_open?(node)
|
|
17
|
+
return true if node.current
|
|
18
|
+
|
|
19
|
+
node.children.any? { |child| section_open?(child) }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def navigable_resources
|
|
25
|
+
@site.resources.select do |r|
|
|
26
|
+
next false if r.data[:nav_exclude]
|
|
27
|
+
next false unless r.data[:title]
|
|
28
|
+
next false unless r.output_ext == ".html"
|
|
29
|
+
|
|
30
|
+
true
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def build_tree
|
|
35
|
+
nodes = navigable_resources.map { |r| build_node(r) }
|
|
36
|
+
by_title = nodes.to_h { |n| [n.title, n] }
|
|
37
|
+
|
|
38
|
+
roots = nodes.each_with_object([]) do |node, acc|
|
|
39
|
+
parent = node.parent_title && by_title[node.parent_title]
|
|
40
|
+
if parent && parent != node
|
|
41
|
+
parent.children << node
|
|
42
|
+
else
|
|
43
|
+
acc << node
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
sort_nodes!(roots)
|
|
48
|
+
roots
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def build_node(resource)
|
|
52
|
+
Node.new(
|
|
53
|
+
title: resource.data[:title],
|
|
54
|
+
url: resource.relative_url,
|
|
55
|
+
order: resource.data[:nav_order],
|
|
56
|
+
parent_title: resource.data[:parent],
|
|
57
|
+
current: resource == @current_resource,
|
|
58
|
+
children: []
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def sort_nodes!(nodes)
|
|
63
|
+
nodes.sort_by! { |n| [n.order || Float::INFINITY, n.title.to_s.downcase] }
|
|
64
|
+
nodes.each { |n| sort_nodes!(n.children) }
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<nav class="stoa-sidebar" aria-label="Documentation navigation">
|
|
2
|
+
<ul>
|
|
3
|
+
{% tree.each do |node| %}
|
|
4
|
+
{% if node.children.any? %}
|
|
5
|
+
<li class="stoa-nav-parent">
|
|
6
|
+
<a href="{{ node.url }}"{% if node.current %} aria-current="page"{% end %}>{{ node.title }}</a>
|
|
7
|
+
<details{% if section_open?(node) %} open{% end %}>
|
|
8
|
+
<summary aria-label="Toggle {{ node.title }} section"></summary>
|
|
9
|
+
<ul>
|
|
10
|
+
{% node.children.each do |child| %}
|
|
11
|
+
<li>
|
|
12
|
+
<a href="{{ child.url }}"{% if child.current %} aria-current="page"{% end %}>{{ child.title }}</a>
|
|
13
|
+
</li>
|
|
14
|
+
{% end %}
|
|
15
|
+
</ul>
|
|
16
|
+
</details>
|
|
17
|
+
</li>
|
|
18
|
+
{% else %}
|
|
19
|
+
<li>
|
|
20
|
+
<a href="{{ node.url }}"{% if node.current %} aria-current="page"{% end %}>{{ node.title }}</a>
|
|
21
|
+
</li>
|
|
22
|
+
{% end %}
|
|
23
|
+
{% end %}
|
|
24
|
+
</ul>
|
|
25
|
+
</nav>
|
|
@@ -14,20 +14,25 @@
|
|
|
14
14
|
{% end %}
|
|
15
15
|
<link rel="stylesheet" href="{%= asset_path :css %}">
|
|
16
16
|
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
17
|
+
<body class="stoa-shell">
|
|
18
|
+
<aside class="stoa-sidebar-shell">
|
|
19
|
+
<header class="stoa-brand">
|
|
20
|
+
<a href="/" class="stoa-site-title">{{ site.metadata.title }}</a>
|
|
21
|
+
</header>
|
|
22
|
+
{%= render BridgetownStoa::Sidebar.new(site: site, current_resource: resource) %}
|
|
23
|
+
<footer class="stoa-sidebar-footer">
|
|
24
|
+
<small>
|
|
25
|
+
Built with <a href="https://www.bridgetownrb.com">Bridgetown</a>
|
|
26
|
+
<span>+</span>
|
|
27
|
+
<a href="https://github.com/Guided-Rails/bridgetown-stoa">Stoa</a>.
|
|
28
|
+
</small>
|
|
29
|
+
</footer>
|
|
30
|
+
</aside>
|
|
21
31
|
<main class="stoa-main">
|
|
22
|
-
|
|
32
|
+
<div class="stoa-content">
|
|
33
|
+
{%= yield %}
|
|
34
|
+
</div>
|
|
23
35
|
</main>
|
|
24
|
-
<footer class="stoa-footer">
|
|
25
|
-
<small>
|
|
26
|
-
Built with <a href="https://www.bridgetownrb.com">Bridgetown</a>
|
|
27
|
-
<span>+</span>
|
|
28
|
-
<a href="https://github.com/Guided-Rails/bridgetown-stoa">Stoa</a>.
|
|
29
|
-
</small>
|
|
30
|
-
</footer>
|
|
31
36
|
<script src="{%= asset_path :js %}" defer></script>
|
|
32
37
|
</body>
|
|
33
38
|
</html>
|
data/lib/bridgetown-stoa.rb
CHANGED
|
@@ -15,6 +15,7 @@ Bridgetown.initializer :"bridgetown-stoa" do |config|
|
|
|
15
15
|
|
|
16
16
|
config.source_manifest(
|
|
17
17
|
origin: BridgetownStoa,
|
|
18
|
-
layouts: File.expand_path("../layouts", __dir__)
|
|
18
|
+
layouts: File.expand_path("../layouts", __dir__),
|
|
19
|
+
components: File.expand_path("../components", __dir__)
|
|
19
20
|
)
|
|
20
21
|
end
|
data/package.json
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bridgetown-stoa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abdullah Hashim
|
|
@@ -80,6 +80,8 @@ files:
|
|
|
80
80
|
- README.md
|
|
81
81
|
- Rakefile
|
|
82
82
|
- bridgetown-stoa.gemspec
|
|
83
|
+
- components/bridgetown_stoa/sidebar.rb
|
|
84
|
+
- components/bridgetown_stoa/sidebar.serb
|
|
83
85
|
- layouts/bridgetown-stoa/layout.serb
|
|
84
86
|
- lib/bridgetown-stoa.rb
|
|
85
87
|
- lib/bridgetown-stoa/version.rb
|
|
@@ -88,7 +90,7 @@ homepage: https://github.com/Guided-Rails/bridgetown-stoa
|
|
|
88
90
|
licenses:
|
|
89
91
|
- MIT
|
|
90
92
|
metadata:
|
|
91
|
-
yarn-add: bridgetown-stoa@0.
|
|
93
|
+
yarn-add: bridgetown-stoa@0.4.0
|
|
92
94
|
rdoc_options: []
|
|
93
95
|
require_paths:
|
|
94
96
|
- lib
|