@bitbaum/sitekit 0.5.0 → 0.5.1
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.
- package/dist/react/SiteChrome.js +1 -1
- package/dist/react/SiteNav.d.ts +8 -1
- package/dist/react/SiteNav.js +2 -10
- package/package.json +1 -1
- package/styles.css +33 -0
package/dist/react/SiteChrome.js
CHANGED
|
@@ -15,7 +15,7 @@ import { DefaultLink } from './link.js';
|
|
|
15
15
|
import { SiteNav } from './SiteNav.js';
|
|
16
16
|
export function SiteMasthead({ chrome, navItems, currentPath, Link = DefaultLink, appearance, brand, actions, mainId, skipLabel = 'Skip to content', navLabel = 'Main navigation', menuLabel = 'Menu', }) {
|
|
17
17
|
if (appearance === 'application')
|
|
18
|
-
return (_jsxs(_Fragment, { children: [mainId && (_jsx("a", { className: "sk-skip", href: '#' + mainId, children: skipLabel })), _jsx("header", { className: "sk-masthead", children: _jsxs("div", { className: "sk-shell-frame sk-masthead-row", children: [_jsx(Link, { href: "/", className: "sk-brand", children: brand ?? chrome.name }), _jsx(SiteNav, { items: navItems, currentPath: currentPath, Link: Link, appearance: "application", label: navLabel, menuLabel: menuLabel }), actions && _jsx("div", { className: "sk-account-actions", children: actions })] }) })] }));
|
|
18
|
+
return (_jsxs(_Fragment, { children: [mainId && (_jsx("a", { className: "sk-skip", href: '#' + mainId, children: skipLabel })), _jsx("header", { className: "sk-masthead", children: _jsxs("div", { className: "sk-shell-frame sk-masthead-row", children: [_jsx(Link, { href: "/", className: "sk-brand", children: brand ?? chrome.name }), _jsx(SiteNav, { items: navItems, currentPath: currentPath, Link: Link, appearance: "application", label: navLabel, menuLabel: menuLabel, menuActions: actions }), actions && _jsx("div", { className: "sk-account-actions", children: actions })] }) })] }));
|
|
19
19
|
return (_jsx("header", { className: "sticky top-0 z-30 border-b border-subtle bg-surface-page/85 backdrop-blur", children: _jsx("div", { className: "mx-auto max-w-shell px-4 sm:px-6 lg:px-8", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-6 py-2", children: [_jsx(Link, { href: href(), className: "inline-flex min-h-11 shrink-0 items-center rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent", children: _jsx("span", { className: "font-heading text-lg font-semibold tracking-display text-fg-primary", children: chrome.name }) }), _jsx(SiteNav, { items: navItems, currentPath: currentPath, Link: Link })] }) }) }));
|
|
20
20
|
}
|
|
21
21
|
export function SiteFooter({ chrome, appearance, links = [], groups, Link = DefaultLink, label = 'Footer navigation', extra, }) {
|
package/dist/react/SiteNav.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* client behaviour — scrolling the active item into view — lives in
|
|
7
7
|
* `NavAutoScroll`, which takes only a string.
|
|
8
8
|
*/
|
|
9
|
+
import type { ReactNode } from 'react';
|
|
9
10
|
import type { SiteNavItem } from '../schema.js';
|
|
10
11
|
import { type LinkLike } from './link.js';
|
|
11
12
|
interface Props {
|
|
@@ -20,6 +21,12 @@ interface Props {
|
|
|
20
21
|
appearance?: 'application';
|
|
21
22
|
label?: string;
|
|
22
23
|
menuLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The masthead's account actions, repeated at the foot of the mobile menu.
|
|
26
|
+
* On the narrowest phones the row has no room for them beside the brand and
|
|
27
|
+
* the menu button, so styles.css shows them here instead (one tap away).
|
|
28
|
+
*/
|
|
29
|
+
menuActions?: ReactNode;
|
|
23
30
|
}
|
|
24
|
-
export declare function SiteNav({ items, currentPath, Link, appearance, label, menuLabel, }: Props): import("react").JSX.Element | null;
|
|
31
|
+
export declare function SiteNav({ items, currentPath, Link, appearance, label, menuLabel, menuActions, }: Props): import("react").JSX.Element | null;
|
|
25
32
|
export {};
|
package/dist/react/SiteNav.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* The masthead's section nav.
|
|
4
|
-
*
|
|
5
|
-
* A server component, deliberately: the injected `Link` is a component
|
|
6
|
-
* function, and functions cannot cross into a 'use client' boundary. The one
|
|
7
|
-
* client behaviour — scrolling the active item into view — lives in
|
|
8
|
-
* `NavAutoScroll`, which takes only a string.
|
|
9
|
-
*/
|
|
10
2
|
import { href } from '../model.js';
|
|
11
3
|
import { DefaultLink } from './link.js';
|
|
12
4
|
import { MenuDismiss } from './MenuDismiss.js';
|
|
13
5
|
import { NavAutoScroll } from './NavAutoScroll.js';
|
|
14
|
-
export function SiteNav({ items, currentPath, Link = DefaultLink, appearance, label = 'Sections', menuLabel = 'Menu', }) {
|
|
6
|
+
export function SiteNav({ items, currentPath, Link = DefaultLink, appearance, label = 'Sections', menuLabel = 'Menu', menuActions, }) {
|
|
15
7
|
if (appearance === 'application') {
|
|
16
8
|
if (items.length === 0)
|
|
17
9
|
return null;
|
|
18
10
|
const links = () => items.map((item) => (_jsx(Link, { href: href(item.path), "aria-current": item.path === currentPath ? 'page' : undefined, children: item.label }, item.path)));
|
|
19
|
-
return (_jsxs(_Fragment, { children: [_jsx("nav", { className: "sk-desktop-nav", "aria-label": label, "data-sitekit-nav": true, children: links() }), _jsxs("details", { className: "sk-mobile-menu", "data-sitekit-menu": true, children: [_jsxs("summary", { children: [menuLabel, _jsx("span", { "aria-hidden": "true", children: "\u2630" })] }),
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx("nav", { className: "sk-desktop-nav", "aria-label": label, "data-sitekit-nav": true, children: links() }), _jsxs("details", { className: "sk-mobile-menu", "data-sitekit-menu": true, children: [_jsxs("summary", { children: [menuLabel, _jsx("span", { "aria-hidden": "true", children: "\u2630" })] }), _jsxs("nav", { "aria-label": label, children: [links(), menuActions && _jsx("div", { className: "sk-menu-actions", children: menuActions })] })] }), _jsx(MenuDismiss, { currentPath: currentPath })] }));
|
|
20
12
|
}
|
|
21
13
|
return (_jsxs("nav", { "data-sitekit-nav": true, "aria-label": label, className: "scrollbar-hide -mx-1 flex max-w-full flex-nowrap items-center gap-x-1 overflow-x-auto", children: [items.map((item) => {
|
|
22
14
|
const isCurrent = item.path === currentPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitbaum/sitekit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A website as data: a closed union of section shapes validated at runtime, one set of React renderers, and per-field provenance so a generated site can prove it fabricated nothing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mao Nakamoto",
|
package/styles.css
CHANGED
|
@@ -207,6 +207,39 @@
|
|
|
207
207
|
margin-inline-end: auto;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
+
.sk-menu-actions {
|
|
211
|
+
display: none;
|
|
212
|
+
}
|
|
213
|
+
/* The narrowest phones (up to 380px, which takes in 360px Android): brand, an
|
|
214
|
+
account action and the menu button do not fit in one row (AOZ at 320px
|
|
215
|
+
needed 369px and scrolled sideways by 49px), so the action moves to the foot
|
|
216
|
+
of the menu, and only when there is a menu to hold it. */
|
|
217
|
+
@media (max-width: 380px) {
|
|
218
|
+
.sk-masthead-row:has(.sk-mobile-menu) > .sk-account-actions {
|
|
219
|
+
display: none;
|
|
220
|
+
}
|
|
221
|
+
.sk-menu-actions {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: 0.5rem;
|
|
225
|
+
margin-top: 0.5rem;
|
|
226
|
+
padding-top: 0.5rem;
|
|
227
|
+
border-top: 1px solid var(--sk-line, #d6d6d6);
|
|
228
|
+
}
|
|
229
|
+
.sk-menu-actions > a {
|
|
230
|
+
display: flex;
|
|
231
|
+
align-items: center;
|
|
232
|
+
justify-content: center;
|
|
233
|
+
min-height: 44px;
|
|
234
|
+
padding: 0.65rem 1rem;
|
|
235
|
+
color: var(--sk-fg, CanvasText);
|
|
236
|
+
border: 1px solid var(--sk-line, #d6d6d6);
|
|
237
|
+
border-radius: var(--sk-radius, 0.5rem);
|
|
238
|
+
text-decoration: none;
|
|
239
|
+
font-weight: 600;
|
|
240
|
+
font-size: 0.875rem;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
210
243
|
@media (max-width: 600px) {
|
|
211
244
|
.sk-footer-top {
|
|
212
245
|
grid-template-columns: 1fr;
|