@brendanbank/atrium-host-types 0.25.4 → 0.26.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
@@ -32,8 +32,8 @@ your `.npmrc`, delete it — npmjs.org is the default registry.
32
32
 
33
33
  ## Versioning
34
34
 
35
- The package version tracks atrium's image version. Pin `^0.25` for
36
- "compatible with atrium 0.25.x"; bump together with the atrium image
35
+ The package version tracks atrium's image version. Pin `^0.26` for
36
+ "compatible with atrium 0.26.x"; bump together with the atrium image
37
37
  to pick up new registry slots. New slots land as **optional** members
38
38
  on `AtriumRegistry` first so a host that hasn't bumped yet still
39
39
  type-checks.
package/dist/index.d.ts CHANGED
@@ -154,6 +154,49 @@ export interface NavItem {
154
154
  * Notifications and Admin. Available since atrium 0.16. */
155
155
  order?: number;
156
156
  }
157
+ /** Nav-only leaf inside a host-registered top-level `NavGroup`. Carries
158
+ * a `to` because group children navigate directly; the host registers
159
+ * the route separately via `registerRoute`. Available since atrium
160
+ * 0.26. */
161
+ export interface NavGroupChild {
162
+ key: string;
163
+ label: string;
164
+ to: string;
165
+ icon?: ReactElement;
166
+ /** Per-child visibility predicate; same shape as `NavItem.condition`.
167
+ * A group whose children are all gated out hides entirely. */
168
+ condition?: (ctx: {
169
+ me: UserContext | null;
170
+ }) => boolean;
171
+ order?: number;
172
+ }
173
+ /** Host-registered collapsible top-level nav group. Renders as a parent
174
+ * NavLink in the main sidebar — sibling of Home / Notifications /
175
+ * Settings / Admin — whose entries are the items in `children`. Use
176
+ * when a host wants to bundle several non-admin / non-settings routes
177
+ * under one expandable label (e.g. "Reports" → Daily / Weekly /
178
+ * Monthly).
179
+ *
180
+ * Hides entirely when `condition` returns false or every child is
181
+ * gated out. Group children are nav-only; their content lives at the
182
+ * host-registered routes their `to` paths point at. Available since
183
+ * atrium 0.26. */
184
+ export interface NavGroup {
185
+ key: string;
186
+ label: string;
187
+ icon?: ReactElement;
188
+ /** Visibility predicate for the whole group. Returning false hides
189
+ * the group + every child in one shot, so a host doesn't have to
190
+ * repeat the predicate on every child. */
191
+ condition?: (ctx: {
192
+ me: UserContext | null;
193
+ }) => boolean;
194
+ /** Sort key in the top-level sidebar. Same semantics as
195
+ * `NavItem.order` — interleaves with the built-ins at 100 (Home),
196
+ * 200 (Notifications), 250 (Settings), 300 (Admin). */
197
+ order?: number;
198
+ children: NavGroupChild[];
199
+ }
157
200
  /** Sidebar bucket an admin tab lives in. `admin` is the default and
158
201
  * groups every atrium-shipped admin surface plus host admin tooling.
159
202
  * `settings` is a parallel sibling group above Admin reserved for
@@ -286,6 +329,12 @@ export interface AtriumRegistry {
286
329
  registerHomeWidget: (widget: HomeWidget) => void;
287
330
  registerRoute: (route: RouteEntry) => void;
288
331
  registerNavItem: (item: NavItem) => void;
332
+ /** Register a collapsible top-level nav group whose children are leaf
333
+ * links. Sibling of Home / Notifications / Settings / Admin in the
334
+ * main sidebar — for grouping outside the Admin/Settings buckets
335
+ * (which is what `registerSettingsGroup` is for). Available since
336
+ * atrium 0.26. */
337
+ registerNavGroup?: (group: NavGroup) => void;
289
338
  registerAdminTab: (tab: AdminTab) => void;
290
339
  /** Relocate one of atrium's built-in admin tabs into a different
291
340
  * sidebar group, and optionally re-rank it within that group. Pass
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brendanbank/atrium-host-types",
3
- "version": "0.25.4",
3
+ "version": "0.26.0",
4
4
  "description": "TypeScript declarations for the atrium host-extension contract: AtriumRegistry, UserContext, AdminUserRow, AtriumNotification, AtriumEvent. Source-of-truth shapes a host bundle types against, kept in sync with atrium's published image major.minor.",
5
5
  "license": "BSD-2-Clause",
6
6
  "type": "module",