@superjackfruitlabs/vibekit-docs 0.0.0-stage → 0.0.4

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.
@@ -0,0 +1,182 @@
1
+ ---
2
+ // A recorded placement decision, replayed step by step: the card ready, every candidate with each
3
+ // filter's result and reason code, the scores, the hold and the claim. It reads a decision as
4
+ // SuperDispatch's operator API returns it (GET /v1/decisions/:id, `{ decision }` or the decision
5
+ // itself), from a JSON file in the site, so there is nothing to install. It uses the same step
6
+ // tabs as FlowSteps (src/client/steps.ts); without JavaScript every step is written out.
7
+ import { stepIds } from '../steps.ts';
8
+
9
+ interface Filter { filter: string; passed: boolean; reason?: string; missing?: unknown }
10
+ interface Candidate {
11
+ candidate: { agentId: string; principalId?: string; stationId?: string | null; source?: string };
12
+ filters: Filter[];
13
+ score: { total: number; terms: Record<string, number> } | null;
14
+ capable?: boolean;
15
+ }
16
+ interface Decision {
17
+ id: string;
18
+ boardId: string;
19
+ cardId: string;
20
+ stageKey: string;
21
+ policy: string;
22
+ chosen: string | null;
23
+ reason: string | null;
24
+ tier: { name: string; step: number } | null;
25
+ requires: { all: string[]; any: string[] } | null;
26
+ candidates: Candidate[];
27
+ reservation: { reservedUntil: string } | null;
28
+ reservationRefused: string | null;
29
+ outcome: { status: string; by: string | null; at: string | null } | null;
30
+ createdAt: string;
31
+ }
32
+ interface Props {
33
+ /** The decision: the operator API's `{ decision }` or the decision itself. */
34
+ decision: Decision | { decision: Decision };
35
+ /** Names the list of steps for a screen reader. */
36
+ label?: string;
37
+ /** Where the record came from, shown under the replay ("Recorded on …"). */
38
+ source?: string;
39
+ }
40
+ const p = Astro.props;
41
+ const d: Decision = 'decision' in p.decision ? p.decision.decision : p.decision;
42
+ if (!d?.id || !Array.isArray(d.candidates)) throw new Error('docs-theme: DecisionReplay needs a decision record with an id and candidates');
43
+
44
+ const at = (iso: string) => `${iso.slice(11, 19)} UTC`;
45
+ const secs = (from: string, to: string) => {
46
+ const s = (Date.parse(to) - Date.parse(from)) / 1000;
47
+ return `${Number.isInteger(s) ? s : s.toFixed(1)} s`;
48
+ };
49
+ const failed = (c: Candidate) => c.filters.filter((f) => !f.passed);
50
+ const scored = [...d.candidates].filter((c) => c.score).sort((a, b) => b.score!.total - a.score!.total);
51
+ const needs = d.requires ? [...d.requires.all, ...d.requires.any.map((x) => `${x} (any)`)] : [];
52
+ const steps = ['Ready', 'Filter', 'Score', 'Hold', 'Claim'];
53
+ const ids = stepIds('replay', steps.length);
54
+ const json = JSON.stringify({ decision: d }, null, 2);
55
+ ---
56
+ <sjl-decision-replay class="sjl-steps sjl-replay not-content" style={`--n:${steps.length}`}>
57
+ <div class="sjl-steps-tabs" role="tablist" aria-label={p.label ?? `Decision ${d.id}`} hidden>
58
+ {steps.map((s, i) => (
59
+ <button type="button" role="tab" class="sjl-step-tab" id={ids.tab(i)} aria-controls={ids.panel(i)} aria-selected={i === 0 ? 'true' : 'false'} tabindex={i === 0 ? '0' : '-1'}>
60
+ <span class="num" aria-hidden="true">{i + 1}</span><span class="lbl">{s}</span>
61
+ </button>
62
+ ))}
63
+ </div>
64
+
65
+ <div class="sjl-steps-panels">
66
+ <div class="sjl-step-panel" role="tabpanel" id={ids.panel(0)} aria-labelledby={ids.tab(0)} tabindex="0">
67
+ <p class="h"><b>1. Ready.</b> Card <code>{d.cardId}</code> waits at stage <code>{d.stageKey}</code> on board <code>{d.boardId}</code>.</p>
68
+ <dl>
69
+ <dt>The stage asks for</dt><dd>{needs.length ? needs.map((x) => <code>{x}</code>) : 'no capability'}</dd>
70
+ <dt>Decided at</dt><dd>{at(d.createdAt)}, {d.createdAt.slice(0, 10)}</dd>
71
+ <dt>Policy</dt><dd><code>{d.policy}</code></dd>
72
+ <dt>Candidates</dt><dd>{d.candidates.length}</dd>
73
+ </dl>
74
+ </div>
75
+
76
+ <div class="sjl-step-panel" role="tabpanel" id={ids.panel(1)} aria-labelledby={ids.tab(1)} tabindex="0">
77
+ <p class="h"><b>2. Filter.</b> Every candidate goes through every filter. A filter that turns one away records a reason code.</p>
78
+ <ul class="cands">
79
+ {d.candidates.map((c) => (
80
+ <li class:list={['cand', { out: failed(c).length > 0 }]}>
81
+ <span class="who"><code>{c.candidate.agentId}</code>{c.candidate.source && <small>{c.candidate.source}</small>}</span>
82
+ <span class="verdict">{failed(c).length ? failed(c).map((f) => <span>{f.filter}: <code>{f.reason ?? 'failed'}</code></span>) : `passed all ${c.filters.length} filters`}</span>
83
+ <ul class="filters" aria-label={`Filters for ${c.candidate.agentId}`}>
84
+ {c.filters.map((f) => <li class:list={{ no: !f.passed }}><span aria-hidden="true">{f.passed ? '✓' : '✗'}</span> {f.filter}{!f.passed && <> <code>{f.reason}</code></>}<span class="sjl-sr-only">{f.passed ? ', passed' : ', failed'}</span></li>)}
85
+ </ul>
86
+ </li>
87
+ ))}
88
+ </ul>
89
+ </div>
90
+
91
+ <div class="sjl-step-panel" role="tabpanel" id={ids.panel(2)} aria-labelledby={ids.tab(2)} tabindex="0">
92
+ <p class="h"><b>3. Score.</b> {scored.length ? `The ${scored.length === 1 ? 'candidate' : `${scored.length} candidates`} left ${scored.length === 1 ? 'is' : 'are'} ranked by policy ${d.policy}.` : 'No candidate passed every filter, so none was scored.'}</p>
93
+ {scored.length > 0 && (
94
+ <table>
95
+ <thead><tr><th scope="col">Agent</th><th scope="col">Total</th>{Object.keys(scored[0]!.score!.terms).map((t) => <th scope="col"><code>{t}</code></th>)}</tr></thead>
96
+ <tbody>
97
+ {scored.map((c) => (
98
+ <tr class:list={{ win: c.candidate.agentId === d.chosen }}>
99
+ <th scope="row"><code>{c.candidate.agentId}</code></th>
100
+ <td>{c.score!.total}</td>
101
+ {Object.values(c.score!.terms).map((v) => <td>{Number.isInteger(v) ? v : v.toFixed(2)}</td>)}
102
+ </tr>
103
+ ))}
104
+ </tbody>
105
+ </table>
106
+ )}
107
+ {d.candidates.filter((c) => !c.score).map((c) => <p class="note"><code>{c.candidate.agentId}</code> is not scored: it was filtered out.</p>)}
108
+ </div>
109
+
110
+ <div class="sjl-step-panel" role="tabpanel" id={ids.panel(3)} aria-labelledby={ids.tab(3)} tabindex="0">
111
+ {d.chosen ? (
112
+ <p class="h"><b>4. Hold.</b> Chosen: <code>{d.chosen}</code>{d.tier && <>, tier <code>{d.tier.name}</code> (step {d.tier.step})</>}.</p>
113
+ ) : (
114
+ <p class="h"><b>4. Hold.</b> Nobody was chosen: <code>{d.reason}</code>. Nothing is held, and the card is left to pull.</p>
115
+ )}
116
+ {d.reservation && <p>SuperPipeline holds the card for <code>{d.chosen}</code> until {at(d.reservation.reservedUntil)}: {secs(d.createdAt, d.reservation.reservedUntil)} after the decision.</p>}
117
+ {d.reservationRefused && <p>SuperPipeline refused the hold: <code>{d.reservationRefused}</code>.</p>}
118
+ </div>
119
+
120
+ <div class="sjl-step-panel" role="tabpanel" id={ids.panel(4)} aria-labelledby={ids.tab(4)} tabindex="0">
121
+ {d.outcome ? (
122
+ <p class="h"><b>5. Claim.</b> Outcome <code>{d.outcome.status}</code>{d.outcome.by && <> by <code>{d.outcome.by}</code></>}{d.outcome.at && <> at {at(d.outcome.at)}, {secs(d.createdAt, d.outcome.at)} after the decision</>}.</p>
123
+ ) : (
124
+ <p class="h"><b>5. Claim.</b> Not settled yet: a later pass records what became of the card.</p>
125
+ )}
126
+ </div>
127
+ </div>
128
+
129
+ <div class="sjl-steps-controls" data-step="controls" hidden>
130
+ <button type="button" class="sjl-btn sjl-step-btn" data-step="back"><span aria-hidden="true">←</span> Back</button>
131
+ <span class="sjl-steps-count" data-step="count" aria-hidden="true">Step 1 of {steps.length}</span>
132
+ <button type="button" class="sjl-btn sjl-step-btn" data-step="next">Next <span aria-hidden="true">→</span></button>
133
+ </div>
134
+
135
+ <details class="record">
136
+ <summary><span class="chev" aria-hidden="true">▸</span>The whole record, as the operator API returns it</summary>
137
+ <pre><code>{json}</code></pre>
138
+ </details>
139
+ {p.source && <p class="source">{p.source}</p>}
140
+ </sjl-decision-replay>
141
+
142
+ <script>
143
+ import { bindSteps } from '../client/steps.ts';
144
+ class SjlDecisionReplay extends HTMLElement {
145
+ connectedCallback() { bindSteps(this); }
146
+ }
147
+ if (!customElements.get('sjl-decision-replay')) customElements.define('sjl-decision-replay', SjlDecisionReplay);
148
+ </script>
149
+
150
+ <style>
151
+ .sjl-step-panel { display: grid; gap: 0.6rem; }
152
+ .sjl-step-panel[hidden] { display: none; }
153
+ .sjl-step-panel p { margin: 0; }
154
+ .sjl-step-panel code { font: 500 0.82em/1.3 var(--sl-font-mono); overflow-wrap: anywhere; padding: 0.08em 0.3em; border-radius: 4px; background: var(--sl-color-gray-5); color: var(--sl-color-white); }
155
+ dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
156
+ dt { color: var(--sl-color-gray-3); }
157
+ dd { margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
158
+ .cands { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
159
+ .cand { display: grid; gap: 0.35rem; padding: 0.6rem 0.7rem; border-radius: 10px; background: var(--sl-color-gray-7); border: 1px solid var(--sl-color-gray-5); }
160
+ .cand.out { border-style: dashed; }
161
+ .cand.out .who code { text-decoration: line-through; }
162
+ .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
163
+ .who small { color: var(--sl-color-gray-3); font-size: 0.75rem; }
164
+ .verdict { font-weight: 600; color: var(--sl-color-white); display: flex; flex-wrap: wrap; gap: 0.5rem; }
165
+ .filters { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; padding: 0; list-style: none; font: 500 0.72rem/1.2 var(--sl-font-mono); }
166
+ .filters li { padding: 0.2rem 0.4rem; border-radius: 6px; background: var(--sl-color-gray-6); color: var(--sl-color-gray-2); }
167
+ .filters li.no { background: color-mix(in oklab, var(--sl-color-red, #e5484d) 22%, var(--sl-color-gray-6)); color: var(--sl-color-white); }
168
+ table { width: 100%; border-collapse: collapse; font-size: 0.82rem; display: table; }
169
+ th, td { text-align: start; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--sl-color-gray-5); font-variant-numeric: tabular-nums; }
170
+ tr.win th, tr.win td { color: var(--sl-color-white); font-weight: 700; }
171
+ .note { font-size: 0.82rem; color: var(--sl-color-gray-3); }
172
+ .record summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--sl-color-gray-2); }
173
+ .record summary::-webkit-details-marker { display: none; }
174
+ .record[open] .chev { transform: rotate(90deg); }
175
+ .record summary:focus-visible { outline: 2px solid var(--sl-color-text-accent); outline-offset: 2px; border-radius: 6px; }
176
+ .record pre { max-height: 22rem; overflow: auto; margin: 0.25rem 0 0; padding: 0.75rem; font: 500 0.72rem/1.5 var(--sl-font-mono); border-radius: 10px; background: var(--sl-color-gray-7); border: 1px solid var(--sl-color-gray-5); color: var(--sl-color-gray-2); }
177
+ .source { margin: 0; font-size: 0.8rem; color: var(--sl-color-gray-3); }
178
+ @media (max-width: 30rem) {
179
+ dl { grid-template-columns: 1fr; }
180
+ table { display: block; overflow-x: auto; }
181
+ }
182
+ </style>
@@ -0,0 +1,99 @@
1
+ ---
2
+ // A process the reader steps through: a row of numbered steps (a tablist), a row of lanes that
3
+ // fill in as the steps are reached, and the selected step's panel, with Back and Next. It never
4
+ // moves by itself. The keys and focus follow the tabs pattern (src/client/steps.ts). Without
5
+ // JavaScript every step is written out, and the `still` image, if given, is shown.
6
+ import { stepIds } from '../steps.ts';
7
+
8
+ interface Step {
9
+ /** The step's name, short ("Filter"). */
10
+ label: string;
11
+ /** What happens at this step, one or two sentences. */
12
+ body: string;
13
+ /** What the lane shows once the flow has reached it: chips, in order. `out: true` strikes one through; `win: true` fills it. */
14
+ items?: { text: string; out?: boolean; win?: boolean; card?: boolean }[];
15
+ }
16
+ interface Props {
17
+ steps: Step[];
18
+ /** Names the list of steps for a screen reader ("Placement step"). */
19
+ label?: string;
20
+ /** Wrap from the last step to the first with the arrow keys. Off by default. */
21
+ loop?: boolean;
22
+ /** An image of the finished flow, shown when the page runs without JavaScript. */
23
+ still?: { src: string; alt: string };
24
+ }
25
+ const { steps, label = 'Step', loop = false, still } = Astro.props;
26
+ if (!steps?.length) throw new Error('docs-theme: FlowSteps needs at least one step');
27
+ const ids = stepIds('flow', steps.length);
28
+ ---
29
+ <sjl-flow-steps class="sjl-steps sjl-flow not-content" data-loop={loop ? '' : undefined} style={`--n:${steps.length}`}>
30
+ <div class="sjl-steps-tabs" role="tablist" aria-label={label} hidden>
31
+ {steps.map((s, i) => (
32
+ <button type="button" role="tab" class="sjl-step-tab" id={ids.tab(i)} aria-controls={ids.panel(i)} aria-selected={i === 0 ? 'true' : 'false'} tabindex={i === 0 ? '0' : '-1'}>
33
+ <span class="num" aria-hidden="true">{i + 1}</span><span class="lbl">{s.label}</span>
34
+ </button>
35
+ ))}
36
+ </div>
37
+ <div class="lanes" aria-hidden="true">
38
+ {steps.map((s, i) => (
39
+ <div class="lane" data-i={i}>
40
+ <span class="name">{i + 1}. {s.label}</span>
41
+ {(s.items ?? []).map((it) => <span class:list={['item', { out: it.out, win: it.win, card: it.card }]}>{it.text}</span>)}
42
+ </div>
43
+ ))}
44
+ </div>
45
+ <div class="sjl-steps-panels">
46
+ {steps.map((s, i) => (
47
+ <div class="sjl-step-panel" role="tabpanel" id={ids.panel(i)} aria-labelledby={ids.tab(i)} tabindex="0">
48
+ <b>{i + 1}. {s.label}.</b> {s.body}
49
+ </div>
50
+ ))}
51
+ </div>
52
+ <div class="sjl-steps-controls" data-step="controls" hidden>
53
+ <button type="button" class="sjl-btn sjl-step-btn" data-step="back"><span aria-hidden="true">←</span> Back</button>
54
+ <span class="sjl-steps-count" data-step="count" aria-hidden="true">Step 1 of {steps.length}</span>
55
+ <button type="button" class="sjl-btn sjl-step-btn" data-step="next">Next <span aria-hidden="true">→</span></button>
56
+ </div>
57
+ {still && <img class="still" src={still.src} alt={still.alt} loading="lazy" />}
58
+ </sjl-flow-steps>
59
+
60
+ <script>
61
+ import { bindSteps } from '../client/steps.ts';
62
+ class SjlFlowSteps extends HTMLElement {
63
+ connectedCallback() {
64
+ const lanes = [...this.querySelectorAll<HTMLElement>('.lane')];
65
+ bindSteps(this, {
66
+ loop: this.hasAttribute('data-loop'),
67
+ onStep: (i) => lanes.forEach((l, k) => { l.classList.toggle('on', k === i); l.classList.toggle('reached', k <= i); }),
68
+ });
69
+ }
70
+ }
71
+ if (!customElements.get('sjl-flow-steps')) customElements.define('sjl-flow-steps', SjlFlowSteps);
72
+ </script>
73
+
74
+ <style>
75
+ .lanes { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 0.4rem; }
76
+ .lane { border: 1px dashed var(--sl-color-gray-5); border-radius: 10px; padding: 0.5rem 0.35rem; min-height: 4.5rem; display: grid; align-content: start; gap: 0.35rem; text-align: center; font-size: 0.72rem; color: var(--sl-color-gray-3); }
77
+ .name { font-weight: 600; }
78
+ /* Live, the tabs above name the lanes. */
79
+ .live .name { display: none; }
80
+ .item { font: 600 0.7rem/1.15 var(--sl-font-mono); padding: 0.3rem; border-radius: 6px; background: var(--sl-color-gray-6); color: var(--sl-color-gray-2); overflow-wrap: anywhere; }
81
+ .item.card { font-family: var(--sl-font); background: var(--sl-color-gray-7); border: 1px solid var(--sl-color-gray-5); box-shadow: 0 6px 14px -8px rgb(0 0 0 / 0.4); }
82
+ .item.out { opacity: 0.45; text-decoration: line-through; }
83
+ .item.win { background: var(--sl-color-text-accent); color: var(--sl-color-text-invert); }
84
+ /* Live: a lane shows its chips only once the flow has reached it; the current lane is lit. */
85
+ .live .lane:not(.reached) .item { opacity: 0; }
86
+ .live .lane.on { border-style: solid; border-color: var(--sjl-brand); background: var(--sjl-soft); color: var(--sl-color-white); }
87
+ .still { width: 100%; height: auto; border-radius: 12px; }
88
+ .live .still { display: none; }
89
+ @media (prefers-reduced-motion: no-preference) {
90
+ .lane { transition: border-color 0.25s, background-color 0.25s; }
91
+ .item { transition: opacity 0.3s; }
92
+ }
93
+ @media (max-width: 30rem) {
94
+ .lanes { grid-template-columns: 1fr; }
95
+ .lane { min-height: 0; grid-template-columns: 6rem 1fr; text-align: start; align-items: center; }
96
+ .lane .item { grid-column: 2; }
97
+ .live .name { display: block; }
98
+ }
99
+ </style>
@@ -0,0 +1,56 @@
1
+ ---
2
+ // The page's foot. Every page keeps Starlight's own (edit link, last updated, previous and next).
3
+ // The docs home and the 404 then wear frontdoor's full suite footer; a content page gets one
4
+ // quiet line instead, "Part of Super Jackfruit Labs" and a product switcher, so the foot never
5
+ // outweighs the page. The suite footer draws in its own shadow root with frontdoor's light and
6
+ // dark; a small inline script, run as soon as the footer is parsed, keeps it on the docs' theme.
7
+ import Default from '@astrojs/starlight/components/Footer.astro';
8
+ import SuiteFooter from '@superjackfruitlabs/vibekit-frame/components/Footer.astro';
9
+ import { SUITE_URL } from '@superjackfruitlabs/vibekit-frame/components/shadow.ts';
10
+ import Switcher from './Switcher.astro';
11
+ import { productOf, routeOf, wearsSuiteFooter } from '../site.ts';
12
+
13
+ const me = productOf();
14
+ const full = wearsSuiteFooter(routeOf(Astro.locals));
15
+ // A product's suite footer is its own. A site that is not a product wears the footer of whose look it
16
+ // wears (the lab's, so no product tile is marked as here), with its own source and llms.txt beside it.
17
+ const footer = me.product
18
+ ? { product: me.slug, links: [{ label: 'Landing page', href: me.url }] }
19
+ : { product: me.wears, links: [...(me.repo ? [{ label: `${me.name} source`, href: me.repo }] : []), { label: `${me.name} llms.txt`, href: `${me.docs}/llms.txt` }] };
20
+ ---
21
+ <Default />
22
+ {full ? (
23
+ <>
24
+ <div class="sjl-suite-footer" data-site={me.product ? undefined : me.wears}>
25
+ <SuiteFooter product={footer.product as any} links={footer.links} />
26
+ </div>
27
+ <script is:inline>
28
+ (() => {
29
+ const sync = () => {
30
+ const t = document.documentElement.dataset.theme === 'light' ? 'light' : 'dark';
31
+ document.querySelectorAll('sjl-footer').forEach((el) => el.setAttribute('data-sjl-theme', t));
32
+ };
33
+ sync();
34
+ new MutationObserver(sync).observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
35
+ })();
36
+ </script>
37
+ </>
38
+ ) : (
39
+ <div class="sjl-foot-line">
40
+ <p>Part of <a href={`${SUITE_URL}/`}>Super Jackfruit Labs</a></p>
41
+ <Switcher product={me.slug} label="Products" up />
42
+ </div>
43
+ )}
44
+
45
+ <style>
46
+ /* A site that is not a product wears the lab's footer, but not the lab's amber: the footer's own
47
+ colour (its focus ring, Captain Jack's panel) takes the site's accent, so the amber stays in the
48
+ mark. A declaration on the host outranks the shadow root's :host rule. */
49
+ .sjl-suite-footer[data-site] :global(sjl-footer) { --sjl-c: var(--sjl-brand); --sjl-c-hi: var(--sl-color-accent-high); --sjl-on-c: var(--sjl-brand-ink); }
50
+ .sjl-suite-footer { margin-top: 3rem; margin-inline: calc(-1 * var(--sl-content-pad-x, 1rem)); border-radius: var(--sjl-radius); overflow: hidden; }
51
+ .sjl-foot-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-top: 2rem; padding-top: 0.75rem; border-top: 1px solid var(--sl-color-gray-6); font-size: 0.85rem; color: var(--sl-color-gray-3); }
52
+ .sjl-foot-line p { margin: 0; }
53
+ .sjl-foot-line a { color: var(--sl-color-gray-2); }
54
+ .sjl-foot-line a:hover { color: var(--sl-color-text-accent); }
55
+ .sjl-foot-line a:focus-visible { outline: 2px solid var(--sl-color-text-accent); outline-offset: 2px; border-radius: 4px; }
56
+ </style>
@@ -0,0 +1,16 @@
1
+ ---
2
+ // The header: the street (the suite map) on top, Starlight's own bar beneath it, unchanged.
3
+ import Default from '@astrojs/starlight/components/Header.astro';
4
+ import Street from './Street.astro';
5
+ ---
6
+ <div class="sjl-header">
7
+ <Street />
8
+ <div class="sjl-bar"><Default /></div>
9
+ </div>
10
+
11
+ <style>
12
+ .sjl-header { display: flex; flex-direction: column; height: 100%; gap: 0.35rem; }
13
+ .sjl-bar { flex: 1; min-height: 0; }
14
+ /* The header's padding is spent on the street; Starlight's bar keeps its own height. */
15
+ :global(.page > .header) { padding-top: 0.25rem; }
16
+ </style>
@@ -0,0 +1,6 @@
1
+ ---
2
+ // <HeadsUp>…</HeadsUp>: see Callout.astro.
3
+ import Callout from './Callout.astro';
4
+ interface Props { title?: string }
5
+ ---
6
+ <Callout kind="heads-up" title={Astro.props.title}><slot /></Callout>
@@ -0,0 +1,6 @@
1
+ ---
2
+ // <JackAside>…</JackAside>: see Callout.astro.
3
+ import Callout from './Callout.astro';
4
+ interface Props { title?: string }
5
+ ---
6
+ <Callout kind="jack" title={Astro.props.title}><slot /></Callout>
@@ -0,0 +1,17 @@
1
+ ---
2
+ // Open as Markdown: a link to the page's Markdown at its own address (`<page>.md`, served by the
3
+ // theme's route in src/pages/markdown.ts). Plain link, so it works without JavaScript.
4
+ import { markdownHref } from '../markdown.ts';
5
+
6
+ interface Props { id: string }
7
+ const href = markdownHref(Astro.props.id, import.meta.env.BASE_URL);
8
+ ---
9
+ <a class="sjl-btn sjl-open-md" href={href} type="text/markdown">
10
+ <svg aria-hidden="true" viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3h7v7"/><path d="M10 14 21 3"/><path d="M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5"/></svg>
11
+ Open as Markdown
12
+ </a>
13
+
14
+ <style>
15
+ .sjl-open-md { padding: 0.35rem 0.7rem; font-size: 0.8rem; border-radius: 9px; min-height: 2.25rem; }
16
+ @media (pointer: coarse) { .sjl-open-md { min-height: 44px; } }
17
+ </style>
@@ -0,0 +1,38 @@
1
+ ---
2
+ // The page title, with the page's status badge (frontmatter `status:`), Copy Markdown and Open as
3
+ // Markdown (the page's own `.md` address) beside it. On a splash page the home component draws the title, so the h1 is there for screen
4
+ // readers and the toolbar sits on its own.
5
+ import StatusBadge from './StatusBadge.astro';
6
+ import CopyMarkdown from './CopyMarkdown.astro';
7
+ import OpenMarkdown from './OpenMarkdown.astro';
8
+
9
+ // Starlight's id for the page title (its skip link and "Overview" target it).
10
+ const PAGE_TITLE_ID = '_top';
11
+ const { entry } = Astro.locals.starlightRoute;
12
+ const data = entry.data as typeof entry.data & { status?: string };
13
+ const splash = data.template === 'splash';
14
+ ---
15
+ {splash ? (
16
+ <h1 id={PAGE_TITLE_ID} class="sjl-sr-only">{data.title}</h1>
17
+ ) : (
18
+ <div class="sjl-page-title">
19
+ <h1 id={PAGE_TITLE_ID}>{data.title}</h1>
20
+ <div class="tools">
21
+ {data.status && <StatusBadge status={data.status} />}
22
+ <CopyMarkdown title={data.title} body={entry.body} />
23
+ <OpenMarkdown id={entry.id} />
24
+ </div>
25
+ </div>
26
+ )}
27
+
28
+ <style>
29
+ .sjl-page-title { display: grid; gap: 0.75rem; margin-top: 1rem; }
30
+ h1 {
31
+ margin: 0;
32
+ font: 800 var(--sl-text-h1)/1.08 var(--sjl-font-display);
33
+ letter-spacing: -0.03em;
34
+ color: var(--sl-color-white);
35
+ text-wrap: balance;
36
+ }
37
+ .tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
38
+ </style>
@@ -0,0 +1,43 @@
1
+ ---
2
+ // The site title: the product's mark beside its name (a non-product site shows the mark of whose
3
+ // look it wears: Treaty shows the lab's), 24px in the display face, and the site's
4
+ // status badge when the plugin was given one. It keeps what the stock component does: the same
5
+ // link target and `.site-title` class, and translate="no" so a page translator leaves the name.
6
+ import { logo } from '@superjackfruitlabs/vibekit-frame/components/shadow.ts';
7
+ import StatusBadge from './StatusBadge.astro';
8
+ import { productOf, routeOf, siteStatus } from '../site.ts';
9
+
10
+ interface Props { product?: string; status?: string | null }
11
+ const me = productOf(Astro.props.product);
12
+ const status = Astro.props.status === undefined ? siteStatus() : Astro.props.status;
13
+ const href = routeOf(Astro.locals)?.siteTitleHref ?? '/';
14
+ ---
15
+ <a href={href} class="site-title sjl-title">
16
+ <span class="mark" set:html={logo(me.mark)} />
17
+ <span class="name" translate="no">{me.name}</span>
18
+ {status && <StatusBadge status={status} class="title-status" />}
19
+ </a>
20
+
21
+ <style>
22
+ .sjl-title {
23
+ display: flex;
24
+ align-items: center;
25
+ gap: 0.6rem;
26
+ min-width: 0;
27
+ color: var(--sl-color-white);
28
+ text-decoration: none;
29
+ white-space: nowrap;
30
+ }
31
+ .mark { flex: none; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; }
32
+ .mark :global(svg) { width: 100%; height: 100%; display: block; }
33
+ .name {
34
+ font: 700 1.5rem/1 var(--sjl-font-display);
35
+ letter-spacing: -0.02em;
36
+ overflow: hidden;
37
+ text-overflow: ellipsis;
38
+ }
39
+ @media (max-width: 49.99rem) {
40
+ .title-status { display: none; }
41
+ .name { font-size: 1.3rem; }
42
+ }
43
+ </style>
@@ -0,0 +1,14 @@
1
+ ---
2
+ // A status word as a pill: lit & steady, lights on, half-lit, wet paint. The fill is vibekit's
3
+ // mood colour for it (never the product accent), the text its face ink; the title says what the
4
+ // word means, so the badge explains itself on hover and to a screen reader.
5
+ import { STATUSES, statusOf } from '../site.ts';
6
+
7
+ interface Props { status: string; class?: string }
8
+ const key = statusOf(Astro.props.status);
9
+ if (!key) throw new Error(`docs-theme: unknown status "${Astro.props.status}"`);
10
+ const s = STATUSES[key];
11
+ ---
12
+ <span class:list={['sjl-status', Astro.props.class]} data-status={key} title={`${s.label}: ${s.means}`}>
13
+ {s.label}<span class="sjl-sr-only">: {s.means}</span>
14
+ </span>
@@ -0,0 +1,60 @@
1
+ ---
2
+ // The street: the suite as a row of houses, one per product, each in its own colour, leading to
3
+ // that product's docs. This site's house stands a little taller; a site that is not a product
4
+ // has no house, so none is raised. On the right, the way out to this product's landing page (for a
5
+ // site that is not a product, its own landing page, else the lab's). On a phone the street folds into a product switcher.
6
+ import Switcher from './Switcher.astro';
7
+ import { SUITE, hostOf, productOf } from '../site.ts';
8
+
9
+ interface Props { product?: string }
10
+ const me = productOf(Astro.props.product);
11
+ const houses = SUITE.order.map((slug) => ({ slug, ...SUITE.products[slug] }));
12
+ const short = (name: string) => name.replace(/^Super/, '');
13
+ ---
14
+ <nav class="sjl-street" aria-label="The suite's docs">
15
+ <ul class="houses">
16
+ {houses.map((p, i) => (
17
+ <li class:list={[{ gap: i > 0 && p.street !== houses[i - 1]!.street }]}>
18
+ <a class="house" href={p.docs} style={`--c:${p.color}`} aria-current={p.slug === me.slug ? 'page' : undefined} title={`${p.name}: ${p.line}`}>
19
+ <b aria-hidden="true"></b><small>{short(p.name)}</small>
20
+ </a>
21
+ </li>
22
+ ))}
23
+ </ul>
24
+ <Switcher class="switcher" product={me.slug} />
25
+ <a class="landing" href={me.landing}>{hostOf(me.landing)} <span aria-hidden="true">↗</span></a>
26
+ </nav>
27
+
28
+ <style>
29
+ .sjl-street {
30
+ display: flex;
31
+ align-items: flex-end;
32
+ gap: 1rem;
33
+ height: var(--sjl-street-height);
34
+ border-bottom: 1px dashed var(--sl-color-gray-5);
35
+ font-family: var(--sl-font);
36
+ }
37
+ .houses { display: flex; align-items: flex-end; gap: 0.35rem; margin: 0; padding: 0; list-style: none; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
38
+ .houses::-webkit-scrollbar { display: none; }
39
+ .houses li { flex: none; display: flex; align-items: flex-end; }
40
+ .houses li.gap { margin-inline-start: 0.9rem; }
41
+ .house { display: grid; justify-items: center; gap: 2px; padding: 0 3px 3px; text-decoration: none; color: var(--sl-color-gray-3); }
42
+ .house b { position: relative; display: block; width: 18px; height: 13px; margin-top: 8px; background: var(--c); border-radius: 2px 2px 3px 3px; transition: transform 0.2s; }
43
+ .house b::before { content: ''; position: absolute; left: -3px; right: -3px; top: -7px; height: 8px; background: color-mix(in oklab, var(--c) 70%, #000); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
44
+ .house b::after { content: ''; position: absolute; left: 6px; bottom: 0; width: 6px; height: 7px; background: color-mix(in oklab, var(--c) 40%, #000); border-radius: 2px 2px 0 0; }
45
+ .house small { font-size: 0.62rem; line-height: 1; }
46
+ .house:hover b, .house:focus-visible b { transform: translateY(-2px); }
47
+ .house:hover small { color: var(--sl-color-white); }
48
+ .house[aria-current='page'] b { transform: translateY(-3px) scale(1.15); box-shadow: 0 6px 14px -6px var(--c); }
49
+ .house[aria-current='page'] small { color: var(--sl-color-white); font-weight: 600; }
50
+ .house:focus-visible, .landing:focus-visible { outline: 2px solid var(--sl-color-text-accent); outline-offset: 1px; border-radius: 6px; }
51
+ .landing { flex: none; align-self: center; font-size: 0.8rem; color: var(--sl-color-gray-3); text-decoration: none; white-space: nowrap; }
52
+ .landing:hover { color: var(--sl-color-text-accent); }
53
+ .sjl-street :global(.switcher) { display: none; align-self: center; }
54
+ @media (max-width: 49.99rem) {
55
+ .sjl-street { align-items: center; border-bottom: 0; }
56
+ .sjl-street :global(.switcher) { display: block; flex: 1; }
57
+ .houses { display: none; }
58
+ }
59
+ @media (prefers-reduced-motion: reduce) { .house b { transition: none; } }
60
+ </style>
@@ -0,0 +1,63 @@
1
+ ---
2
+ // The product switcher: a button that opens the suite's list of products, each leading to its
3
+ // docs. The street folds into it on a phone, and the quiet foot of a content page uses it.
4
+ // It is a <details>, so it opens and closes without JavaScript; with it, Escape closes the list
5
+ // and returns focus to the button, and a click outside closes it.
6
+ import { SUITE, productOf } from '../site.ts';
7
+
8
+ interface Props {
9
+ product?: string;
10
+ /** The button's words. */
11
+ label?: string;
12
+ /** Open the list upward, for a switcher at the foot of the page. */
13
+ up?: boolean;
14
+ class?: string;
15
+ }
16
+ const { label = 'The suite', up = false } = Astro.props;
17
+ const me = productOf(Astro.props.product);
18
+ const houses = SUITE.order.map((slug) => ({ slug, ...SUITE.products[slug] }));
19
+ ---
20
+ <sjl-switcher class:list={['sjl-switcher', Astro.props.class, { up }]}>
21
+ <details>
22
+ <summary><b aria-hidden="true" style={`--c:${me.color}`}></b><span>{label}</span><span class="chev" aria-hidden="true">{up ? '▴' : '▾'}</span></summary>
23
+ <ul>
24
+ {houses.map((p) => (
25
+ <li><a href={p.docs} aria-current={p.slug === me.slug ? 'page' : undefined}><b aria-hidden="true" style={`--c:${p.color}`}></b><span>{p.name}</span><small>{p.role}</small></a></li>
26
+ ))}
27
+ </ul>
28
+ </details>
29
+ </sjl-switcher>
30
+
31
+ <script>
32
+ class SjlSwitcher extends HTMLElement {
33
+ connectedCallback() {
34
+ const details = this.querySelector('details')!;
35
+ const summary = details.querySelector('summary')!;
36
+ details.addEventListener('keydown', (e) => {
37
+ if (e.key !== 'Escape' || !details.open) return;
38
+ details.open = false;
39
+ summary.focus();
40
+ });
41
+ document.addEventListener('click', (e) => {
42
+ if (details.open && !details.contains(e.target as Node)) details.open = false;
43
+ });
44
+ }
45
+ }
46
+ if (!customElements.get('sjl-switcher')) customElements.define('sjl-switcher', SjlSwitcher);
47
+ </script>
48
+
49
+ <style>
50
+ .sjl-switcher { display: block; position: relative; }
51
+ details { position: relative; }
52
+ summary { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; list-style: none; cursor: pointer; font-size: 0.85rem; color: var(--sl-color-gray-2); padding: 0.2rem 0.4rem; border-radius: 8px; }
53
+ summary::-webkit-details-marker { display: none; }
54
+ summary:hover { color: var(--sl-color-white); }
55
+ summary:focus-visible { outline: 2px solid var(--sl-color-text-accent); outline-offset: 1px; }
56
+ b { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
57
+ ul { position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-start: 0; min-width: 15rem; max-width: calc(100vw - 2rem); margin: 0; padding: 0.4rem; list-style: none; background: var(--sl-color-gray-7); border: 1px solid var(--sl-color-gray-5); border-radius: 12px; box-shadow: 0 20px 40px -20px rgb(0 0 0 / 0.5); }
58
+ .up ul { top: auto; bottom: calc(100% + 6px); }
59
+ li a { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 0.55rem; min-height: 44px; padding: 0.35rem 0.6rem; border-radius: 8px; color: var(--sl-color-white); text-decoration: none; font-size: 0.9rem; }
60
+ li a small { color: var(--sl-color-gray-3); font-size: 0.75rem; }
61
+ li a:hover, li a[aria-current='page'] { background: var(--sl-color-accent-low); }
62
+ li a:focus-visible { outline: 2px solid var(--sl-color-text-accent); outline-offset: -2px; }
63
+ </style>
@@ -0,0 +1,6 @@
1
+ ---
2
+ // <Tip>…</Tip>: see Callout.astro.
3
+ import Callout from './Callout.astro';
4
+ interface Props { title?: string }
5
+ ---
6
+ <Callout kind="tip" title={Astro.props.title}><slot /></Callout>
@@ -0,0 +1,6 @@
1
+ ---
2
+ // <WetPaint>…</WetPaint>: see Callout.astro.
3
+ import Callout from './Callout.astro';
4
+ interface Props { title?: string }
5
+ ---
6
+ <Callout kind="wet-paint" title={Astro.props.title}><slot /></Callout>
@@ -0,0 +1,13 @@
1
+ // A page as Markdown, the way its author wrote it: the title, then the body with MDX imports
2
+ // dropped. Copy Markdown copies this text, and every page serves it at its own `.md` address
3
+ // (src/pages/markdown.ts), so the button and the link always agree.
4
+
5
+ export function pageMarkdown(title: string, body?: string): string {
6
+ const text = (body ?? '').replace(/^import\s.+?;?\s*$/gm, '').replace(/^\n+/, '');
7
+ return `# ${title}\n\n${text}`.trimEnd() + '\n';
8
+ }
9
+
10
+ /** Where a page's Markdown is served: its id plus `.md` (`start/first-steps.md`, `index.md`). */
11
+ export function markdownHref(id: string, base = '/'): string {
12
+ return `${base.endsWith('/') ? base : `${base}/`}${id || 'index'}.md`;
13
+ }