docs-kit 1.0.5 → 1.0.6
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51075e7a45365a86a3f97c35341cd2288ad35aba3f9ed1f4e31cea17edcacbfc
|
|
4
|
+
data.tar.gz: b5f49f3397f6b5d9090ee4560d82242a063a2cf8d0a7682c7a2fe7154364541f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b725ba25e7919148f89c6511300a0998e2d6d9d9539d84fa4c845cc8b933a24ba08c79131de936872000c4b56d787e8eeab17f9e46e8fbbe1a03a8b9d6eabf5
|
|
7
|
+
data.tar.gz: 11c6600410734838f11aa53957ccfeb89808996511e4b377e41b23e2d6f6afc23cee5cf161a44e12bb61c48e194843b09ed4550d4c341403b2806804f05bdf1e
|
data/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
### Added
|
|
20
20
|
|
|
21
|
+
- **`DocsUI::Landing` hero logo (`c.landing.logo`).** The landing hero now takes
|
|
22
|
+
an optional brand mark above the eyebrow, in two forms: an inline single-path
|
|
23
|
+
SVG (`{ svg: "<path d>", viewbox:, label: }`, rendered with `fill: currentColor`
|
|
24
|
+
so it adapts to the theme) or an image (`{ src:, alt: }`, resolved through the
|
|
25
|
+
site's asset pipeline). nil (the default) omits it, so it's backwards-compatible.
|
|
26
|
+
This closes the gap a mounted docs app hit — a hero with no way to show the
|
|
27
|
+
product's own logo — the first consumer to try `DocsUI::Landing` on a real site.
|
|
21
28
|
- **`DocsUI::Landing` — a config-driven marketing landing page.** Every consuming
|
|
22
29
|
site (and this dogfood site) was hand-rolling a home page; now render
|
|
23
30
|
`DocsUI::Landing` and drive it from a new `c.landing` config block
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module DocsUI
|
|
4
|
-
# The marketing landing page — a hero (
|
|
5
|
-
# snippet + CTA buttons), a feature-card grid, and a
|
|
6
|
-
# documentation index — rendered inside DocsUI::Shell. Every
|
|
7
|
-
# hand-rolling this; drive it from config instead:
|
|
4
|
+
# The marketing landing page — a hero (an optional brand logo + eyebrow + title +
|
|
5
|
+
# lead + optional install snippet + CTA buttons), a feature-card grid, and a
|
|
6
|
+
# registry-grouped documentation index — rendered inside DocsUI::Shell. Every
|
|
7
|
+
# consuming site was hand-rolling this; drive it from config instead:
|
|
8
8
|
#
|
|
9
9
|
# # config/initializers/docs_kit.rb
|
|
10
10
|
# DocsKit.configure do |c|
|
|
11
|
+
# c.landing.logo = { svg: "M4 2h9l5 5…Z", viewbox: "0 0 22 24", label: "Acme" }
|
|
11
12
|
# c.landing.eyebrow = "Developer Docs"
|
|
12
13
|
# c.landing.title = "Jobs & events on **Postgres**" # ** ** → primary color
|
|
13
14
|
# c.landing.lead = "PostgreSQL-native jobs + event bus for Rails."
|
|
@@ -30,6 +31,9 @@ module DocsUI
|
|
|
30
31
|
# walks the same #docs-content region Shell stamps.
|
|
31
32
|
class Landing < Phlex::HTML
|
|
32
33
|
include Phlex::Rails::Helpers::Request
|
|
34
|
+
# For the image-form hero logo (c.landing.logo = { src: … }): resolve the asset
|
|
35
|
+
# path through the site's pipeline to its digested /assets URL.
|
|
36
|
+
include Phlex::Rails::Helpers::ImageURL
|
|
33
37
|
|
|
34
38
|
def view_template
|
|
35
39
|
render DocsUI::Shell.new(title: landing.eyebrow || config.brand) do
|
|
@@ -50,6 +54,7 @@ module DocsUI
|
|
|
50
54
|
|
|
51
55
|
def hero
|
|
52
56
|
div(class: "flex flex-col gap-6") do
|
|
57
|
+
logo
|
|
53
58
|
eyebrow
|
|
54
59
|
heading
|
|
55
60
|
lead
|
|
@@ -58,6 +63,22 @@ module DocsUI
|
|
|
58
63
|
end
|
|
59
64
|
end
|
|
60
65
|
|
|
66
|
+
# The brand mark — an inline single-path SVG (currentColor, theme-adaptive) or
|
|
67
|
+
# an <img>. Rendered above the eyebrow, like a product wordmark.
|
|
68
|
+
def logo
|
|
69
|
+
return unless (mark = landing.hero_logo)
|
|
70
|
+
|
|
71
|
+
if mark.inline?
|
|
72
|
+
svg(viewbox: mark.viewbox, class: "h-9 w-auto text-primary", fill: "currentColor",
|
|
73
|
+
role: "img", aria_label: mark.label) do |s|
|
|
74
|
+
s.title { mark.label } if mark.label
|
|
75
|
+
s.path(d: mark.svg)
|
|
76
|
+
end
|
|
77
|
+
else
|
|
78
|
+
img(src: image_url(mark.src), alt: mark.alt.to_s, class: "h-9 w-auto")
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
61
82
|
def eyebrow
|
|
62
83
|
return unless (text = landing.eyebrow)
|
|
63
84
|
|
|
@@ -26,6 +26,15 @@ module DocsKit
|
|
|
26
26
|
# individually assignable in the `c.landing.x = ...` block, mirroring
|
|
27
27
|
# DocsKit::SeoConfig.
|
|
28
28
|
class LandingConfig
|
|
29
|
+
# An optional brand logo/mark rendered at the top of the hero (above the
|
|
30
|
+
# eyebrow), like a product wordmark. A Hash in one of two forms:
|
|
31
|
+
# { svg: "<path d …>", viewbox: "0 0 81 45", label: "Brand" } # inline mark
|
|
32
|
+
# { src: "logo.svg", alt: "Brand" } # image asset/URL
|
|
33
|
+
# The inline `svg` form renders with `fill: currentColor` so it adapts to the
|
|
34
|
+
# theme (light/dark) — best for a single-color mark. nil omits the logo.
|
|
35
|
+
# See #hero_logo (the normalized Logo value object) and DocsUI::Landing.
|
|
36
|
+
attr_writer :logo
|
|
37
|
+
|
|
29
38
|
# A small uppercase kicker above the title (e.g. "Developer Docs"). nil omits it.
|
|
30
39
|
attr_accessor :eyebrow
|
|
31
40
|
|
|
@@ -81,6 +90,13 @@ module DocsKit
|
|
|
81
90
|
{ code: attrs[:code].to_s, filename: attrs[:filename], lexer: (attrs[:lexer] || :shell).to_sym }
|
|
82
91
|
end
|
|
83
92
|
|
|
93
|
+
# The hero logo as a normalized Logo value object, or nil when unset.
|
|
94
|
+
def hero_logo
|
|
95
|
+
return if @logo.nil?
|
|
96
|
+
|
|
97
|
+
Logo.from(@logo)
|
|
98
|
+
end
|
|
99
|
+
|
|
84
100
|
# One hero call-to-action button. `style` maps to a daisyUI btn variant
|
|
85
101
|
# (:primary → btn-primary, anything else → btn-ghost). `icon` is an optional
|
|
86
102
|
# brand/lucide token rendered before the label (DocsUI::BrandMark resolves it).
|
|
@@ -117,5 +133,28 @@ module DocsKit
|
|
|
117
133
|
new(icon: attrs[:icon], title: attrs[:title], body: attrs[:body])
|
|
118
134
|
end
|
|
119
135
|
end
|
|
136
|
+
|
|
137
|
+
# The hero brand logo — either an inline single-path SVG mark (`svg` = the
|
|
138
|
+
# `<path d>` data, `viewbox` = its viewBox) rendered with fill: currentColor so
|
|
139
|
+
# it adapts to the theme, OR an image (`src` = an asset path/URL, `alt` = its
|
|
140
|
+
# accessible name). `label` is the accessible name for the inline mark.
|
|
141
|
+
Logo = Data.define(:svg, :viewbox, :src, :alt, :label) do
|
|
142
|
+
def initialize(svg: nil, viewbox: "0 0 24 24", src: nil, alt: nil, label: nil)
|
|
143
|
+
super
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def self.from(logo)
|
|
147
|
+
return logo if logo.is_a?(self)
|
|
148
|
+
|
|
149
|
+
attrs = logo.to_h.transform_keys(&:to_sym)
|
|
150
|
+
new(
|
|
151
|
+
svg: attrs[:svg], viewbox: attrs[:viewbox] || "0 0 24 24",
|
|
152
|
+
src: attrs[:src], alt: attrs[:alt], label: attrs[:label]
|
|
153
|
+
)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# An inline SVG mark (vs. an <img>). True when `svg` path data is present.
|
|
157
|
+
def inline? = !svg.to_s.empty?
|
|
158
|
+
end
|
|
120
159
|
end
|
|
121
160
|
end
|
data/lib/docs_kit/version.rb
CHANGED
|
@@ -109,6 +109,9 @@ Rails.application.config.to_prepare do
|
|
|
109
109
|
# knobs. Every field is optional; with none set it still renders a minimal hero
|
|
110
110
|
# (the brand + the doc index). Wrap a run in **double asterisks** to accent it
|
|
111
111
|
# in the primary color.
|
|
112
|
+
# c.landing.logo = { svg: "M4 2h9l5 5…Z", viewbox: "0 0 22 24", label: "<%= app_brand %>" }
|
|
113
|
+
# # ^ an inline single-path SVG mark (fill: currentColor, theme-adaptive), OR
|
|
114
|
+
# # an image: { src: "logo.svg", alt: "<%= app_brand %>" }
|
|
112
115
|
# c.landing.eyebrow = "Developer Docs"
|
|
113
116
|
# c.landing.title = "The <%= app_brand %> **API**"
|
|
114
117
|
# c.landing.lead = "One sentence on what your product does."
|