@publier/shell 3.6.1 → 4.0.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.
package/README.md CHANGED
@@ -1 +1,89 @@
1
1
  # @publier/shell
2
+
3
+ ## Navigation groups
4
+
5
+ Both `nav.default.tabs` and `nav.default.links` accept plain links or one-level
6
+ labelled groups. A group has `label` and `items`; its children have `label`, `href`,
7
+ and optional `external` and `description`. Group labels open menus rather than
8
+ navigate. Include an overview destination as a child when needed. Existing plain
9
+ links keep their `label`, `href`, and optional `external` properties.
10
+
11
+ ```yaml
12
+ nav:
13
+ default:
14
+ title: Example
15
+ tabs:
16
+ - label: Products
17
+ items:
18
+ - label: Overview
19
+ href: /products
20
+ description: Explore the products
21
+ - label: Solutions
22
+ items:
23
+ - label: Documentation sites
24
+ href: /solutions/documentation
25
+ description: Publish useful product guides
26
+ - label: Resources
27
+ items:
28
+ - label: Guides
29
+ href: /docs
30
+ description: Learn how to build your site
31
+ - label: Community
32
+ href: https://example.com/community
33
+ external: true
34
+ links:
35
+ - label: Sign in
36
+ href: /login
37
+ cta:
38
+ label: Talk to us
39
+ href: /contact
40
+ ```
41
+
42
+ The default variant serves both marketing and documentation pages. Keep one
43
+ canonical configuration; if named variants are needed, reuse the same YAML anchor
44
+ instead of copying the items. Only one level is supported. Empty groups, malformed
45
+ children, and nested groups are omitted. Descriptions are plain text and are
46
+ escaped along with labels and destinations. Children support local paths,
47
+ fragments, HTTP(S), mail and telephone links; executable URL schemes are omitted.
48
+ `external: true` opens a new tab with `noopener noreferrer`.
49
+
50
+ Desktop menus appear at `lg` (1024px). Each group is a native `<details>` with
51
+ `data-publier-nav-group` set to its label. Its direct `<details-menu>` child has
52
+ `data-publier-nav-menu`, `role="menu"`, and links with `role="menuitem"`. The
53
+ existing lazy upgrade supplies menu keyboard navigation, Escape, and selection
54
+ behavior. Native `name` attributes provide sibling exclusivity in supporting
55
+ browsers. Descriptions use block spans with `whitespace-normal` and
56
+ `data-publier-nav-description`.
57
+
58
+ Below 1024px, the button named **Open navigation menu** has
59
+ `data-publier-top-nav-toggle` and `aria-haspopup="dialog"`. It opens a labelled
60
+ native dialog; the browser owns modal focus, focus restoration and Escape.
61
+ The close button is named **Close navigation menu**. The menu container has
62
+ `data-publier-nav-mobile`; each mobile group is also a `<details>` with the same
63
+ group and menu attributes. Escape closes an open group first, then the containing
64
+ dialog. Links and close buttons dismiss the dialog. Client-router navigation and
65
+ crossing into the desktop layout clear open menus.
66
+
67
+ The active destination uses `aria-current="page"`, chosen by longest local-path
68
+ match. Group highlighting derives from that child. Grouped navigation rerenders
69
+ on client-router transitions so desktop and mobile highlights reflect the new
70
+ page. Search and theme slots continue to work; when composing `TopNav` directly,
71
+ provide `TopNavMobile` in its `mobile` slot. `BaseLayout` supplies these navigation
72
+ slots by default.
73
+
74
+ ## Migration from plain-link navigation types
75
+
76
+ `NavLink.href` is now optional because a group uses `items` instead of a
77
+ destination. Code that reads navigation entries must handle a group before
78
+ using `href`; its child `NavItem` entries always have a destination. Existing
79
+ plain-link YAML does not need to change.
80
+
81
+ Mobile navigation uses the browser's native dialog rather than a custom focus
82
+ trap. GitHub's [details-dialog element](https://github.com/github/details-dialog-element#deprecation-warning)
83
+ is deprecated for accessibility concerns, and there is no maintained
84
+ `@github/modal-dialog-element` package. The [native dialog standard](https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element)
85
+ provides focus containment, background inertness, and Escape dismissal.
86
+ The small activation and navigation cleanup script leaves those semantics to
87
+ the browser. Menu keyboard navigation remains owned by GitHub's details-menu
88
+ element. That element does not dismiss on outside clicks; the navigation glue
89
+ closes open groups when a click occurs outside them.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as DocsShellOptions, m as docsShell } from "./integration-BHNGso70.mjs";
1
+ import { h as docsShell, i as DocsShellOptions } from "./integration-BNKc2flb.mjs";
2
2
  import "astro/zod";
3
3
  //#region src/build/headers.d.ts
4
4
  /**
@@ -165,10 +165,18 @@ interface LlmsConfig {
165
165
  /** Restrict to these collections. Empty means every rendered collection. */
166
166
  collections: string[];
167
167
  }
168
- interface NavLink {
168
+ interface NavItem {
169
169
  label: string;
170
170
  href: string;
171
171
  external?: boolean;
172
+ description?: string;
173
+ }
174
+ /** A plain link, or a labelled group of one-level navigation items. */
175
+ interface NavLink {
176
+ label: string;
177
+ href?: string;
178
+ external?: boolean;
179
+ items?: NavItem[];
172
180
  }
173
181
  interface NavCta {
174
182
  label: string;
@@ -196,4 +204,4 @@ interface NavConfig {
196
204
  }
197
205
  declare function docsShell(options?: DocsShellOptions): AstroIntegration;
198
206
  //#endregion
199
- export { DocsSidebarMetaOverride as a, NavCta as c, NavVariant as d, SidebarAnchorConfig as f, publierCascadeHoistPlugin as g, hoistMediaOutOfUtilitiesLayer as h, DocsShellOptions as i, NavLink as l, docsShell as m, DocVersionConfig as n, LlmsConfig as o, SiteConfig as p, DocsConfig as r, NavConfig as s, AnnouncementConfig as t, NavPathRule as u };
207
+ export { publierCascadeHoistPlugin as _, DocsSidebarMetaOverride as a, NavCta as c, NavPathRule as d, NavVariant as f, hoistMediaOutOfUtilitiesLayer as g, docsShell as h, DocsShellOptions as i, NavItem as l, SiteConfig as m, DocVersionConfig as n, LlmsConfig as o, SidebarAnchorConfig as p, DocsConfig as r, NavConfig as s, AnnouncementConfig as t, NavLink as u };
@@ -1,2 +1,2 @@
1
- import { a as DocsSidebarMetaOverride, c as NavCta, d as NavVariant, f as SidebarAnchorConfig, g as publierCascadeHoistPlugin, h as hoistMediaOutOfUtilitiesLayer, i as DocsShellOptions, l as NavLink, m as docsShell, n as DocVersionConfig, o as LlmsConfig, p as SiteConfig, r as DocsConfig, s as NavConfig, t as AnnouncementConfig, u as NavPathRule } from "./integration-BHNGso70.mjs";
2
- export { AnnouncementConfig, DocVersionConfig, DocsConfig, DocsShellOptions, DocsSidebarMetaOverride, LlmsConfig, NavConfig, NavCta, NavLink, NavPathRule, NavVariant, SidebarAnchorConfig, SiteConfig, docsShell, hoistMediaOutOfUtilitiesLayer, publierCascadeHoistPlugin };
1
+ import { _ as publierCascadeHoistPlugin, a as DocsSidebarMetaOverride, c as NavCta, d as NavPathRule, f as NavVariant, g as hoistMediaOutOfUtilitiesLayer, h as docsShell, i as DocsShellOptions, l as NavItem, m as SiteConfig, n as DocVersionConfig, o as LlmsConfig, p as SidebarAnchorConfig, r as DocsConfig, s as NavConfig, t as AnnouncementConfig, u as NavLink } from "./integration-BNKc2flb.mjs";
2
+ export { AnnouncementConfig, DocVersionConfig, DocsConfig, DocsShellOptions, DocsSidebarMetaOverride, LlmsConfig, NavConfig, NavCta, NavItem, NavLink, NavPathRule, NavVariant, SidebarAnchorConfig, SiteConfig, docsShell, hoistMediaOutOfUtilitiesLayer, publierCascadeHoistPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publier/shell",
3
- "version": "3.6.1",
3
+ "version": "4.0.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Qwik + Astro docs layout for Publier sites.",
6
6
  "type": "module",
@@ -115,7 +115,7 @@
115
115
  "@github/details-menu-element": "^1.0.13",
116
116
  "@github/relative-time-element": "^5.3.1",
117
117
  "@github/tab-container-element": "^4.9.0",
118
- "@publier/native": "3.0.1",
118
+ "@publier/native": "4.0.0",
119
119
  "@tailwindcss/typography": "^0.5.20",
120
120
  "astro-pagefind": "^2.0.1",
121
121
  "daisyui": "^5.7.22",
@@ -152,7 +152,13 @@ h6 {
152
152
  * rule simply doesn't apply to them, so their daisyUI-derived
153
153
  * foreground/background pair stays intact.
154
154
  */
155
- [data-publier-top-nav] a.btn-ghost[aria-current="page"] {
155
+ /* Group state derives from the active child; descriptions retain normal
156
+ * foreground contrast. Mobile links use the same semantic active signal. */
157
+ [data-publier-top-nav] a.btn-ghost[aria-current="page"],
158
+ [data-publier-nav-menu] a[aria-current="page"],
159
+ [data-publier-top-nav] details[data-publier-nav-group]:has(a[aria-current="page"]) > summary,
160
+ [data-publier-nav-mobile] details[data-publier-nav-group]:has(a[aria-current="page"]) > summary,
161
+ [data-publier-nav-dialog] a[aria-current="page"] {
156
162
  color: var(--color-primary);
157
163
  background-color: color-mix(in oklab, var(--color-primary) 12%, transparent);
158
164
  }
@@ -24,10 +24,19 @@ declare module 'virtual:publier-theme-css';
24
24
  declare module 'virtual:publier-custom-css';
25
25
 
26
26
  declare module 'virtual:publier-nav-config' {
27
- export interface NavLink {
27
+ export interface NavItem {
28
28
  label: string;
29
29
  href: string;
30
30
  external?: boolean;
31
+ description?: string;
32
+ }
33
+
34
+ /** A plain link, or a labelled group of one-level navigation items. */
35
+ export interface NavLink {
36
+ label: string;
37
+ href?: string;
38
+ external?: boolean;
39
+ items?: NavItem[];
31
40
  }
32
41
 
33
42
  export interface NavCta {