@tradalab/lyra 3.0.0 → 3.2.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/dist/shell/index.d.ts +37 -14
- package/dist/shell/index.js +74 -43
- package/dist/shell/index.js.map +1 -1
- package/package.json +1 -1
package/dist/shell/index.d.ts
CHANGED
|
@@ -144,9 +144,21 @@ interface NavBrandApp {
|
|
|
144
144
|
/** Display name. */
|
|
145
145
|
name: string;
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
147
|
+
* The app's mark, in one of three forms:
|
|
148
|
+
*
|
|
149
|
+
* - a ROOT-RELATIVE path (`"/icon.svg"`) - THIS app's own mark. Same origin by construction,
|
|
150
|
+
* which is why the header uses it: the file is already in this app's `public/`, so an absolute
|
|
151
|
+
* URL would add a cross-origin round trip to fetch something that is right here.
|
|
152
|
+
* - an ABSOLUTE http(s) URL - another app's mark, as the registry stores it. Drawn by
|
|
153
|
+
* {@link AppGlyph}, so a host that is down degrades to a name monogram rather than a broken
|
|
154
|
+
* image.
|
|
155
|
+
* - a pre-rendered element, e.g. `<Boxes />`. Element form (not a component reference) so the
|
|
156
|
+
* prop stays serializable across the RSC boundary - same convention as {@link NavItem}'s
|
|
157
|
+
* `icon`. Drawn on the brand-colour plate, inheriting its foreground.
|
|
158
|
+
*
|
|
159
|
+
* Either string form gets NO plate: the generated marks are opaque squircles, and a rounded mark
|
|
160
|
+
* on a square colour tile shows four corners of the wrong colour behind it. Nor does the monogram
|
|
161
|
+
* such a mark degrades to, which brings its own tint.
|
|
150
162
|
*/
|
|
151
163
|
icon: ReactNode;
|
|
152
164
|
/** Navigation target. Usually an absolute cross-app URL (full navigation). */
|
|
@@ -166,12 +178,12 @@ interface NavBrandProps {
|
|
|
166
178
|
/** The current app, rendered in the sidebar header. */
|
|
167
179
|
app: NavBrandApp;
|
|
168
180
|
/**
|
|
169
|
-
* Other apps to switch to (flat, single list). When omitted or empty
|
|
170
|
-
* `groups`
|
|
181
|
+
* Other apps to switch to (flat, single list). When omitted or empty - and no
|
|
182
|
+
* `groups` - the header renders as a plain link to `app.href`.
|
|
171
183
|
*/
|
|
172
184
|
apps?: NavBrandApp[];
|
|
173
185
|
/**
|
|
174
|
-
* Grouped apps
|
|
186
|
+
* Grouped apps - rendered as labeled sections separated by dividers. Takes
|
|
175
187
|
* precedence over `apps`. The caller owns the grouping + ordering.
|
|
176
188
|
*/
|
|
177
189
|
groups?: NavBrandGroup[];
|
|
@@ -180,10 +192,10 @@ interface NavBrandProps {
|
|
|
180
192
|
/** Extra menu content appended below the app list (e.g. an "Add app" row). */
|
|
181
193
|
children?: ReactNode;
|
|
182
194
|
}
|
|
183
|
-
/** Default English heading for the switcher's app list
|
|
195
|
+
/** Default English heading for the switcher's app list - override for i18n. */
|
|
184
196
|
declare const defaultNavBrandAppsLabel = "Applications";
|
|
185
197
|
/**
|
|
186
|
-
* Sidebar-header brand block with an optional app switcher
|
|
198
|
+
* Sidebar-header brand block with an optional app switcher - the standardized
|
|
187
199
|
* `SidebarHeader` content for app shells (pairs with {@link NavUser} in the
|
|
188
200
|
* footer). Presentational: the app owns the config, icons, and labels.
|
|
189
201
|
*
|
|
@@ -206,7 +218,7 @@ declare const defaultNavBrandAppsLabel = "Applications";
|
|
|
206
218
|
declare function NavBrand({ app, apps, groups, appsLabel, children, }: NavBrandProps): React.JSX.Element;
|
|
207
219
|
|
|
208
220
|
/**
|
|
209
|
-
* A registry app in the {@link AppSwitcher}
|
|
221
|
+
* A registry app in the {@link AppSwitcher} - the shape a launcher endpoint
|
|
210
222
|
* returns (icon as a URL string; the glyph is rendered internally). Structurally
|
|
211
223
|
* matches nekit's `LauncherApp`, so `groupApps(...)` output feeds straight in.
|
|
212
224
|
*/
|
|
@@ -227,7 +239,7 @@ interface AppSwitcherSection {
|
|
|
227
239
|
interface AppSwitcherProps {
|
|
228
240
|
/** The current app, shown in the sidebar header. */
|
|
229
241
|
app: NavBrandApp;
|
|
230
|
-
/** Grouped registry apps
|
|
242
|
+
/** Grouped registry apps - e.g. nekit `groupApps(data.apps, data.groups)`. */
|
|
231
243
|
sections: AppSwitcherSection[];
|
|
232
244
|
/** Heading for the flat fallback list. */
|
|
233
245
|
appsLabel?: string;
|
|
@@ -238,9 +250,8 @@ interface AppSwitcherProps {
|
|
|
238
250
|
/**
|
|
239
251
|
* The cross-app switcher: a batteries-included wrapper over {@link NavBrand} that
|
|
240
252
|
* takes the launcher registry (grouped `sections` of `{ icon, url, … }`)
|
|
241
|
-
* and renders it
|
|
242
|
-
* Consumers just fetch + group (nekit) and pass config
|
|
243
|
-
* here. Empty registry → the `fallback` flat list.
|
|
253
|
+
* and renders it - labeled group sections, each app's mark drawn by `NavBrand`.
|
|
254
|
+
* Consumers just fetch + group (nekit) and pass config. Empty registry → the `fallback` flat list.
|
|
244
255
|
*
|
|
245
256
|
* @example
|
|
246
257
|
* const sections = groupApps(data.apps, data.groups) // @tradalab/nekit/data/launcher
|
|
@@ -480,8 +491,20 @@ interface AppGlyphProps {
|
|
|
480
491
|
/** App name, drawn as the monogram when there is no image. */
|
|
481
492
|
name?: string;
|
|
482
493
|
className?: string;
|
|
494
|
+
/**
|
|
495
|
+
* Also accept a ROOT-RELATIVE `icon` (`/icon.svg`).
|
|
496
|
+
*
|
|
497
|
+
* Off by default, and that default is the point: a registry mark belongs to some OTHER app, so a
|
|
498
|
+
* relative path would resolve against whichever app is drawing the launcher and quietly show the
|
|
499
|
+
* wrong mark. app-glyph.test.tsx pins that.
|
|
500
|
+
*
|
|
501
|
+
* On for an app drawing its OWN mark - the sidebar header. There same-origin is the whole
|
|
502
|
+
* intention: the file sits in this app's `public/`, so an absolute URL would add a cross-origin
|
|
503
|
+
* round trip to fetch something already here, and one blip would swap the header for a letter.
|
|
504
|
+
*/
|
|
505
|
+
ownOrigin?: boolean;
|
|
483
506
|
}
|
|
484
507
|
/** An app's mark: its image when `icon` is a URL that loads, else a name monogram. */
|
|
485
|
-
declare function AppGlyph({ icon, name, className }: AppGlyphProps): React.JSX.Element;
|
|
508
|
+
declare function AppGlyph({ icon, name, className, ownOrigin }: AppGlyphProps): React.JSX.Element;
|
|
486
509
|
|
|
487
510
|
export { AppGlyph, type AppGlyphProps, AppGrid, type AppGridGroup, type AppGridItem, type AppGridProps, AppShell, AppShellBody, AppShellHeader, AppShellMain, type AppShellProps, AppSwitcher, type AppSwitcherApp, type AppSwitcherProps, type AppSwitcherSection, AppTile, Breadcrumbs, type BreadcrumbsProps, type LeadingCrumb, type MatchMode, NavBrand, type NavBrandApp, type NavBrandGroup, type NavBrandProps, NavGroup, type NavGroupProps, type NavIcon, NavItem, type NavItemProps, NavSection, type NavSectionProps, NavUser, type NavUserProps, type NavUserThemeLabels, SidebarDock, SidebarPanel, StackedSidebar, TabBar, type TabBarLabels, type TabBarProps, type TabItem, type UseActiveRoute, defaultAppGridLabels, defaultNavBrandAppsLabel, defaultNavUserThemeLabels, defaultTabBarLabels, isIconUrl, useActiveRoute };
|
package/dist/shell/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
|
11
11
|
import Link2 from 'next/link';
|
|
12
12
|
import { ArrowUpRight, ChevronsUpDown, CircleUser, Palette, Sun, Moon, Monitor, UserRoundCog, LogOut, LogIn, Pin, X, PinOff, ListX, Trash2, ChevronDown, Search } from 'lucide-react';
|
|
13
13
|
import { usePathname } from 'next/navigation';
|
|
14
|
-
import {
|
|
14
|
+
import { useState, useRef, useEffect, Fragment } from 'react';
|
|
15
15
|
import { useTheme } from 'next-themes';
|
|
16
16
|
|
|
17
17
|
function AppShell({ children, ...rest }) {
|
|
@@ -141,10 +141,68 @@ function NavItem({
|
|
|
141
141
|
function NavSection({ label, items }) {
|
|
142
142
|
return /* @__PURE__ */ jsx(NavGroup, { label, children: items.map((item) => /* @__PURE__ */ jsx(NavItem, { ...item }, item.href)) });
|
|
143
143
|
}
|
|
144
|
+
function isIconUrl(s) {
|
|
145
|
+
return /^https?:\/\//i.test(s);
|
|
146
|
+
}
|
|
147
|
+
function isOwnPath(s) {
|
|
148
|
+
return /^\/(?!\/)/.test(s);
|
|
149
|
+
}
|
|
150
|
+
function AppGlyph({ icon, name, className, ownOrigin }) {
|
|
151
|
+
const box = "flex size-9 shrink-0 items-center justify-center rounded-none";
|
|
152
|
+
const src = icon && (isIconUrl(icon) || ownOrigin === true && isOwnPath(icon)) ? icon : "";
|
|
153
|
+
const [failedSrc, setFailedSrc] = useState("");
|
|
154
|
+
const seen = useRef(src);
|
|
155
|
+
const ref = useRef(null);
|
|
156
|
+
if (seen.current !== src) {
|
|
157
|
+
seen.current = src;
|
|
158
|
+
if (failedSrc) setFailedSrc("");
|
|
159
|
+
}
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
const img = ref.current;
|
|
162
|
+
if (img?.complete && img.naturalWidth === 0) setFailedSrc(img.getAttribute("src") ?? "");
|
|
163
|
+
}, [src]);
|
|
164
|
+
if (src && failedSrc !== src) {
|
|
165
|
+
return /* @__PURE__ */ jsx(
|
|
166
|
+
"img",
|
|
167
|
+
{
|
|
168
|
+
ref,
|
|
169
|
+
src,
|
|
170
|
+
alt: "",
|
|
171
|
+
"aria-hidden": true,
|
|
172
|
+
className: cn(box, "object-contain", className),
|
|
173
|
+
onError: () => setFailedSrc(src)
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
return /* @__PURE__ */ jsx(
|
|
178
|
+
"span",
|
|
179
|
+
{
|
|
180
|
+
"aria-hidden": true,
|
|
181
|
+
className: cn(box, "bg-primary/10 text-sm font-semibold text-primary", className),
|
|
182
|
+
children: (name || "?").charAt(0).toUpperCase()
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
144
186
|
var defaultNavBrandAppsLabel = "Applications";
|
|
187
|
+
function Mark({ app, own, className }) {
|
|
188
|
+
if (typeof app.icon !== "string") return /* @__PURE__ */ jsx(Fragment$1, { children: app.icon });
|
|
189
|
+
return /* @__PURE__ */ jsx(AppGlyph, { icon: app.icon, name: app.name, className, ownOrigin: own });
|
|
190
|
+
}
|
|
191
|
+
function needsChrome(app) {
|
|
192
|
+
return typeof app.icon !== "string";
|
|
193
|
+
}
|
|
145
194
|
function BrandContent({ app }) {
|
|
146
195
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
147
|
-
/* @__PURE__ */ jsx(
|
|
196
|
+
/* @__PURE__ */ jsx(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
className: cn(
|
|
200
|
+
"flex aspect-square size-8 items-center justify-center rounded-none",
|
|
201
|
+
needsChrome(app) && "bg-sidebar-primary text-sidebar-primary-foreground [&_svg]:size-4"
|
|
202
|
+
),
|
|
203
|
+
children: /* @__PURE__ */ jsx(Mark, { app, own: true, className: "size-full text-xs" })
|
|
204
|
+
}
|
|
205
|
+
),
|
|
148
206
|
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
149
207
|
/* @__PURE__ */ jsx("span", { className: "truncate font-semibold", children: app.name }),
|
|
150
208
|
app.description ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground truncate text-xs", children: app.description }) : null
|
|
@@ -153,7 +211,16 @@ function BrandContent({ app }) {
|
|
|
153
211
|
}
|
|
154
212
|
function AppRow({ app }) {
|
|
155
213
|
return /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, className: "gap-2 p-2", children: /* @__PURE__ */ jsxs("a", { href: app.href, children: [
|
|
156
|
-
/* @__PURE__ */ jsx(
|
|
214
|
+
/* @__PURE__ */ jsx(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
className: cn(
|
|
218
|
+
"flex size-6 items-center justify-center rounded-none",
|
|
219
|
+
needsChrome(app) && "border [&_svg]:size-3.5"
|
|
220
|
+
),
|
|
221
|
+
children: /* @__PURE__ */ jsx(Mark, { app, className: "size-full text-[10px]" })
|
|
222
|
+
}
|
|
223
|
+
),
|
|
157
224
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: app.name })
|
|
158
225
|
] }) });
|
|
159
226
|
}
|
|
@@ -205,45 +272,6 @@ function NavBrand({
|
|
|
205
272
|
)
|
|
206
273
|
] }) : /* @__PURE__ */ jsx(SidebarMenuButton, { size: "lg", asChild: true, tooltip: app.name, children: /* @__PURE__ */ jsx("a", { href: app.href, children: /* @__PURE__ */ jsx(BrandContent, { app }) }) }) }) });
|
|
207
274
|
}
|
|
208
|
-
function isIconUrl(s) {
|
|
209
|
-
return /^https?:\/\//i.test(s);
|
|
210
|
-
}
|
|
211
|
-
function AppGlyph({ icon, name, className }) {
|
|
212
|
-
const box = "flex size-9 shrink-0 items-center justify-center rounded-none";
|
|
213
|
-
const src = icon && isIconUrl(icon) ? icon : "";
|
|
214
|
-
const [failedSrc, setFailedSrc] = useState("");
|
|
215
|
-
const seen = useRef(src);
|
|
216
|
-
const ref = useRef(null);
|
|
217
|
-
if (seen.current !== src) {
|
|
218
|
-
seen.current = src;
|
|
219
|
-
if (failedSrc) setFailedSrc("");
|
|
220
|
-
}
|
|
221
|
-
useEffect(() => {
|
|
222
|
-
const img = ref.current;
|
|
223
|
-
if (img?.complete && img.naturalWidth === 0) setFailedSrc(img.getAttribute("src") ?? "");
|
|
224
|
-
}, [src]);
|
|
225
|
-
if (src && failedSrc !== src) {
|
|
226
|
-
return /* @__PURE__ */ jsx(
|
|
227
|
-
"img",
|
|
228
|
-
{
|
|
229
|
-
ref,
|
|
230
|
-
src,
|
|
231
|
-
alt: "",
|
|
232
|
-
"aria-hidden": true,
|
|
233
|
-
className: cn(box, "object-contain", className),
|
|
234
|
-
onError: () => setFailedSrc(src)
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
return /* @__PURE__ */ jsx(
|
|
239
|
-
"span",
|
|
240
|
-
{
|
|
241
|
-
"aria-hidden": true,
|
|
242
|
-
className: cn(box, "bg-primary/10 text-sm font-semibold text-primary", className),
|
|
243
|
-
children: (name || "?").charAt(0).toUpperCase()
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
275
|
function AppSwitcher({
|
|
248
276
|
app,
|
|
249
277
|
sections,
|
|
@@ -257,7 +285,10 @@ function AppSwitcher({
|
|
|
257
285
|
name: a.name,
|
|
258
286
|
description: a.description,
|
|
259
287
|
href: a.url,
|
|
260
|
-
|
|
288
|
+
// The registry URL, passed through. NavBrand draws every mark it shows - header and rows
|
|
289
|
+
// alike - so wrapping it in AppGlyph here as well is the second renderer that let the two
|
|
290
|
+
// drift apart in the first place.
|
|
291
|
+
icon: a.icon
|
|
261
292
|
}))
|
|
262
293
|
}));
|
|
263
294
|
return /* @__PURE__ */ jsx(
|
package/dist/shell/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shell/app-shell.tsx","../../src/shell/stacked-sidebar.tsx","../../src/shell/nav-group.tsx","../../src/shell/use-active-route.ts","../../src/shell/nav-item.tsx","../../src/shell/nav-section.tsx","../../src/shell/nav-brand.tsx","../../src/shell/app-glyph.tsx","../../src/shell/app-switcher.tsx","../../src/shell/nav-user.tsx","../../src/shell/tab-bar.tsx","../../src/shell/breadcrumbs.tsx","../../src/shell/app-grid.tsx"],"names":["jsx","jsxs","Link","Fragment","ChevronsUpDown","useRef","useEffect"],"mappings":";;;;;;;;;;;;;;;AAqCO,SAAS,QAAA,CAAS,EAAE,QAAA,EAAU,GAAG,MAAK,EAAkB;AAC7D,EAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAiB,GAAG,IAAA,EAAO,QAAA,EAAS,CAAA;AAC9C;AAGO,IAAM,YAAA,GAAe;AAGrB,SAAS,cAAA,CAAe;AAAA,EAC7B,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA6B;AAC3B,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,SAAA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A,EAAU,WAAA,EACb,QAAA,EAAA;AAAA,0BAAAD,GAAAA,CAAC,SAAA,EAAA,EAAW,QAAA,EAAA,GAAA,CAAI,IAAA,EAAK,CAAA;AAAA,UACpB,GAAA,CAAI,8BACHA,GAAAA,CAAC,mBAAgB,SAAA,EAAU,cAAA,EACxB,QAAA,EAAA,GAAA,CAAI,WAAA,EACP,CAAA,GACE;AAAA,SAAA,EACN;AAAA,OAAA,EACF;AAAA;AAAA,GACF;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport type { ComponentProps, ReactNode } from \"react\"\nimport {\n SidebarInset,\n SidebarProvider,\n} from \"~/ui/primitives/sidebar.js\"\nimport { cn } from \"~/utils/cn.js\"\n\nexport interface AppShellProps\n extends Omit<ComponentProps<typeof SidebarProvider>, \"children\"> {\n children: ReactNode\n}\n\n/**\n * App shell composition root. Wires `SidebarProvider`. Pair with\n * `<Sidebar>` from `@tradalab/lyra/ui` and `<AppShellMain>` for the\n * right-hand pane.\n *\n * @example\n * import { AppShell, AppShellMain, AppShellHeader, AppShellBody, NavGroup, NavItem, Breadcrumbs } from \"@tradalab/lyra/shell\"\n * import { Sidebar, SidebarHeader, SidebarContent, SidebarFooter, SidebarTrigger } from \"@tradalab/lyra/ui\"\n *\n * <AppShell>\n * <Sidebar collapsible=\"icon\">\n * <SidebarHeader>{logo}</SidebarHeader>\n * <SidebarContent>\n * <NavGroup label=\"Primitives\">{...}</NavGroup>\n * </SidebarContent>\n * <SidebarFooter>{user}</SidebarFooter>\n * </Sidebar>\n * <AppShellMain>\n * <AppShellHeader><SidebarTrigger /><Breadcrumbs /></AppShellHeader>\n * <AppShellBody>{children}</AppShellBody>\n * </AppShellMain>\n * </AppShell>\n */\nexport function AppShell({ children, ...rest }: AppShellProps) {\n return <SidebarProvider {...rest}>{children}</SidebarProvider>\n}\n\n/** Right-hand pane container. Alias for `SidebarInset`. */\nexport const AppShellMain = SidebarInset\n\n/** Top bar inside `<AppShellMain>`. Standardizes h-12 + border-b + flex row. */\nexport function AppShellHeader({\n className,\n children,\n ...rest\n}: ComponentProps<\"header\">) {\n return (\n <header\n className={cn(\n \"flex h-12 shrink-0 items-center gap-2 border-b px-3\",\n className,\n )}\n {...rest}\n >\n {children}\n </header>\n )\n}\n\n/** Scroll body inside `<AppShellMain>`. Sibling of `<AppShellHeader>`. */\nexport function AppShellBody({\n className,\n children,\n ...rest\n}: ComponentProps<\"div\">) {\n return (\n <div className={cn(\"flex-1 overflow-auto\", className)} {...rest}>\n {children}\n </div>\n )\n}\n","\"use client\"\n\nimport type { ComponentProps } from \"react\"\nimport { Sidebar } from \"~/ui/primitives/sidebar.js\"\nimport { cn } from \"~/utils/cn.js\"\n\n/**\n * Dual / stacked sidebar wrapper — an icon rail plus one or more content\n * panels rendered side-by-side inside a single `<Sidebar>`. This is the\n * shadcn \"sidebar-07\" pattern.\n *\n * The `*:data-[sidebar=sidebar]:flex-row` trick lays the inner\n * `[data-sidebar=sidebar]` wrappers of the nested {@link SidebarDock} /\n * {@link SidebarPanel} columns out horizontally. `variant`/`collapsible`\n * default to `\"sidebar\"`/`\"icon\"` but can be overridden.\n *\n * @example\n * import { AppShell, AppShellMain, StackedSidebar, SidebarDock, SidebarPanel } from \"@tradalab/lyra/shell\"\n * import { SidebarHeader, SidebarContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton } from \"@tradalab/lyra/ui\"\n *\n * <AppShell>\n * <StackedSidebar>\n * <SidebarDock>\n * <SidebarHeader>{logo}</SidebarHeader>\n * <SidebarContent>{iconButtons}</SidebarContent>\n * </SidebarDock>\n * {tab === \"files\" ? <SidebarPanel>{tree}</SidebarPanel> : null}\n * </StackedSidebar>\n * <AppShellMain>{children}</AppShellMain>\n * </AppShell>\n */\nexport function StackedSidebar({\n className,\n ...rest\n}: ComponentProps<typeof Sidebar>) {\n return (\n <Sidebar\n variant=\"sidebar\"\n collapsible=\"icon\"\n {...rest}\n className={cn(\n \"overflow-hidden *:data-[sidebar=sidebar]:flex-row\",\n className,\n )}\n />\n )\n}\n\n/**\n * Narrow icon-rail column inside a {@link StackedSidebar}. Fixed to the icon\n * width, never collapses on its own (the parent `StackedSidebar` owns the\n * icon-mode toggle).\n *\n * Named `SidebarDock` — not `SidebarRail` — because `SidebarRail` already\n * exists in `@tradalab/lyra/ui` as shadcn's drag-to-resize edge handle.\n */\nexport function SidebarDock({\n className,\n ...rest\n}: ComponentProps<typeof Sidebar>) {\n return (\n <Sidebar\n {...rest}\n collapsible=\"none\"\n className={cn(\n \"w-[calc(var(--sidebar-width-icon)+1px)]! overflow-hidden border-r\",\n className,\n )}\n />\n )\n}\n\n/**\n * Wider content column inside a {@link StackedSidebar} (tree, list, …).\n * Fills remaining width; render conditionally to show/hide per app state.\n */\nexport function SidebarPanel({\n className,\n ...rest\n}: ComponentProps<typeof Sidebar>) {\n return (\n <Sidebar\n {...rest}\n collapsible=\"none\"\n className={cn(\"flex-1 overflow-hidden\", className)}\n />\n )\n}\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport {\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarMenu,\n} from \"~/ui/primitives/sidebar.js\"\n\nexport interface NavGroupProps {\n label?: ReactNode\n children: ReactNode\n}\n\nexport function NavGroup({ label, children }: NavGroupProps) {\n return (\n <SidebarGroup>\n {label != null ? <SidebarGroupLabel>{label}</SidebarGroupLabel> : null}\n <SidebarGroupContent>\n <SidebarMenu>{children}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n )\n}\n","\"use client\"\n\nimport { usePathname } from \"next/navigation\"\n\nexport type MatchMode = \"exact\" | \"prefix\"\n\nexport interface UseActiveRoute {\n pathname: string\n isActive: (href: string, mode?: MatchMode) => boolean\n}\n\n/**\n * App-Router pathname helper. Default `mode` is `\"prefix\"`.\n *\n * Root (`/`) is always exact-matched regardless of `mode` — otherwise the\n * root nav item would light up on every nested page.\n */\nexport function useActiveRoute(): UseActiveRoute {\n const pathname = usePathname() ?? \"/\"\n return {\n pathname,\n isActive: (href, mode = \"prefix\") => {\n if (mode === \"exact\" || href === \"/\") return pathname === href\n return pathname === href || pathname.startsWith(`${href}/`)\n },\n }\n}\n","\"use client\"\n\nimport Link from \"next/link\"\nimport { ArrowUpRight } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport {\n SidebarMenuButton,\n SidebarMenuItem,\n} from \"~/ui/primitives/sidebar.js\"\nimport { useActiveRoute, type MatchMode } from \"./use-active-route.js\"\n\nexport type NavIcon = ReactNode\n\n/** Absolute URLs and mail/tel links leave the app — they can't go through next/link. */\nconst looksExternal = (href: string) =>\n /^([a-z][a-z0-9+.-]*:)?\\/\\//i.test(href) || /^(mailto|tel):/i.test(href)\n\nexport interface NavItemProps {\n href: string\n label: string\n /** Pre-rendered icon element, e.g. `<Globe />`. Element form so the prop is serializable across the RSC boundary. */\n icon?: NavIcon\n /** Sidebar tooltip; visible in collapsed icon mode. */\n tooltip?: string\n /** Default `\"prefix\"` — matches `href` and any nested path. */\n matchMode?: MatchMode\n /**\n * Render a new-tab anchor instead of a `next/link`, and never mark the row\n * active. Defaults to auto-detection: absolute (`https://…`), protocol-\n * relative, `mailto:` and `tel:` hrefs count as external.\n */\n external?: boolean\n}\n\n/** Sidebar nav row. Must be rendered inside a {@link NavGroup}. */\nexport function NavItem({\n href,\n label,\n icon,\n tooltip,\n matchMode = \"prefix\",\n external,\n}: NavItemProps) {\n const { isActive } = useActiveRoute()\n const isExternal = external ?? looksExternal(href)\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n asChild\n isActive={!isExternal && isActive(href, matchMode)}\n tooltip={tooltip}\n >\n {isExternal ? (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {icon}\n <span>{label}</span>\n <ArrowUpRight\n aria-hidden\n className=\"ms-auto size-3.5! shrink-0 opacity-50 group-data-[collapsible=icon]:hidden\"\n />\n </a>\n ) : (\n <Link href={href}>\n {icon}\n <span>{label}</span>\n </Link>\n )}\n </SidebarMenuButton>\n </SidebarMenuItem>\n )\n}\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport { NavGroup } from \"./nav-group.js\"\nimport { NavItem, type NavItemProps } from \"./nav-item.js\"\n\nexport interface NavSectionProps {\n /** Optional group heading. */\n label?: ReactNode\n /** Nav rows — each rendered as a {@link NavItem}. */\n items: NavItemProps[]\n}\n\n/**\n * Config-driven convenience over {@link NavGroup} + {@link NavItem}: pass a\n * data array instead of hand-mapping JSX. For dynamic or conditional rows,\n * compose `NavGroup`/`NavItem` directly.\n *\n * @example\n * const NAV = [\n * { href: \"/files\", label: \"Files\", icon: <Folder /> },\n * { href: \"/trash\", label: \"Trash\", icon: <Trash2 /> },\n * ]\n * <NavSection label=\"Workspace\" items={NAV} />\n */\nexport function NavSection({ label, items }: NavSectionProps) {\n return (\n <NavGroup label={label}>\n {items.map((item) => (\n <NavItem key={item.href} {...item} />\n ))}\n </NavGroup>\n )\n}\n","\"use client\"\n\nimport { Fragment, type ReactNode } from \"react\"\nimport { ChevronsUpDown } from \"lucide-react\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"~/ui/primitives/dropdown-menu.js\"\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useSidebar,\n} from \"~/ui/primitives/sidebar.js\"\n\n/** An application shown in the {@link NavBrand} header / switcher. */\nexport interface NavBrandApp {\n /** Display name. */\n name: string\n /**\n * Pre-rendered icon/logo element, e.g. `<Boxes />`. Element form (not a\n * component reference) so the prop stays serializable across the RSC\n * boundary — same convention as {@link NavItem}'s `icon`.\n */\n icon: ReactNode\n /** Navigation target. Usually an absolute cross-app URL (full navigation). */\n href: string\n /** Optional secondary line under the name (tagline / domain). */\n description?: string\n}\n\n/** A labeled section of apps in the {@link NavBrand} switcher. */\nexport interface NavBrandGroup {\n /** Stable React key. */\n key: string\n /** Section heading. Omit for an unlabeled section (e.g. ungrouped apps). */\n label?: string\n apps: NavBrandApp[]\n}\n\nexport interface NavBrandProps {\n /** The current app, rendered in the sidebar header. */\n app: NavBrandApp\n /**\n * Other apps to switch to (flat, single list). When omitted or empty — and no\n * `groups` — the header renders as a plain link to `app.href`.\n */\n apps?: NavBrandApp[]\n /**\n * Grouped apps — rendered as labeled sections separated by dividers. Takes\n * precedence over `apps`. The caller owns the grouping + ordering.\n */\n groups?: NavBrandGroup[]\n /** Heading above a flat `apps` list. Default `\"Applications\"`. Ignored for `groups`. */\n appsLabel?: string\n /** Extra menu content appended below the app list (e.g. an \"Add app\" row). */\n children?: ReactNode\n}\n\n/** Default English heading for the switcher's app list — override for i18n. */\nexport const defaultNavBrandAppsLabel = \"Applications\"\n\n/** Icon tile + name/description shown inside the header button. */\nfunction BrandContent({ app }: { app: NavBrandApp }) {\n return (\n <>\n <div className=\"bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-none [&_svg]:size-4\">\n {app.icon}\n </div>\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{app.name}</span>\n {app.description ? (\n <span className=\"text-muted-foreground truncate text-xs\">\n {app.description}\n </span>\n ) : null}\n </div>\n </>\n )\n}\n\n/** A single switch-to-app row (full-navigation link). */\nfunction AppRow({ app }: { app: NavBrandApp }) {\n return (\n <DropdownMenuItem asChild className=\"gap-2 p-2\">\n <a href={app.href}>\n <div className=\"flex size-6 items-center justify-center rounded-none border has-[img]:border-0 [&_svg]:size-3.5\">\n {app.icon}\n </div>\n <span className=\"truncate\">{app.name}</span>\n </a>\n </DropdownMenuItem>\n )\n}\n\n/**\n * Sidebar-header brand block with an optional app switcher — the standardized\n * `SidebarHeader` content for app shells (pairs with {@link NavUser} in the\n * footer). Presentational: the app owns the config, icons, and labels.\n *\n * With `groups` (or `apps`), the header is a dropdown trigger listing the other\n * apps as links; `groups` renders labeled sections, `apps` a single flat list.\n * Without either, the header is a plain link to `app.href`. Cross-app links use\n * a plain `<a>` so switching does a full navigation.\n *\n * Must render inside an `AppShell`/`SidebarProvider`, and below a\n * `TooltipProvider` (the collapsed-mode tooltip needs one).\n *\n * @example\n * <NavBrand\n * app={{ name: \"Admin\", description: \"Platform console\", icon: <ShieldCheck />, href: \"/\" }}\n * groups={[\n * { key: \"workspace\", label: \"Workspace\", apps: [{ name: \"Drive\", icon: <HardDrive />, href: \"https://drive.tradalab.com\" }] },\n * ]}\n * />\n */\nexport function NavBrand({\n app,\n apps,\n groups,\n appsLabel = defaultNavBrandAppsLabel,\n children,\n}: NavBrandProps) {\n const { isMobile } = useSidebar()\n const groupTotal = groups?.reduce((n, g) => n + g.apps.length, 0) ?? 0\n const hasSwitcher = (apps?.length ?? 0) > 0 || groupTotal > 0 || children != null\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n {hasSwitcher ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n tooltip={app.name}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n <BrandContent app={app} />\n <ChevronsUpDown className=\"ml-auto size-4\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-none\"\n align=\"start\"\n side={isMobile ? \"bottom\" : \"right\"}\n sideOffset={4}\n >\n {groupTotal > 0 ? (\n groups!.map((g, i) => (\n <Fragment key={g.key}>\n {i > 0 ? <DropdownMenuSeparator /> : null}\n {g.label ? (\n <DropdownMenuLabel className=\"text-muted-foreground text-xs\">\n {g.label}\n </DropdownMenuLabel>\n ) : null}\n {g.apps.map((item) => (\n <AppRow key={item.href} app={item} />\n ))}\n </Fragment>\n ))\n ) : (\n <>\n <DropdownMenuLabel className=\"text-muted-foreground text-xs\">\n {appsLabel}\n </DropdownMenuLabel>\n {apps?.map((item) => (\n <AppRow key={item.href} app={item} />\n ))}\n </>\n )}\n {children ? (\n <>\n <DropdownMenuSeparator />\n {children}\n </>\n ) : null}\n </DropdownMenuContent>\n </DropdownMenu>\n ) : (\n <SidebarMenuButton size=\"lg\" asChild tooltip={app.name}>\n <a href={app.href}>\n <BrandContent app={app} />\n </a>\n </SidebarMenuButton>\n )}\n </SidebarMenuItem>\n </SidebarMenu>\n )\n}\n","\"use client\"\n\n// The single renderer for a registered app's mark, shared by the app switcher, the launcher and\n// the Apps admin so one app looks identical everywhere. `icon` is the URL of the image the app\n// ships; anything else, and an image that fails to load, falls back to a name monogram.\n//\n// Lucide icon NAMES are deliberately no longer accepted: resolving any name at runtime meant\n// importing `lucide-react/dynamic`, one `import()` per icon, and Turbopack turned that into ~2000\n// chunk groups on every page of every app (doc/platform/PITFALLS.md).\n\nimport { useEffect, useRef, useState } from \"react\"\n\nimport { cn } from \"~/utils/cn.js\"\n\n// Absolute only: a relative path would resolve against whichever app is showing the launcher.\nexport function isIconUrl(s: string): boolean {\n return /^https?:\\/\\//i.test(s)\n}\n\nexport interface AppGlyphProps {\n /** Absolute http(s) image URL; any other value draws the monogram. */\n icon?: string\n /** App name, drawn as the monogram when there is no image. */\n name?: string\n className?: string\n}\n\n/** An app's mark: its image when `icon` is a URL that loads, else a name monogram. */\nexport function AppGlyph({ icon, name, className }: AppGlyphProps) {\n const box = \"flex size-9 shrink-0 items-center justify-center rounded-none\"\n const src = icon && isIconUrl(icon) ? icon : \"\"\n const [failedSrc, setFailedSrc] = useState(\"\")\n const seen = useRef(src)\n const ref = useRef<HTMLImageElement>(null)\n\n // A new URL deserves its own attempt, including one that failed earlier: the admin form edits\n // this field a keystroke at a time, and a URL typed past a broken prefix would stay dead.\n if (seen.current !== src) {\n seen.current = src\n if (failedSrc) setFailedSrc(\"\")\n }\n\n // An image that fails before hydration never fires onError, so the mount check is what\n // catches a server-rendered tile whose host is down. It reads getAttribute, not `img.src`:\n // that property normalizes the URL (an upper-case scheme comes back lower-cased), and the\n // comparison below would then never match, leaving a broken image on screen.\n useEffect(() => {\n const img = ref.current\n if (img?.complete && img.naturalWidth === 0) setFailedSrc(img.getAttribute(\"src\") ?? \"\")\n }, [src])\n\n if (src && failedSrc !== src) {\n return (\n <img\n ref={ref}\n src={src}\n alt=\"\"\n aria-hidden\n className={cn(box, \"object-contain\", className)}\n onError={() => setFailedSrc(src)}\n />\n )\n }\n\n return (\n <span\n aria-hidden\n className={cn(box, \"bg-primary/10 text-sm font-semibold text-primary\", className)}\n >\n {(name || \"?\").charAt(0).toUpperCase()}\n </span>\n )\n}\n","\"use client\"\n\nimport { AppGlyph } from \"./app-glyph.js\"\nimport {\n NavBrand,\n type NavBrandApp,\n type NavBrandGroup,\n} from \"./nav-brand.js\"\n\n/**\n * A registry app in the {@link AppSwitcher} — the shape a launcher endpoint\n * returns (icon as a URL string; the glyph is rendered internally). Structurally\n * matches nekit's `LauncherApp`, so `groupApps(...)` output feeds straight in.\n */\nexport interface AppSwitcherApp {\n name: string\n description?: string\n /** Navigation target (usually an absolute cross-app URL). */\n url: string\n /** Image URL; anything else renders a monogram. */\n icon: string\n}\n\n/** A grouped, ordered section of apps (label omitted for the ungrouped bucket). */\nexport interface AppSwitcherSection {\n key: string\n label?: string\n apps: AppSwitcherApp[]\n}\n\nexport interface AppSwitcherProps {\n /** The current app, shown in the sidebar header. */\n app: NavBrandApp\n /** Grouped registry apps — e.g. nekit `groupApps(data.apps, data.groups)`. */\n sections: AppSwitcherSection[]\n /** Heading for the flat fallback list. */\n appsLabel?: string\n /** Shown when `sections` is empty (registry loading / unavailable) so the\n * switcher never collapses to a plain link. */\n fallback?: NavBrandApp[]\n}\n\n/**\n * The cross-app switcher: a batteries-included wrapper over {@link NavBrand} that\n * takes the launcher registry (grouped `sections` of `{ icon, url, … }`)\n * and renders it — labeled group sections, each app's glyph via {@link AppGlyph}.\n * Consumers just fetch + group (nekit) and pass config; icon/render logic lives\n * here. Empty registry → the `fallback` flat list.\n *\n * @example\n * const sections = groupApps(data.apps, data.groups) // @tradalab/nekit/data/launcher\n * <AppSwitcher app={{ name: \"Admin\", icon: <ShieldCheck/>, href: \"/\" }} sections={sections} />\n */\nexport function AppSwitcher({\n app,\n sections,\n appsLabel,\n fallback,\n}: AppSwitcherProps) {\n const groups: NavBrandGroup[] = sections\n .filter((s) => s.apps.length > 0)\n .map((s) => ({\n key: s.key,\n label: s.label,\n apps: s.apps.map((a) => ({\n name: a.name,\n description: a.description,\n href: a.url,\n icon: <AppGlyph icon={a.icon} name={a.name} className=\"size-full text-[10px]\" />,\n })),\n }))\n\n return (\n <NavBrand\n app={app}\n groups={groups.length ? groups : undefined}\n apps={groups.length ? undefined : fallback}\n appsLabel={appsLabel}\n />\n )\n}\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport {\n ChevronsUpDown,\n CircleUser,\n LogIn,\n LogOut,\n Monitor,\n Moon,\n Palette,\n Sun,\n UserRoundCog,\n} from \"lucide-react\"\nimport { useTheme } from \"next-themes\"\nimport { Avatar, AvatarFallback, AvatarImage } from \"~/ui/primitives/avatar.js\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"~/ui/primitives/dropdown-menu.js\"\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useSidebar,\n} from \"~/ui/primitives/sidebar.js\"\nimport {\n defaultAccountMenuLabels,\n initialsOf,\n type AccountMenuLabels,\n type AccountMenuUser,\n} from \"~/ui/account-menu.js\"\n\nexport interface NavUserThemeLabels {\n theme: string\n light: string\n dark: string\n system: string\n}\n\n/** Default English theme-submenu labels — spread + override for i18n. */\nexport const defaultNavUserThemeLabels: NavUserThemeLabels = {\n theme: \"Theme\",\n light: \"Light\",\n dark: \"Dark\",\n system: \"System\",\n}\n\nexport interface NavUserProps {\n /**\n * Signed-in user. When `null`/`undefined`, renders a guest menu (icon +\n * theme + Sign in) if `onSignIn` is set, otherwise renders nothing.\n */\n user?: AccountMenuUser | null\n /** Account-action labels — reuses lyra's {@link AccountMenuLabels}. */\n labels?: Partial<AccountMenuLabels>\n /** Switch-account handler (signed-in only). Item hidden if omitted. */\n onSwitchAccount?: () => void\n /** Sign-out handler (signed-in only). Item hidden if omitted. */\n onSignOut?: () => void\n /**\n * Sign-in handler (guest only). When set, a null `user` renders the guest\n * menu with a Sign in action instead of rendering nothing.\n */\n onSignIn?: () => void\n /** Render the light/dark/system theme submenu. Default `true`. */\n showTheme?: boolean\n /** Theme-submenu labels. */\n themeLabels?: Partial<NavUserThemeLabels>\n /** Extra menu content inserted below the theme submenu. */\n children?: ReactNode\n}\n\nconst THEMES = [\n { value: \"light\", key: \"light\", icon: Sun },\n { value: \"dark\", key: \"dark\", icon: Moon },\n { value: \"system\", key: \"system\", icon: Monitor },\n] as const\n\n/**\n * Sidebar-footer account menu — the standardized NavUser for app shells.\n * Avatar trigger (size `lg`) + name/email opening a dropdown with an optional\n * theme switcher and switch-account / sign-out actions. Auth flows stay in the\n * app (callbacks); labels are props for i18n.\n *\n * Differs from {@link AccountMenu} in `@tradalab/lyra/ui`: that one is a\n * generic header dropdown; this is styled for the collapsible sidebar footer\n * and follows `useSidebar()` for mobile placement.\n *\n * Must render inside an `AppShell`/SidebarProvider, and below a\n * `TooltipProvider` (the avatar button's collapsed-mode tooltip requires one —\n * app root providers normally mount it). The theme submenu needs a\n * `next-themes` provider mounted (it no-ops without one); pass\n * `showTheme={false}` for apps with a fixed theme.\n *\n * @example\n * import { NavUser } from \"@tradalab/lyra/shell\"\n * import { SidebarFooter } from \"@tradalab/lyra/ui\"\n *\n * <SidebarFooter>\n * <NavUser\n * user={session.user}\n * onSwitchAccount={() => signIn(\"zitadel\", { redirectTo: \"/\" }, { prompt: \"select_account\" })}\n * onSignOut={() => signOut({ redirectTo: \"/\" })}\n * />\n * </SidebarFooter>\n */\nexport function NavUser({\n user,\n labels,\n onSwitchAccount,\n onSignOut,\n onSignIn,\n showTheme = true,\n themeLabels,\n children,\n}: NavUserProps) {\n const { isMobile } = useSidebar()\n const { theme, setTheme } = useTheme()\n const l = { ...defaultAccountMenuLabels, ...labels }\n const t = { ...defaultNavUserThemeLabels, ...themeLabels }\n\n // Guests render nothing unless a sign-in handler opts them into a guest menu.\n if (!user && !onSignIn) return null\n\n const name = user ? (user.name ?? user.email ?? l.account) : l.guest\n const email = user?.email ?? \"\"\n\n const avatar = (\n <Avatar className=\"size-8 rounded-none after:rounded-none\">\n {user?.image ? (\n <AvatarImage className=\"rounded-none\" src={user.image} alt={name} />\n ) : null}\n <AvatarFallback className=\"rounded-none\">\n {user ? initialsOf(name) : <CircleUser className=\"size-4\" />}\n </AvatarFallback>\n </Avatar>\n )\n\n const themeSubmenu = showTheme ? (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>\n <Palette className=\"mr-2 size-4\" />\n {t.theme}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup value={theme ?? \"system\"} onValueChange={setTheme}>\n {THEMES.map(({ value, key, icon: Icon }) => (\n <DropdownMenuRadioItem key={value} value={value}>\n <Icon className=\"mr-2 size-4\" />\n {t[key]}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n </>\n ) : null\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n tooltip={name}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n {avatar}\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-medium\">{name}</span>\n {email ? (\n <span className=\"text-muted-foreground truncate text-xs\">\n {email}\n </span>\n ) : null}\n </div>\n <ChevronsUpDown className=\"ml-auto size-4\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-(--radix-dropdown-menu-trigger-width) min-w-56\"\n side={isMobile ? \"bottom\" : \"right\"}\n align=\"end\"\n sideOffset={4}\n >\n <DropdownMenuLabel className=\"flex items-center gap-2\">\n {avatar}\n <div className=\"grid flex-1 text-left leading-tight\">\n <span className=\"truncate text-sm font-medium\">{name}</span>\n {email ? (\n <span className=\"text-muted-foreground truncate text-xs font-normal\">\n {email}\n </span>\n ) : null}\n </div>\n </DropdownMenuLabel>\n\n {themeSubmenu}\n\n {children ? (\n <>\n <DropdownMenuSeparator />\n {children}\n </>\n ) : null}\n\n {user ? (\n <>\n {onSwitchAccount || onSignOut ? <DropdownMenuSeparator /> : null}\n {onSwitchAccount ? (\n <DropdownMenuItem onSelect={onSwitchAccount}>\n <UserRoundCog className=\"mr-2 size-4\" />\n {l.switchAccount}\n </DropdownMenuItem>\n ) : null}\n {onSignOut ? (\n <DropdownMenuItem variant=\"destructive\" onSelect={onSignOut}>\n <LogOut className=\"mr-2 size-4\" />\n {l.signOut}\n </DropdownMenuItem>\n ) : null}\n </>\n ) : (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuItem onSelect={onSignIn}>\n <LogIn className=\"mr-2 size-4\" />\n {l.signIn}\n </DropdownMenuItem>\n </>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n </SidebarMenu>\n )\n}\n","\"use client\"\n\nimport { useEffect, useRef, type ReactNode, type WheelEvent } from \"react\"\nimport { ChevronDown, ListX, Pin, PinOff, Trash2, X } from \"lucide-react\"\nimport { Button } from \"~/ui/primitives/button.js\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"~/ui/primitives/dropdown-menu.js\"\nimport { ScrollArea, ScrollBar } from \"~/ui/primitives/scroll-area.js\"\nimport {\n ContextMenu,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuTrigger,\n} from \"~/ui/primitives/context-menu.js\"\nimport { cn } from \"~/utils/cn.js\"\n\nexport interface TabItem {\n id: string\n title: string\n /** Secondary line under the title (e.g. connection/db, file path). */\n subtitle?: ReactNode\n /** Leading icon element — the app maps its own tab type → icon. */\n icon?: ReactNode\n pinned?: boolean\n}\n\nexport interface TabBarLabels {\n close: string\n pinTab: string\n unpinTab: string\n closeOthers: string\n closeAll: string\n}\n\n/** Default English labels — spread + override for i18n. */\nexport const defaultTabBarLabels: TabBarLabels = {\n close: \"Close\",\n pinTab: \"Pin tab\",\n unpinTab: \"Unpin tab\",\n closeOthers: \"Close others\",\n closeAll: \"Close all\",\n}\n\nexport interface TabBarProps {\n tabs: TabItem[]\n activeId: string | null\n onSelect: (id: string) => void\n onClose: (id: string) => void\n /** Pin row in the context menu is hidden when omitted. */\n onTogglePin?: (id: string) => void\n /** \"Close others\" row is hidden when omitted. */\n onCloseOthers?: (id: string) => void\n /** \"Close all\" row is hidden when omitted. */\n onCloseAll?: () => void\n labels?: Partial<TabBarLabels>\n}\n\n/**\n * Horizontal tab strip for the content area of stacked-sidebar apps\n * (redishub, loom). Presentational + store-agnostic: the app owns tab state\n * and passes `tabs` + callbacks; `icon`/`subtitle` are per-tab so apps map\n * their own tab types, and labels are props for i18n. Renders nothing when\n * `tabs` is empty.\n *\n * Sizes rows from the `--tab-height` CSS var — set it in your globals.\n *\n * @example\n * const s = useTabStore()\n * <TabBar\n * tabs={s.tabs.map(t => ({ id: t.id, title: t.title, pinned: t.pinned, icon: <Icon t={t.type}/>, subtitle: fmt(t) }))}\n * activeId={s.activeTabId}\n * onSelect={s.setActiveTabId}\n * onClose={s.removeTab}\n * onTogglePin={s.togglePin}\n * onCloseOthers={s.closeOthers}\n * onCloseAll={s.closeAll}\n * />\n */\nexport function TabBar({\n tabs,\n activeId,\n onSelect,\n onClose,\n onTogglePin,\n onCloseOthers,\n onCloseAll,\n labels,\n}: TabBarProps) {\n const l = { ...defaultTabBarLabels, ...labels }\n const activeTabRef = useRef<HTMLDivElement>(null)\n\n // Scroll the active tab into view when it changes.\n useEffect(() => {\n if (activeId && activeTabRef.current) {\n activeTabRef.current.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"nearest\",\n })\n }\n }, [activeId])\n\n // Map vertical wheel scroll to horizontal scroll over the tab strip.\n const handleWheel = (e: WheelEvent<HTMLDivElement>) => {\n if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) {\n const viewport = e.currentTarget.querySelector(\n '[data-slot=\"scroll-area-viewport\"]',\n )\n if (viewport) viewport.scrollLeft += e.deltaY * 0.5\n }\n }\n\n if (tabs.length === 0) return null\n\n const hasContextActions = Boolean(onTogglePin || onCloseOthers || onCloseAll)\n\n return (\n <div\n className=\"group/tabbar flex w-full shrink-0 items-center overflow-hidden border-b bg-muted/30\"\n style={{ height: \"var(--tab-height)\" }}\n >\n <ScrollArea\n type=\"hover\"\n className=\"min-w-0 flex-1 overflow-hidden [&_[data-orientation=vertical]]:hidden\"\n onWheel={handleWheel}\n >\n <div\n className=\"flex w-max items-center gap-0\"\n style={{ height: \"var(--tab-height)\" }}\n >\n {tabs.map((tab) => {\n const isActive = activeId === tab.id\n return (\n <ContextMenu key={tab.id}>\n <ContextMenuTrigger asChild>\n <div\n ref={isActive ? activeTabRef : null}\n onClick={() => onSelect(tab.id)}\n title={tab.title}\n className={cn(\n \"group relative flex min-w-[140px] max-w-[240px] shrink-0 cursor-pointer select-none items-center gap-2 border-r px-3 transition-colors\",\n isActive\n ? \"border-t-2 border-t-primary bg-background\"\n : \"border-t-2 border-t-transparent bg-transparent text-muted-foreground hover:bg-muted/50\",\n tab.pinned && \"min-w-[100px] bg-primary/5\",\n )}\n style={{ height: \"var(--tab-height)\" }}\n >\n {tab.icon ? (\n <div className=\"relative shrink-0\">\n <span\n className={cn(\n \"flex [&_svg]:size-3.5\",\n isActive && \"text-primary\",\n )}\n >\n {tab.icon}\n </span>\n {tab.pinned ? (\n <div className=\"absolute -right-1.5 -top-1.5 rounded-full bg-background p-0.5 shadow-sm\">\n <Pin className=\"size-2 fill-primary text-primary\" />\n </div>\n ) : null}\n </div>\n ) : null}\n <div className=\"flex min-w-0 flex-1 flex-col items-start justify-center overflow-hidden py-1\">\n <span\n className={cn(\n \"w-full truncate text-xs leading-tight\",\n isActive && \"font-medium text-foreground\",\n )}\n >\n {tab.title}\n </span>\n {tab.subtitle ? (\n <span className=\"mt-0.5 w-full truncate text-[10px] leading-none text-muted-foreground/70\">\n {tab.subtitle}\n </span>\n ) : null}\n </div>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n title={l.close}\n className={cn(\n \"size-5 shrink-0 rounded-md opacity-0 transition-opacity hover:bg-muted-foreground/20 group-hover:opacity-100\",\n isActive && \"opacity-100\",\n )}\n onClick={(e) => {\n e.stopPropagation()\n onClose(tab.id)\n }}\n >\n <X className=\"size-3\" />\n </Button>\n {isActive ? (\n <div className=\"absolute bottom-0 left-0 right-0 z-10 h-[2px] bg-background\" />\n ) : null}\n </div>\n </ContextMenuTrigger>\n {hasContextActions ? (\n <ContextMenuContent className=\"w-48\">\n {onTogglePin ? (\n <>\n <ContextMenuItem onClick={() => onTogglePin(tab.id)}>\n {tab.pinned ? (\n <>\n <PinOff className=\"mr-2 size-4\" />\n <span>{l.unpinTab}</span>\n </>\n ) : (\n <>\n <Pin className=\"mr-2 size-4\" />\n <span>{l.pinTab}</span>\n </>\n )}\n </ContextMenuItem>\n <ContextMenuSeparator />\n </>\n ) : null}\n <ContextMenuItem onClick={() => onClose(tab.id)}>\n <X className=\"mr-2 size-4\" />\n <span>{l.close}</span>\n </ContextMenuItem>\n {onCloseOthers ? (\n <ContextMenuItem onClick={() => onCloseOthers(tab.id)}>\n <ListX className=\"mr-2 size-4\" />\n <span>{l.closeOthers}</span>\n </ContextMenuItem>\n ) : null}\n {onCloseAll ? (\n <ContextMenuItem onClick={() => onCloseAll()}>\n <Trash2 className=\"mr-2 size-4\" />\n <span>{l.closeAll}</span>\n </ContextMenuItem>\n ) : null}\n </ContextMenuContent>\n ) : null}\n </ContextMenu>\n )\n })}\n </div>\n <ScrollBar orientation=\"horizontal\" className=\"z-20 h-1.5 hover:h-2\" />\n </ScrollArea>\n\n <div\n className=\"flex shrink-0 items-center border-l bg-muted/30 px-1\"\n style={{ height: \"var(--tab-height)\" }}\n >\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" className=\"size-8 shrink-0 rounded-sm\">\n <ChevronDown className=\"size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"end\"\n className=\"max-h-[400px] w-[260px] overflow-y-auto\"\n >\n {tabs.map((tab) => (\n <DropdownMenuItem\n key={tab.id}\n onClick={() => onSelect(tab.id)}\n title={tab.title}\n className={cn(\n \"cursor-pointer gap-2 py-2\",\n activeId === tab.id && \"bg-accent\",\n )}\n >\n {tab.icon ? (\n <div className=\"relative shrink-0\">\n <span className=\"flex text-muted-foreground [&_svg]:size-4\">\n {tab.icon}\n </span>\n {tab.pinned ? (\n <Pin className=\"absolute -right-1 -top-1 size-2 fill-primary text-primary\" />\n ) : null}\n </div>\n ) : null}\n <div className=\"flex flex-1 flex-col items-start overflow-hidden leading-tight\">\n <span className=\"w-full flex-1 truncate text-sm\">{tab.title}</span>\n {tab.subtitle ? (\n <span className=\"w-full truncate text-[10px] text-muted-foreground\">\n {tab.subtitle}\n </span>\n ) : null}\n </div>\n <X\n className=\"size-4 shrink-0 rounded-sm p-0.5 hover:bg-red-50 hover:text-red-500\"\n onClick={(e) => {\n e.stopPropagation()\n onClose(tab.id)\n }}\n />\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n )\n}\n","\"use client\"\n\nimport { Fragment, type ComponentProps, type ReactNode } from \"react\"\nimport Link from \"next/link\"\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"~/ui/primitives/breadcrumb.js\"\nimport { useActiveRoute } from \"./use-active-route.js\"\n\nexport interface LeadingCrumb {\n /** Where the crumb links. Omit to render it as plain text. */\n href?: string\n label: ReactNode\n /** Hide on small screens, as app-name crumbs usually should. Default `true`. */\n hideOnMobile?: boolean\n}\n\nexport interface BreadcrumbsProps extends ComponentProps<typeof Breadcrumb> {\n /** Separator content. Falls back to shadcn's chevron when omitted. */\n separator?: ReactNode\n /** Segment-id → display-label map. Unmapped segments render raw. */\n labels?: Record<string, string>\n /**\n * Crumb rendered before the path segments — typically the app name linking\n * home. With it set the trail also renders on the root route (as the current\n * page); without it the root route renders nothing.\n */\n leading?: LeadingCrumb\n}\n\n/** Pathname-derived breadcrumbs. Renders nothing on the root route unless `leading` is set. */\nexport function Breadcrumbs({ separator, labels, leading, ...rest }: BreadcrumbsProps) {\n const { pathname } = useActiveRoute()\n const segments = pathname.split(\"/\").filter(Boolean)\n if (segments.length === 0 && !leading) return null\n const last = segments.length - 1\n const hideLeading = leading?.hideOnMobile ?? true\n return (\n <Breadcrumb {...rest}>\n <BreadcrumbList>\n {leading ? (\n <BreadcrumbItem className={hideLeading ? \"hidden md:block\" : undefined}>\n {/* On the root route the leading crumb IS the current page. */}\n {segments.length === 0 ? (\n <BreadcrumbPage>{leading.label}</BreadcrumbPage>\n ) : leading.href ? (\n <BreadcrumbLink asChild>\n <Link href={leading.href}>{leading.label}</Link>\n </BreadcrumbLink>\n ) : (\n leading.label\n )}\n </BreadcrumbItem>\n ) : null}\n {segments.map((seg, i) => {\n const href = \"/\" + segments.slice(0, i + 1).join(\"/\")\n const label = labels?.[seg] ?? seg\n return (\n <Fragment key={href}>\n {i > 0 || leading ? (\n <BreadcrumbSeparator className={i === 0 && hideLeading && leading ? \"hidden md:block\" : undefined}>\n {separator}\n </BreadcrumbSeparator>\n ) : null}\n <BreadcrumbItem>\n {i === last ? (\n <BreadcrumbPage>{label}</BreadcrumbPage>\n ) : (\n <BreadcrumbLink asChild>\n <Link href={href}>{label}</Link>\n </BreadcrumbLink>\n )}\n </BreadcrumbItem>\n </Fragment>\n )\n })}\n </BreadcrumbList>\n </Breadcrumb>\n )\n}\n","import type { ReactNode } from \"react\"\nimport { Search } from \"lucide-react\"\n\nimport { cn } from \"~/utils/cn.js\"\nimport {\n Card,\n CardDescription,\n CardTitle,\n} from \"~/ui/primitives/card.js\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from \"~/ui/primitives/input-group.js\"\n\n/** One application in the {@link AppGrid} — rendered as an {@link AppTile}. */\nexport interface AppGridItem {\n /** Stable React list key. */\n key: string\n /** Display name. */\n name: string\n /** Optional tagline shown under the name. */\n description?: string\n /** Navigation target (usually an absolute cross-app URL). */\n href: string\n /**\n * Pre-rendered icon element (RSC-serializable), e.g. `<ToolCase />`. Sized by\n * the tile (`[&_svg]:size-7`) — same convention as {@link NavBrandApp}'s icon.\n */\n icon: ReactNode\n /**\n * Tailwind class string tinting the icon tile — `text-…` (colors the icon via\n * currentColor) + `bg-…` (tile background). Pass full class strings, not\n * interpolated fragments, so the JIT keeps them.\n */\n accent?: string\n /** Opens on a different origin (adds `target=\"_blank\"` + `rel`). */\n external?: boolean\n}\n\n/** A titled section of apps for {@link AppGrid}'s grouped mode. */\nexport interface AppGridGroup {\n /** Stable React list key. */\n key: string\n /** Section heading. */\n label: string\n /** Optional sub-heading under the label. */\n description?: string\n /** Apps in this group — already filtered by the caller. */\n apps: AppGridItem[]\n}\n\nexport interface AppGridProps {\n /** Flat mode: apps to render (already filtered). Ignored when `groups` is set. */\n apps?: AppGridItem[]\n /**\n * Grouped mode: titled sections (already filtered). When provided, renders a\n * heading + tile grid per group; empty groups are dropped.\n */\n groups?: AppGridGroup[]\n /** Controlled search value. Pass together with `onQueryChange` to show the search box. */\n query?: string\n onQueryChange?: (query: string) => void\n /** Search input placeholder. */\n searchPlaceholder?: string\n /** Autofocus the search box on mount. Default `false`. */\n autoFocusSearch?: boolean\n /** Message shown when there are no apps. */\n emptyLabel?: string\n className?: string\n}\n\n/** Default English labels — override for i18n. */\nexport const defaultAppGridLabels = {\n searchPlaceholder: \"Search apps…\",\n empty: \"No apps found.\",\n}\n\n/**\n * A responsive grid of application tiles with an optional search box — the \"app\n * grid\" / launcher surface (a portal home / \"all apps\" page). Presentational:\n * the app owns the registry, i18n, icons, and the filter — pass the already-\n * filtered `apps` plus a controlled `query`. Same app/lyra split as\n * {@link NavBrand} and {@link TabBar}.\n *\n * @example\n * const [q, setQ] = useState(\"\")\n * const filtered = APPS.filter(a => match(a, q))\n * <AppGrid\n * apps={filtered.map(a => ({\n * key: a.slug, name: t(a.slug), description: t(`${a.slug}.desc`),\n * href: a.href, icon: <a.Icon />, accent: a.accent, external: true,\n * }))}\n * query={q} onQueryChange={setQ}\n * searchPlaceholder={t(\"search\")} emptyLabel={t(\"empty\")}\n * />\n */\nexport function AppGrid({\n apps,\n groups,\n query,\n onQueryChange,\n searchPlaceholder = defaultAppGridLabels.searchPlaceholder,\n autoFocusSearch = false,\n emptyLabel = defaultAppGridLabels.empty,\n className,\n}: AppGridProps) {\n const grouped = groups != null\n const sections = grouped ? groups.filter((g) => g.apps.length > 0) : []\n const flat = apps ?? []\n const isEmpty = grouped ? sections.length === 0 : flat.length === 0\n\n return (\n <div className={cn(\"space-y-8\", className)}>\n {onQueryChange ? (\n <InputGroup className=\"mx-auto h-10 max-w-md\">\n <InputGroupAddon>\n <Search />\n </InputGroupAddon>\n <InputGroupInput\n type=\"search\"\n value={query ?? \"\"}\n onChange={(e) => onQueryChange(e.target.value)}\n placeholder={searchPlaceholder}\n aria-label={searchPlaceholder}\n autoFocus={autoFocusSearch}\n />\n </InputGroup>\n ) : null}\n\n {isEmpty ? (\n <p className=\"text-muted-foreground py-16 text-center text-sm\">\n {emptyLabel}\n </p>\n ) : grouped ? (\n <div className=\"space-y-10\">\n {sections.map((g) => (\n <section key={g.key} className=\"space-y-4\">\n <div className=\"space-y-1\">\n <h2 className=\"text-sm font-semibold tracking-tight\">{g.label}</h2>\n {g.description ? (\n <p className=\"text-muted-foreground text-xs\">{g.description}</p>\n ) : null}\n </div>\n <AppTileGrid apps={g.apps} />\n </section>\n ))}\n </div>\n ) : (\n <AppTileGrid apps={flat} />\n )}\n </div>\n )\n}\n\n/** The responsive tile grid shared by {@link AppGrid}'s flat and grouped modes. */\nfunction AppTileGrid({ apps }: { apps: AppGridItem[] }) {\n return (\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">\n {apps.map((app) => (\n <AppTile key={app.key} app={app} />\n ))}\n </div>\n )\n}\n\n/**\n * A single application tile: the icon in a tinted rounded chip above the name +\n * description. Exported for callers that render their own grid.\n */\nexport function AppTile({ app }: { app: AppGridItem }) {\n return (\n <a\n href={app.href}\n target={app.external ? \"_blank\" : undefined}\n rel={app.external ? \"noreferrer\" : undefined}\n className=\"focus-visible:ring-ring group rounded-none outline-none focus-visible:ring-2\"\n >\n <Card className=\"h-full items-center gap-4 px-6 py-8 text-center transition-all duration-200 group-hover:-translate-y-0.5 group-hover:shadow-md group-hover:ring-foreground/30\">\n {/* Tinted icon tile (sharp — matches lyra's rounded-none aesthetic);\n `accent` carries the text-… (icon, via currentColor) + bg-… tint. */}\n {/* An app image arrives with its own plate, so the hairline ring would frame it twice. */}\n <div\n className={cn(\n \"flex size-14 items-center justify-center rounded-none ring-1 ring-foreground/5 ring-inset transition-transform duration-200 group-hover:scale-105 has-[img]:ring-0 [&_svg]:size-7\",\n app.accent,\n )}\n >\n {app.icon}\n </div>\n <div className=\"space-y-1\">\n <CardTitle>{app.name}</CardTitle>\n {app.description ? (\n <CardDescription className=\"line-clamp-2\">\n {app.description}\n </CardDescription>\n ) : null}\n </div>\n </Card>\n </a>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/shell/app-shell.tsx","../../src/shell/stacked-sidebar.tsx","../../src/shell/nav-group.tsx","../../src/shell/use-active-route.ts","../../src/shell/nav-item.tsx","../../src/shell/nav-section.tsx","../../src/shell/app-glyph.tsx","../../src/shell/nav-brand.tsx","../../src/shell/app-switcher.tsx","../../src/shell/nav-user.tsx","../../src/shell/tab-bar.tsx","../../src/shell/breadcrumbs.tsx","../../src/shell/app-grid.tsx"],"names":["jsx","jsxs","Link","Fragment","ChevronsUpDown","useRef","useEffect"],"mappings":";;;;;;;;;;;;;;;AAqCO,SAAS,QAAA,CAAS,EAAE,QAAA,EAAU,GAAG,MAAK,EAAkB;AAC7D,EAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAiB,GAAG,IAAA,EAAO,QAAA,EAAS,CAAA;AAC9C;AAGO,IAAM,YAAA,GAAe;AAGrB,SAAS,cAAA,CAAe;AAAA,EAC7B,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA6B;AAC3B,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,EAAA;AAAA,QACT,qDAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ;AAGO,SAAS,YAAA,CAAa;AAAA,EAC3B,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0B;AACxB,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAW,EAAA,CAAG,wBAAwB,SAAS,CAAA,EAAI,GAAG,IAAA,EACxD,QAAA,EACH,CAAA;AAEJ;AC3CO,SAAS,cAAA,CAAe;AAAA,EAC7B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAmC;AACjC,EAAA,uBACEA,GAAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,SAAA;AAAA,MACR,WAAA,EAAY,MAAA;AAAA,MACX,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,mDAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;AAUO,SAAS,WAAA,CAAY;AAAA,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A,UAAA;AAAA,YACC,SAAA,EAAW,EAAA;AAAA,cACT,mLAAA;AAAA,cACA,GAAA,CAAI;AAAA,aACN;AAAA,YAEC,QAAA,EAAA,GAAA,CAAI;AAAA;AAAA,SACP;AAAA,wBACAC,IAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,WAAA,EACb,QAAA,EAAA;AAAA,0BAAAD,GAAAA,CAAC,SAAA,EAAA,EAAW,QAAA,EAAA,GAAA,CAAI,IAAA,EAAK,CAAA;AAAA,UACpB,GAAA,CAAI,8BACHA,GAAAA,CAAC,mBAAgB,SAAA,EAAU,cAAA,EACxB,QAAA,EAAA,GAAA,CAAI,WAAA,EACP,CAAA,GACE;AAAA,SAAA,EACN;AAAA,OAAA,EACF;AAAA;AAAA,GACF;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport type { ComponentProps, ReactNode } from \"react\"\nimport {\n SidebarInset,\n SidebarProvider,\n} from \"~/ui/primitives/sidebar.js\"\nimport { cn } from \"~/utils/cn.js\"\n\nexport interface AppShellProps\n extends Omit<ComponentProps<typeof SidebarProvider>, \"children\"> {\n children: ReactNode\n}\n\n/**\n * App shell composition root. Wires `SidebarProvider`. Pair with\n * `<Sidebar>` from `@tradalab/lyra/ui` and `<AppShellMain>` for the\n * right-hand pane.\n *\n * @example\n * import { AppShell, AppShellMain, AppShellHeader, AppShellBody, NavGroup, NavItem, Breadcrumbs } from \"@tradalab/lyra/shell\"\n * import { Sidebar, SidebarHeader, SidebarContent, SidebarFooter, SidebarTrigger } from \"@tradalab/lyra/ui\"\n *\n * <AppShell>\n * <Sidebar collapsible=\"icon\">\n * <SidebarHeader>{logo}</SidebarHeader>\n * <SidebarContent>\n * <NavGroup label=\"Primitives\">{...}</NavGroup>\n * </SidebarContent>\n * <SidebarFooter>{user}</SidebarFooter>\n * </Sidebar>\n * <AppShellMain>\n * <AppShellHeader><SidebarTrigger /><Breadcrumbs /></AppShellHeader>\n * <AppShellBody>{children}</AppShellBody>\n * </AppShellMain>\n * </AppShell>\n */\nexport function AppShell({ children, ...rest }: AppShellProps) {\n return <SidebarProvider {...rest}>{children}</SidebarProvider>\n}\n\n/** Right-hand pane container. Alias for `SidebarInset`. */\nexport const AppShellMain = SidebarInset\n\n/** Top bar inside `<AppShellMain>`. Standardizes h-12 + border-b + flex row. */\nexport function AppShellHeader({\n className,\n children,\n ...rest\n}: ComponentProps<\"header\">) {\n return (\n <header\n className={cn(\n \"flex h-12 shrink-0 items-center gap-2 border-b px-3\",\n className,\n )}\n {...rest}\n >\n {children}\n </header>\n )\n}\n\n/** Scroll body inside `<AppShellMain>`. Sibling of `<AppShellHeader>`. */\nexport function AppShellBody({\n className,\n children,\n ...rest\n}: ComponentProps<\"div\">) {\n return (\n <div className={cn(\"flex-1 overflow-auto\", className)} {...rest}>\n {children}\n </div>\n )\n}\n","\"use client\"\n\nimport type { ComponentProps } from \"react\"\nimport { Sidebar } from \"~/ui/primitives/sidebar.js\"\nimport { cn } from \"~/utils/cn.js\"\n\n/**\n * Dual / stacked sidebar wrapper — an icon rail plus one or more content\n * panels rendered side-by-side inside a single `<Sidebar>`. This is the\n * shadcn \"sidebar-07\" pattern.\n *\n * The `*:data-[sidebar=sidebar]:flex-row` trick lays the inner\n * `[data-sidebar=sidebar]` wrappers of the nested {@link SidebarDock} /\n * {@link SidebarPanel} columns out horizontally. `variant`/`collapsible`\n * default to `\"sidebar\"`/`\"icon\"` but can be overridden.\n *\n * @example\n * import { AppShell, AppShellMain, StackedSidebar, SidebarDock, SidebarPanel } from \"@tradalab/lyra/shell\"\n * import { SidebarHeader, SidebarContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton } from \"@tradalab/lyra/ui\"\n *\n * <AppShell>\n * <StackedSidebar>\n * <SidebarDock>\n * <SidebarHeader>{logo}</SidebarHeader>\n * <SidebarContent>{iconButtons}</SidebarContent>\n * </SidebarDock>\n * {tab === \"files\" ? <SidebarPanel>{tree}</SidebarPanel> : null}\n * </StackedSidebar>\n * <AppShellMain>{children}</AppShellMain>\n * </AppShell>\n */\nexport function StackedSidebar({\n className,\n ...rest\n}: ComponentProps<typeof Sidebar>) {\n return (\n <Sidebar\n variant=\"sidebar\"\n collapsible=\"icon\"\n {...rest}\n className={cn(\n \"overflow-hidden *:data-[sidebar=sidebar]:flex-row\",\n className,\n )}\n />\n )\n}\n\n/**\n * Narrow icon-rail column inside a {@link StackedSidebar}. Fixed to the icon\n * width, never collapses on its own (the parent `StackedSidebar` owns the\n * icon-mode toggle).\n *\n * Named `SidebarDock` — not `SidebarRail` — because `SidebarRail` already\n * exists in `@tradalab/lyra/ui` as shadcn's drag-to-resize edge handle.\n */\nexport function SidebarDock({\n className,\n ...rest\n}: ComponentProps<typeof Sidebar>) {\n return (\n <Sidebar\n {...rest}\n collapsible=\"none\"\n className={cn(\n \"w-[calc(var(--sidebar-width-icon)+1px)]! overflow-hidden border-r\",\n className,\n )}\n />\n )\n}\n\n/**\n * Wider content column inside a {@link StackedSidebar} (tree, list, …).\n * Fills remaining width; render conditionally to show/hide per app state.\n */\nexport function SidebarPanel({\n className,\n ...rest\n}: ComponentProps<typeof Sidebar>) {\n return (\n <Sidebar\n {...rest}\n collapsible=\"none\"\n className={cn(\"flex-1 overflow-hidden\", className)}\n />\n )\n}\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport {\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarMenu,\n} from \"~/ui/primitives/sidebar.js\"\n\nexport interface NavGroupProps {\n label?: ReactNode\n children: ReactNode\n}\n\nexport function NavGroup({ label, children }: NavGroupProps) {\n return (\n <SidebarGroup>\n {label != null ? <SidebarGroupLabel>{label}</SidebarGroupLabel> : null}\n <SidebarGroupContent>\n <SidebarMenu>{children}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n )\n}\n","\"use client\"\n\nimport { usePathname } from \"next/navigation\"\n\nexport type MatchMode = \"exact\" | \"prefix\"\n\nexport interface UseActiveRoute {\n pathname: string\n isActive: (href: string, mode?: MatchMode) => boolean\n}\n\n/**\n * App-Router pathname helper. Default `mode` is `\"prefix\"`.\n *\n * Root (`/`) is always exact-matched regardless of `mode` — otherwise the\n * root nav item would light up on every nested page.\n */\nexport function useActiveRoute(): UseActiveRoute {\n const pathname = usePathname() ?? \"/\"\n return {\n pathname,\n isActive: (href, mode = \"prefix\") => {\n if (mode === \"exact\" || href === \"/\") return pathname === href\n return pathname === href || pathname.startsWith(`${href}/`)\n },\n }\n}\n","\"use client\"\n\nimport Link from \"next/link\"\nimport { ArrowUpRight } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport {\n SidebarMenuButton,\n SidebarMenuItem,\n} from \"~/ui/primitives/sidebar.js\"\nimport { useActiveRoute, type MatchMode } from \"./use-active-route.js\"\n\nexport type NavIcon = ReactNode\n\n/** Absolute URLs and mail/tel links leave the app — they can't go through next/link. */\nconst looksExternal = (href: string) =>\n /^([a-z][a-z0-9+.-]*:)?\\/\\//i.test(href) || /^(mailto|tel):/i.test(href)\n\nexport interface NavItemProps {\n href: string\n label: string\n /** Pre-rendered icon element, e.g. `<Globe />`. Element form so the prop is serializable across the RSC boundary. */\n icon?: NavIcon\n /** Sidebar tooltip; visible in collapsed icon mode. */\n tooltip?: string\n /** Default `\"prefix\"` — matches `href` and any nested path. */\n matchMode?: MatchMode\n /**\n * Render a new-tab anchor instead of a `next/link`, and never mark the row\n * active. Defaults to auto-detection: absolute (`https://…`), protocol-\n * relative, `mailto:` and `tel:` hrefs count as external.\n */\n external?: boolean\n}\n\n/** Sidebar nav row. Must be rendered inside a {@link NavGroup}. */\nexport function NavItem({\n href,\n label,\n icon,\n tooltip,\n matchMode = \"prefix\",\n external,\n}: NavItemProps) {\n const { isActive } = useActiveRoute()\n const isExternal = external ?? looksExternal(href)\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n asChild\n isActive={!isExternal && isActive(href, matchMode)}\n tooltip={tooltip}\n >\n {isExternal ? (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {icon}\n <span>{label}</span>\n <ArrowUpRight\n aria-hidden\n className=\"ms-auto size-3.5! shrink-0 opacity-50 group-data-[collapsible=icon]:hidden\"\n />\n </a>\n ) : (\n <Link href={href}>\n {icon}\n <span>{label}</span>\n </Link>\n )}\n </SidebarMenuButton>\n </SidebarMenuItem>\n )\n}\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport { NavGroup } from \"./nav-group.js\"\nimport { NavItem, type NavItemProps } from \"./nav-item.js\"\n\nexport interface NavSectionProps {\n /** Optional group heading. */\n label?: ReactNode\n /** Nav rows — each rendered as a {@link NavItem}. */\n items: NavItemProps[]\n}\n\n/**\n * Config-driven convenience over {@link NavGroup} + {@link NavItem}: pass a\n * data array instead of hand-mapping JSX. For dynamic or conditional rows,\n * compose `NavGroup`/`NavItem` directly.\n *\n * @example\n * const NAV = [\n * { href: \"/files\", label: \"Files\", icon: <Folder /> },\n * { href: \"/trash\", label: \"Trash\", icon: <Trash2 /> },\n * ]\n * <NavSection label=\"Workspace\" items={NAV} />\n */\nexport function NavSection({ label, items }: NavSectionProps) {\n return (\n <NavGroup label={label}>\n {items.map((item) => (\n <NavItem key={item.href} {...item} />\n ))}\n </NavGroup>\n )\n}\n","\"use client\"\n\n// The single renderer for a registered app's mark, shared by the app switcher, the launcher and\n// the Apps admin so one app looks identical everywhere. `icon` is the URL of the image the app\n// ships; anything else, and an image that fails to load, falls back to a name monogram.\n//\n// Lucide icon NAMES are deliberately no longer accepted: resolving any name at runtime meant\n// importing `lucide-react/dynamic`, one `import()` per icon, and Turbopack turned that into ~2000\n// chunk groups on every page of every app (doc/platform/PITFALLS.md).\n\nimport { useEffect, useRef, useState } from \"react\"\n\nimport { cn } from \"~/utils/cn.js\"\n\n// Absolute only: a relative path would resolve against whichever app is showing the launcher.\nexport function isIconUrl(s: string): boolean {\n return /^https?:\\/\\//i.test(s)\n}\n\n// One leading slash, never two. `//cdn.test/x.png` also starts with \"/\" and is a PROTOCOL-RELATIVE\n// URL pointing at another host - the one thing `ownOrigin` exists to exclude. A test that asserted\n// this was passing for the wrong reason until it stubbed the image state, and a mutation run is what\n// said so.\nfunction isOwnPath(s: string): boolean {\n return /^\\/(?!\\/)/.test(s)\n}\n\nexport interface AppGlyphProps {\n /** Absolute http(s) image URL; any other value draws the monogram. */\n icon?: string\n /** App name, drawn as the monogram when there is no image. */\n name?: string\n className?: string\n /**\n * Also accept a ROOT-RELATIVE `icon` (`/icon.svg`).\n *\n * Off by default, and that default is the point: a registry mark belongs to some OTHER app, so a\n * relative path would resolve against whichever app is drawing the launcher and quietly show the\n * wrong mark. app-glyph.test.tsx pins that.\n *\n * On for an app drawing its OWN mark - the sidebar header. There same-origin is the whole\n * intention: the file sits in this app's `public/`, so an absolute URL would add a cross-origin\n * round trip to fetch something already here, and one blip would swap the header for a letter.\n */\n ownOrigin?: boolean\n}\n\n/** An app's mark: its image when `icon` is a URL that loads, else a name monogram. */\nexport function AppGlyph({ icon, name, className, ownOrigin }: AppGlyphProps) {\n const box = \"flex size-9 shrink-0 items-center justify-center rounded-none\"\n const src = icon && (isIconUrl(icon) || (ownOrigin === true && isOwnPath(icon))) ? icon : \"\"\n const [failedSrc, setFailedSrc] = useState(\"\")\n const seen = useRef(src)\n const ref = useRef<HTMLImageElement>(null)\n\n // A new URL deserves its own attempt, including one that failed earlier: the admin form edits\n // this field a keystroke at a time, and a URL typed past a broken prefix would stay dead.\n if (seen.current !== src) {\n seen.current = src\n if (failedSrc) setFailedSrc(\"\")\n }\n\n // An image that fails before hydration never fires onError, so the mount check is what\n // catches a server-rendered tile whose host is down. It reads getAttribute, not `img.src`:\n // that property normalizes the URL (an upper-case scheme comes back lower-cased), and the\n // comparison below would then never match, leaving a broken image on screen.\n useEffect(() => {\n const img = ref.current\n if (img?.complete && img.naturalWidth === 0) setFailedSrc(img.getAttribute(\"src\") ?? \"\")\n }, [src])\n\n if (src && failedSrc !== src) {\n return (\n <img\n ref={ref}\n src={src}\n alt=\"\"\n aria-hidden\n className={cn(box, \"object-contain\", className)}\n onError={() => setFailedSrc(src)}\n />\n )\n }\n\n return (\n <span\n aria-hidden\n className={cn(box, \"bg-primary/10 text-sm font-semibold text-primary\", className)}\n >\n {(name || \"?\").charAt(0).toUpperCase()}\n </span>\n )\n}\n","\"use client\"\n\nimport { Fragment, type ReactNode } from \"react\"\nimport { ChevronsUpDown } from \"lucide-react\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"~/ui/primitives/dropdown-menu.js\"\nimport { AppGlyph } from \"./app-glyph.js\"\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useSidebar,\n} from \"~/ui/primitives/sidebar.js\"\nimport { cn } from \"~/utils/cn.js\"\n\n/** An application shown in the {@link NavBrand} header / switcher. */\nexport interface NavBrandApp {\n /** Display name. */\n name: string\n /**\n * The app's mark, in one of three forms:\n *\n * - a ROOT-RELATIVE path (`\"/icon.svg\"`) - THIS app's own mark. Same origin by construction,\n * which is why the header uses it: the file is already in this app's `public/`, so an absolute\n * URL would add a cross-origin round trip to fetch something that is right here.\n * - an ABSOLUTE http(s) URL - another app's mark, as the registry stores it. Drawn by\n * {@link AppGlyph}, so a host that is down degrades to a name monogram rather than a broken\n * image.\n * - a pre-rendered element, e.g. `<Boxes />`. Element form (not a component reference) so the\n * prop stays serializable across the RSC boundary - same convention as {@link NavItem}'s\n * `icon`. Drawn on the brand-colour plate, inheriting its foreground.\n *\n * Either string form gets NO plate: the generated marks are opaque squircles, and a rounded mark\n * on a square colour tile shows four corners of the wrong colour behind it. Nor does the monogram\n * such a mark degrades to, which brings its own tint.\n */\n icon: ReactNode\n /** Navigation target. Usually an absolute cross-app URL (full navigation). */\n href: string\n /** Optional secondary line under the name (tagline / domain). */\n description?: string\n}\n\n/** A labeled section of apps in the {@link NavBrand} switcher. */\nexport interface NavBrandGroup {\n /** Stable React key. */\n key: string\n /** Section heading. Omit for an unlabeled section (e.g. ungrouped apps). */\n label?: string\n apps: NavBrandApp[]\n}\n\nexport interface NavBrandProps {\n /** The current app, rendered in the sidebar header. */\n app: NavBrandApp\n /**\n * Other apps to switch to (flat, single list). When omitted or empty - and no\n * `groups` - the header renders as a plain link to `app.href`.\n */\n apps?: NavBrandApp[]\n /**\n * Grouped apps - rendered as labeled sections separated by dividers. Takes\n * precedence over `apps`. The caller owns the grouping + ordering.\n */\n groups?: NavBrandGroup[]\n /** Heading above a flat `apps` list. Default `\"Applications\"`. Ignored for `groups`. */\n appsLabel?: string\n /** Extra menu content appended below the app list (e.g. an \"Add app\" row). */\n children?: ReactNode\n}\n\n/** Default English heading for the switcher's app list - override for i18n. */\nexport const defaultNavBrandAppsLabel = \"Applications\"\n\n/**\n * One renderer for every mark this component draws, so the header and the switcher rows cannot\n * drift apart. They did: the rows went through {@link AppGlyph} (image, monogram on failure) while\n * the header rendered its element raw, so opening the switcher showed the current app as a line\n * icon among everyone else's brand images.\n *\n * `own` says whose mark it is, and only that decides whether a root-relative path is honoured.\n */\nfunction Mark({ app, own, className }: { app: NavBrandApp; own?: boolean; className?: string }) {\n if (typeof app.icon !== \"string\") return <>{app.icon}</>\n return <AppGlyph icon={app.icon} name={app.name} className={className} ownOrigin={own} />\n}\n\n/**\n * Whether this mark needs chrome around it - the header's colour plate, a row's hairline box.\n *\n * Decided from the DATA, not from a `:has(img)` test. A string mark arrives with its own surface\n * either way: {@link AppGlyph} puts nothing behind an image, and `bg-primary/10` behind the monogram\n * it degrades to. Only the image branch contains an `<img>`, so a CSS test got that one right and\n * left the chrome around the fallback - in the header that meant the brand plate standing under a\n * letter painted in `text-primary`, a token for another surface, over two stacked backgrounds.\n * `typeof` answers before either branch renders.\n */\nfunction needsChrome(app: NavBrandApp): boolean {\n return typeof app.icon !== \"string\"\n}\n\n/** Icon tile + name/description shown inside the header button. */\nfunction BrandContent({ app }: { app: NavBrandApp }) {\n return (\n <>\n <div\n className={cn(\n \"flex aspect-square size-8 items-center justify-center rounded-none\",\n needsChrome(app) && \"bg-sidebar-primary text-sidebar-primary-foreground [&_svg]:size-4\",\n )}\n >\n <Mark app={app} own className=\"size-full text-xs\" />\n </div>\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{app.name}</span>\n {app.description ? (\n <span className=\"text-muted-foreground truncate text-xs\">\n {app.description}\n </span>\n ) : null}\n </div>\n </>\n )\n}\n\n/** A single switch-to-app row (full-navigation link). */\nfunction AppRow({ app }: { app: NavBrandApp }) {\n return (\n <DropdownMenuItem asChild className=\"gap-2 p-2\">\n <a href={app.href}>\n <div\n className={cn(\n \"flex size-6 items-center justify-center rounded-none\",\n needsChrome(app) && \"border [&_svg]:size-3.5\",\n )}\n >\n <Mark app={app} className=\"size-full text-[10px]\" />\n </div>\n <span className=\"truncate\">{app.name}</span>\n </a>\n </DropdownMenuItem>\n )\n}\n\n/**\n * Sidebar-header brand block with an optional app switcher - the standardized\n * `SidebarHeader` content for app shells (pairs with {@link NavUser} in the\n * footer). Presentational: the app owns the config, icons, and labels.\n *\n * With `groups` (or `apps`), the header is a dropdown trigger listing the other\n * apps as links; `groups` renders labeled sections, `apps` a single flat list.\n * Without either, the header is a plain link to `app.href`. Cross-app links use\n * a plain `<a>` so switching does a full navigation.\n *\n * Must render inside an `AppShell`/`SidebarProvider`, and below a\n * `TooltipProvider` (the collapsed-mode tooltip needs one).\n *\n * @example\n * <NavBrand\n * app={{ name: \"Admin\", description: \"Platform console\", icon: <ShieldCheck />, href: \"/\" }}\n * groups={[\n * { key: \"workspace\", label: \"Workspace\", apps: [{ name: \"Drive\", icon: <HardDrive />, href: \"https://drive.tradalab.com\" }] },\n * ]}\n * />\n */\nexport function NavBrand({\n app,\n apps,\n groups,\n appsLabel = defaultNavBrandAppsLabel,\n children,\n}: NavBrandProps) {\n const { isMobile } = useSidebar()\n const groupTotal = groups?.reduce((n, g) => n + g.apps.length, 0) ?? 0\n const hasSwitcher = (apps?.length ?? 0) > 0 || groupTotal > 0 || children != null\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n {hasSwitcher ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n tooltip={app.name}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n <BrandContent app={app} />\n <ChevronsUpDown className=\"ml-auto size-4\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-none\"\n align=\"start\"\n side={isMobile ? \"bottom\" : \"right\"}\n sideOffset={4}\n >\n {groupTotal > 0 ? (\n groups!.map((g, i) => (\n <Fragment key={g.key}>\n {i > 0 ? <DropdownMenuSeparator /> : null}\n {g.label ? (\n <DropdownMenuLabel className=\"text-muted-foreground text-xs\">\n {g.label}\n </DropdownMenuLabel>\n ) : null}\n {g.apps.map((item) => (\n <AppRow key={item.href} app={item} />\n ))}\n </Fragment>\n ))\n ) : (\n <>\n <DropdownMenuLabel className=\"text-muted-foreground text-xs\">\n {appsLabel}\n </DropdownMenuLabel>\n {apps?.map((item) => (\n <AppRow key={item.href} app={item} />\n ))}\n </>\n )}\n {children ? (\n <>\n <DropdownMenuSeparator />\n {children}\n </>\n ) : null}\n </DropdownMenuContent>\n </DropdownMenu>\n ) : (\n <SidebarMenuButton size=\"lg\" asChild tooltip={app.name}>\n <a href={app.href}>\n <BrandContent app={app} />\n </a>\n </SidebarMenuButton>\n )}\n </SidebarMenuItem>\n </SidebarMenu>\n )\n}\n","\"use client\"\n\nimport {\n NavBrand,\n type NavBrandApp,\n type NavBrandGroup,\n} from \"./nav-brand.js\"\n\n/**\n * A registry app in the {@link AppSwitcher} - the shape a launcher endpoint\n * returns (icon as a URL string; the glyph is rendered internally). Structurally\n * matches nekit's `LauncherApp`, so `groupApps(...)` output feeds straight in.\n */\nexport interface AppSwitcherApp {\n name: string\n description?: string\n /** Navigation target (usually an absolute cross-app URL). */\n url: string\n /** Image URL; anything else renders a monogram. */\n icon: string\n}\n\n/** A grouped, ordered section of apps (label omitted for the ungrouped bucket). */\nexport interface AppSwitcherSection {\n key: string\n label?: string\n apps: AppSwitcherApp[]\n}\n\nexport interface AppSwitcherProps {\n /** The current app, shown in the sidebar header. */\n app: NavBrandApp\n /** Grouped registry apps - e.g. nekit `groupApps(data.apps, data.groups)`. */\n sections: AppSwitcherSection[]\n /** Heading for the flat fallback list. */\n appsLabel?: string\n /** Shown when `sections` is empty (registry loading / unavailable) so the\n * switcher never collapses to a plain link. */\n fallback?: NavBrandApp[]\n}\n\n/**\n * The cross-app switcher: a batteries-included wrapper over {@link NavBrand} that\n * takes the launcher registry (grouped `sections` of `{ icon, url, … }`)\n * and renders it - labeled group sections, each app's mark drawn by `NavBrand`.\n * Consumers just fetch + group (nekit) and pass config. Empty registry → the `fallback` flat list.\n *\n * @example\n * const sections = groupApps(data.apps, data.groups) // @tradalab/nekit/data/launcher\n * <AppSwitcher app={{ name: \"Admin\", icon: <ShieldCheck/>, href: \"/\" }} sections={sections} />\n */\nexport function AppSwitcher({\n app,\n sections,\n appsLabel,\n fallback,\n}: AppSwitcherProps) {\n const groups: NavBrandGroup[] = sections\n .filter((s) => s.apps.length > 0)\n .map((s) => ({\n key: s.key,\n label: s.label,\n apps: s.apps.map((a) => ({\n name: a.name,\n description: a.description,\n href: a.url,\n // The registry URL, passed through. NavBrand draws every mark it shows - header and rows\n // alike - so wrapping it in AppGlyph here as well is the second renderer that let the two\n // drift apart in the first place.\n icon: a.icon,\n })),\n }))\n\n return (\n <NavBrand\n app={app}\n groups={groups.length ? groups : undefined}\n apps={groups.length ? undefined : fallback}\n appsLabel={appsLabel}\n />\n )\n}\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport {\n ChevronsUpDown,\n CircleUser,\n LogIn,\n LogOut,\n Monitor,\n Moon,\n Palette,\n Sun,\n UserRoundCog,\n} from \"lucide-react\"\nimport { useTheme } from \"next-themes\"\nimport { Avatar, AvatarFallback, AvatarImage } from \"~/ui/primitives/avatar.js\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"~/ui/primitives/dropdown-menu.js\"\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useSidebar,\n} from \"~/ui/primitives/sidebar.js\"\nimport {\n defaultAccountMenuLabels,\n initialsOf,\n type AccountMenuLabels,\n type AccountMenuUser,\n} from \"~/ui/account-menu.js\"\n\nexport interface NavUserThemeLabels {\n theme: string\n light: string\n dark: string\n system: string\n}\n\n/** Default English theme-submenu labels — spread + override for i18n. */\nexport const defaultNavUserThemeLabels: NavUserThemeLabels = {\n theme: \"Theme\",\n light: \"Light\",\n dark: \"Dark\",\n system: \"System\",\n}\n\nexport interface NavUserProps {\n /**\n * Signed-in user. When `null`/`undefined`, renders a guest menu (icon +\n * theme + Sign in) if `onSignIn` is set, otherwise renders nothing.\n */\n user?: AccountMenuUser | null\n /** Account-action labels — reuses lyra's {@link AccountMenuLabels}. */\n labels?: Partial<AccountMenuLabels>\n /** Switch-account handler (signed-in only). Item hidden if omitted. */\n onSwitchAccount?: () => void\n /** Sign-out handler (signed-in only). Item hidden if omitted. */\n onSignOut?: () => void\n /**\n * Sign-in handler (guest only). When set, a null `user` renders the guest\n * menu with a Sign in action instead of rendering nothing.\n */\n onSignIn?: () => void\n /** Render the light/dark/system theme submenu. Default `true`. */\n showTheme?: boolean\n /** Theme-submenu labels. */\n themeLabels?: Partial<NavUserThemeLabels>\n /** Extra menu content inserted below the theme submenu. */\n children?: ReactNode\n}\n\nconst THEMES = [\n { value: \"light\", key: \"light\", icon: Sun },\n { value: \"dark\", key: \"dark\", icon: Moon },\n { value: \"system\", key: \"system\", icon: Monitor },\n] as const\n\n/**\n * Sidebar-footer account menu — the standardized NavUser for app shells.\n * Avatar trigger (size `lg`) + name/email opening a dropdown with an optional\n * theme switcher and switch-account / sign-out actions. Auth flows stay in the\n * app (callbacks); labels are props for i18n.\n *\n * Differs from {@link AccountMenu} in `@tradalab/lyra/ui`: that one is a\n * generic header dropdown; this is styled for the collapsible sidebar footer\n * and follows `useSidebar()` for mobile placement.\n *\n * Must render inside an `AppShell`/SidebarProvider, and below a\n * `TooltipProvider` (the avatar button's collapsed-mode tooltip requires one —\n * app root providers normally mount it). The theme submenu needs a\n * `next-themes` provider mounted (it no-ops without one); pass\n * `showTheme={false}` for apps with a fixed theme.\n *\n * @example\n * import { NavUser } from \"@tradalab/lyra/shell\"\n * import { SidebarFooter } from \"@tradalab/lyra/ui\"\n *\n * <SidebarFooter>\n * <NavUser\n * user={session.user}\n * onSwitchAccount={() => signIn(\"zitadel\", { redirectTo: \"/\" }, { prompt: \"select_account\" })}\n * onSignOut={() => signOut({ redirectTo: \"/\" })}\n * />\n * </SidebarFooter>\n */\nexport function NavUser({\n user,\n labels,\n onSwitchAccount,\n onSignOut,\n onSignIn,\n showTheme = true,\n themeLabels,\n children,\n}: NavUserProps) {\n const { isMobile } = useSidebar()\n const { theme, setTheme } = useTheme()\n const l = { ...defaultAccountMenuLabels, ...labels }\n const t = { ...defaultNavUserThemeLabels, ...themeLabels }\n\n // Guests render nothing unless a sign-in handler opts them into a guest menu.\n if (!user && !onSignIn) return null\n\n const name = user ? (user.name ?? user.email ?? l.account) : l.guest\n const email = user?.email ?? \"\"\n\n const avatar = (\n <Avatar className=\"size-8 rounded-none after:rounded-none\">\n {user?.image ? (\n <AvatarImage className=\"rounded-none\" src={user.image} alt={name} />\n ) : null}\n <AvatarFallback className=\"rounded-none\">\n {user ? initialsOf(name) : <CircleUser className=\"size-4\" />}\n </AvatarFallback>\n </Avatar>\n )\n\n const themeSubmenu = showTheme ? (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>\n <Palette className=\"mr-2 size-4\" />\n {t.theme}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup value={theme ?? \"system\"} onValueChange={setTheme}>\n {THEMES.map(({ value, key, icon: Icon }) => (\n <DropdownMenuRadioItem key={value} value={value}>\n <Icon className=\"mr-2 size-4\" />\n {t[key]}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n </>\n ) : null\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n tooltip={name}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n {avatar}\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-medium\">{name}</span>\n {email ? (\n <span className=\"text-muted-foreground truncate text-xs\">\n {email}\n </span>\n ) : null}\n </div>\n <ChevronsUpDown className=\"ml-auto size-4\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-(--radix-dropdown-menu-trigger-width) min-w-56\"\n side={isMobile ? \"bottom\" : \"right\"}\n align=\"end\"\n sideOffset={4}\n >\n <DropdownMenuLabel className=\"flex items-center gap-2\">\n {avatar}\n <div className=\"grid flex-1 text-left leading-tight\">\n <span className=\"truncate text-sm font-medium\">{name}</span>\n {email ? (\n <span className=\"text-muted-foreground truncate text-xs font-normal\">\n {email}\n </span>\n ) : null}\n </div>\n </DropdownMenuLabel>\n\n {themeSubmenu}\n\n {children ? (\n <>\n <DropdownMenuSeparator />\n {children}\n </>\n ) : null}\n\n {user ? (\n <>\n {onSwitchAccount || onSignOut ? <DropdownMenuSeparator /> : null}\n {onSwitchAccount ? (\n <DropdownMenuItem onSelect={onSwitchAccount}>\n <UserRoundCog className=\"mr-2 size-4\" />\n {l.switchAccount}\n </DropdownMenuItem>\n ) : null}\n {onSignOut ? (\n <DropdownMenuItem variant=\"destructive\" onSelect={onSignOut}>\n <LogOut className=\"mr-2 size-4\" />\n {l.signOut}\n </DropdownMenuItem>\n ) : null}\n </>\n ) : (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuItem onSelect={onSignIn}>\n <LogIn className=\"mr-2 size-4\" />\n {l.signIn}\n </DropdownMenuItem>\n </>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n </SidebarMenu>\n )\n}\n","\"use client\"\n\nimport { useEffect, useRef, type ReactNode, type WheelEvent } from \"react\"\nimport { ChevronDown, ListX, Pin, PinOff, Trash2, X } from \"lucide-react\"\nimport { Button } from \"~/ui/primitives/button.js\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"~/ui/primitives/dropdown-menu.js\"\nimport { ScrollArea, ScrollBar } from \"~/ui/primitives/scroll-area.js\"\nimport {\n ContextMenu,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuTrigger,\n} from \"~/ui/primitives/context-menu.js\"\nimport { cn } from \"~/utils/cn.js\"\n\nexport interface TabItem {\n id: string\n title: string\n /** Secondary line under the title (e.g. connection/db, file path). */\n subtitle?: ReactNode\n /** Leading icon element — the app maps its own tab type → icon. */\n icon?: ReactNode\n pinned?: boolean\n}\n\nexport interface TabBarLabels {\n close: string\n pinTab: string\n unpinTab: string\n closeOthers: string\n closeAll: string\n}\n\n/** Default English labels — spread + override for i18n. */\nexport const defaultTabBarLabels: TabBarLabels = {\n close: \"Close\",\n pinTab: \"Pin tab\",\n unpinTab: \"Unpin tab\",\n closeOthers: \"Close others\",\n closeAll: \"Close all\",\n}\n\nexport interface TabBarProps {\n tabs: TabItem[]\n activeId: string | null\n onSelect: (id: string) => void\n onClose: (id: string) => void\n /** Pin row in the context menu is hidden when omitted. */\n onTogglePin?: (id: string) => void\n /** \"Close others\" row is hidden when omitted. */\n onCloseOthers?: (id: string) => void\n /** \"Close all\" row is hidden when omitted. */\n onCloseAll?: () => void\n labels?: Partial<TabBarLabels>\n}\n\n/**\n * Horizontal tab strip for the content area of stacked-sidebar apps\n * (redishub, loom). Presentational + store-agnostic: the app owns tab state\n * and passes `tabs` + callbacks; `icon`/`subtitle` are per-tab so apps map\n * their own tab types, and labels are props for i18n. Renders nothing when\n * `tabs` is empty.\n *\n * Sizes rows from the `--tab-height` CSS var — set it in your globals.\n *\n * @example\n * const s = useTabStore()\n * <TabBar\n * tabs={s.tabs.map(t => ({ id: t.id, title: t.title, pinned: t.pinned, icon: <Icon t={t.type}/>, subtitle: fmt(t) }))}\n * activeId={s.activeTabId}\n * onSelect={s.setActiveTabId}\n * onClose={s.removeTab}\n * onTogglePin={s.togglePin}\n * onCloseOthers={s.closeOthers}\n * onCloseAll={s.closeAll}\n * />\n */\nexport function TabBar({\n tabs,\n activeId,\n onSelect,\n onClose,\n onTogglePin,\n onCloseOthers,\n onCloseAll,\n labels,\n}: TabBarProps) {\n const l = { ...defaultTabBarLabels, ...labels }\n const activeTabRef = useRef<HTMLDivElement>(null)\n\n // Scroll the active tab into view when it changes.\n useEffect(() => {\n if (activeId && activeTabRef.current) {\n activeTabRef.current.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"nearest\",\n })\n }\n }, [activeId])\n\n // Map vertical wheel scroll to horizontal scroll over the tab strip.\n const handleWheel = (e: WheelEvent<HTMLDivElement>) => {\n if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) {\n const viewport = e.currentTarget.querySelector(\n '[data-slot=\"scroll-area-viewport\"]',\n )\n if (viewport) viewport.scrollLeft += e.deltaY * 0.5\n }\n }\n\n if (tabs.length === 0) return null\n\n const hasContextActions = Boolean(onTogglePin || onCloseOthers || onCloseAll)\n\n return (\n <div\n className=\"group/tabbar flex w-full shrink-0 items-center overflow-hidden border-b bg-muted/30\"\n style={{ height: \"var(--tab-height)\" }}\n >\n <ScrollArea\n type=\"hover\"\n className=\"min-w-0 flex-1 overflow-hidden [&_[data-orientation=vertical]]:hidden\"\n onWheel={handleWheel}\n >\n <div\n className=\"flex w-max items-center gap-0\"\n style={{ height: \"var(--tab-height)\" }}\n >\n {tabs.map((tab) => {\n const isActive = activeId === tab.id\n return (\n <ContextMenu key={tab.id}>\n <ContextMenuTrigger asChild>\n <div\n ref={isActive ? activeTabRef : null}\n onClick={() => onSelect(tab.id)}\n title={tab.title}\n className={cn(\n \"group relative flex min-w-[140px] max-w-[240px] shrink-0 cursor-pointer select-none items-center gap-2 border-r px-3 transition-colors\",\n isActive\n ? \"border-t-2 border-t-primary bg-background\"\n : \"border-t-2 border-t-transparent bg-transparent text-muted-foreground hover:bg-muted/50\",\n tab.pinned && \"min-w-[100px] bg-primary/5\",\n )}\n style={{ height: \"var(--tab-height)\" }}\n >\n {tab.icon ? (\n <div className=\"relative shrink-0\">\n <span\n className={cn(\n \"flex [&_svg]:size-3.5\",\n isActive && \"text-primary\",\n )}\n >\n {tab.icon}\n </span>\n {tab.pinned ? (\n <div className=\"absolute -right-1.5 -top-1.5 rounded-full bg-background p-0.5 shadow-sm\">\n <Pin className=\"size-2 fill-primary text-primary\" />\n </div>\n ) : null}\n </div>\n ) : null}\n <div className=\"flex min-w-0 flex-1 flex-col items-start justify-center overflow-hidden py-1\">\n <span\n className={cn(\n \"w-full truncate text-xs leading-tight\",\n isActive && \"font-medium text-foreground\",\n )}\n >\n {tab.title}\n </span>\n {tab.subtitle ? (\n <span className=\"mt-0.5 w-full truncate text-[10px] leading-none text-muted-foreground/70\">\n {tab.subtitle}\n </span>\n ) : null}\n </div>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n title={l.close}\n className={cn(\n \"size-5 shrink-0 rounded-md opacity-0 transition-opacity hover:bg-muted-foreground/20 group-hover:opacity-100\",\n isActive && \"opacity-100\",\n )}\n onClick={(e) => {\n e.stopPropagation()\n onClose(tab.id)\n }}\n >\n <X className=\"size-3\" />\n </Button>\n {isActive ? (\n <div className=\"absolute bottom-0 left-0 right-0 z-10 h-[2px] bg-background\" />\n ) : null}\n </div>\n </ContextMenuTrigger>\n {hasContextActions ? (\n <ContextMenuContent className=\"w-48\">\n {onTogglePin ? (\n <>\n <ContextMenuItem onClick={() => onTogglePin(tab.id)}>\n {tab.pinned ? (\n <>\n <PinOff className=\"mr-2 size-4\" />\n <span>{l.unpinTab}</span>\n </>\n ) : (\n <>\n <Pin className=\"mr-2 size-4\" />\n <span>{l.pinTab}</span>\n </>\n )}\n </ContextMenuItem>\n <ContextMenuSeparator />\n </>\n ) : null}\n <ContextMenuItem onClick={() => onClose(tab.id)}>\n <X className=\"mr-2 size-4\" />\n <span>{l.close}</span>\n </ContextMenuItem>\n {onCloseOthers ? (\n <ContextMenuItem onClick={() => onCloseOthers(tab.id)}>\n <ListX className=\"mr-2 size-4\" />\n <span>{l.closeOthers}</span>\n </ContextMenuItem>\n ) : null}\n {onCloseAll ? (\n <ContextMenuItem onClick={() => onCloseAll()}>\n <Trash2 className=\"mr-2 size-4\" />\n <span>{l.closeAll}</span>\n </ContextMenuItem>\n ) : null}\n </ContextMenuContent>\n ) : null}\n </ContextMenu>\n )\n })}\n </div>\n <ScrollBar orientation=\"horizontal\" className=\"z-20 h-1.5 hover:h-2\" />\n </ScrollArea>\n\n <div\n className=\"flex shrink-0 items-center border-l bg-muted/30 px-1\"\n style={{ height: \"var(--tab-height)\" }}\n >\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" className=\"size-8 shrink-0 rounded-sm\">\n <ChevronDown className=\"size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"end\"\n className=\"max-h-[400px] w-[260px] overflow-y-auto\"\n >\n {tabs.map((tab) => (\n <DropdownMenuItem\n key={tab.id}\n onClick={() => onSelect(tab.id)}\n title={tab.title}\n className={cn(\n \"cursor-pointer gap-2 py-2\",\n activeId === tab.id && \"bg-accent\",\n )}\n >\n {tab.icon ? (\n <div className=\"relative shrink-0\">\n <span className=\"flex text-muted-foreground [&_svg]:size-4\">\n {tab.icon}\n </span>\n {tab.pinned ? (\n <Pin className=\"absolute -right-1 -top-1 size-2 fill-primary text-primary\" />\n ) : null}\n </div>\n ) : null}\n <div className=\"flex flex-1 flex-col items-start overflow-hidden leading-tight\">\n <span className=\"w-full flex-1 truncate text-sm\">{tab.title}</span>\n {tab.subtitle ? (\n <span className=\"w-full truncate text-[10px] text-muted-foreground\">\n {tab.subtitle}\n </span>\n ) : null}\n </div>\n <X\n className=\"size-4 shrink-0 rounded-sm p-0.5 hover:bg-red-50 hover:text-red-500\"\n onClick={(e) => {\n e.stopPropagation()\n onClose(tab.id)\n }}\n />\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n )\n}\n","\"use client\"\n\nimport { Fragment, type ComponentProps, type ReactNode } from \"react\"\nimport Link from \"next/link\"\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"~/ui/primitives/breadcrumb.js\"\nimport { useActiveRoute } from \"./use-active-route.js\"\n\nexport interface LeadingCrumb {\n /** Where the crumb links. Omit to render it as plain text. */\n href?: string\n label: ReactNode\n /** Hide on small screens, as app-name crumbs usually should. Default `true`. */\n hideOnMobile?: boolean\n}\n\nexport interface BreadcrumbsProps extends ComponentProps<typeof Breadcrumb> {\n /** Separator content. Falls back to shadcn's chevron when omitted. */\n separator?: ReactNode\n /** Segment-id → display-label map. Unmapped segments render raw. */\n labels?: Record<string, string>\n /**\n * Crumb rendered before the path segments — typically the app name linking\n * home. With it set the trail also renders on the root route (as the current\n * page); without it the root route renders nothing.\n */\n leading?: LeadingCrumb\n}\n\n/** Pathname-derived breadcrumbs. Renders nothing on the root route unless `leading` is set. */\nexport function Breadcrumbs({ separator, labels, leading, ...rest }: BreadcrumbsProps) {\n const { pathname } = useActiveRoute()\n const segments = pathname.split(\"/\").filter(Boolean)\n if (segments.length === 0 && !leading) return null\n const last = segments.length - 1\n const hideLeading = leading?.hideOnMobile ?? true\n return (\n <Breadcrumb {...rest}>\n <BreadcrumbList>\n {leading ? (\n <BreadcrumbItem className={hideLeading ? \"hidden md:block\" : undefined}>\n {/* On the root route the leading crumb IS the current page. */}\n {segments.length === 0 ? (\n <BreadcrumbPage>{leading.label}</BreadcrumbPage>\n ) : leading.href ? (\n <BreadcrumbLink asChild>\n <Link href={leading.href}>{leading.label}</Link>\n </BreadcrumbLink>\n ) : (\n leading.label\n )}\n </BreadcrumbItem>\n ) : null}\n {segments.map((seg, i) => {\n const href = \"/\" + segments.slice(0, i + 1).join(\"/\")\n const label = labels?.[seg] ?? seg\n return (\n <Fragment key={href}>\n {i > 0 || leading ? (\n <BreadcrumbSeparator className={i === 0 && hideLeading && leading ? \"hidden md:block\" : undefined}>\n {separator}\n </BreadcrumbSeparator>\n ) : null}\n <BreadcrumbItem>\n {i === last ? (\n <BreadcrumbPage>{label}</BreadcrumbPage>\n ) : (\n <BreadcrumbLink asChild>\n <Link href={href}>{label}</Link>\n </BreadcrumbLink>\n )}\n </BreadcrumbItem>\n </Fragment>\n )\n })}\n </BreadcrumbList>\n </Breadcrumb>\n )\n}\n","import type { ReactNode } from \"react\"\nimport { Search } from \"lucide-react\"\n\nimport { cn } from \"~/utils/cn.js\"\nimport {\n Card,\n CardDescription,\n CardTitle,\n} from \"~/ui/primitives/card.js\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from \"~/ui/primitives/input-group.js\"\n\n/** One application in the {@link AppGrid} — rendered as an {@link AppTile}. */\nexport interface AppGridItem {\n /** Stable React list key. */\n key: string\n /** Display name. */\n name: string\n /** Optional tagline shown under the name. */\n description?: string\n /** Navigation target (usually an absolute cross-app URL). */\n href: string\n /**\n * Pre-rendered icon element (RSC-serializable), e.g. `<ToolCase />`. Sized by\n * the tile (`[&_svg]:size-7`) — same convention as {@link NavBrandApp}'s icon.\n */\n icon: ReactNode\n /**\n * Tailwind class string tinting the icon tile — `text-…` (colors the icon via\n * currentColor) + `bg-…` (tile background). Pass full class strings, not\n * interpolated fragments, so the JIT keeps them.\n */\n accent?: string\n /** Opens on a different origin (adds `target=\"_blank\"` + `rel`). */\n external?: boolean\n}\n\n/** A titled section of apps for {@link AppGrid}'s grouped mode. */\nexport interface AppGridGroup {\n /** Stable React list key. */\n key: string\n /** Section heading. */\n label: string\n /** Optional sub-heading under the label. */\n description?: string\n /** Apps in this group — already filtered by the caller. */\n apps: AppGridItem[]\n}\n\nexport interface AppGridProps {\n /** Flat mode: apps to render (already filtered). Ignored when `groups` is set. */\n apps?: AppGridItem[]\n /**\n * Grouped mode: titled sections (already filtered). When provided, renders a\n * heading + tile grid per group; empty groups are dropped.\n */\n groups?: AppGridGroup[]\n /** Controlled search value. Pass together with `onQueryChange` to show the search box. */\n query?: string\n onQueryChange?: (query: string) => void\n /** Search input placeholder. */\n searchPlaceholder?: string\n /** Autofocus the search box on mount. Default `false`. */\n autoFocusSearch?: boolean\n /** Message shown when there are no apps. */\n emptyLabel?: string\n className?: string\n}\n\n/** Default English labels — override for i18n. */\nexport const defaultAppGridLabels = {\n searchPlaceholder: \"Search apps…\",\n empty: \"No apps found.\",\n}\n\n/**\n * A responsive grid of application tiles with an optional search box — the \"app\n * grid\" / launcher surface (a portal home / \"all apps\" page). Presentational:\n * the app owns the registry, i18n, icons, and the filter — pass the already-\n * filtered `apps` plus a controlled `query`. Same app/lyra split as\n * {@link NavBrand} and {@link TabBar}.\n *\n * @example\n * const [q, setQ] = useState(\"\")\n * const filtered = APPS.filter(a => match(a, q))\n * <AppGrid\n * apps={filtered.map(a => ({\n * key: a.slug, name: t(a.slug), description: t(`${a.slug}.desc`),\n * href: a.href, icon: <a.Icon />, accent: a.accent, external: true,\n * }))}\n * query={q} onQueryChange={setQ}\n * searchPlaceholder={t(\"search\")} emptyLabel={t(\"empty\")}\n * />\n */\nexport function AppGrid({\n apps,\n groups,\n query,\n onQueryChange,\n searchPlaceholder = defaultAppGridLabels.searchPlaceholder,\n autoFocusSearch = false,\n emptyLabel = defaultAppGridLabels.empty,\n className,\n}: AppGridProps) {\n const grouped = groups != null\n const sections = grouped ? groups.filter((g) => g.apps.length > 0) : []\n const flat = apps ?? []\n const isEmpty = grouped ? sections.length === 0 : flat.length === 0\n\n return (\n <div className={cn(\"space-y-8\", className)}>\n {onQueryChange ? (\n <InputGroup className=\"mx-auto h-10 max-w-md\">\n <InputGroupAddon>\n <Search />\n </InputGroupAddon>\n <InputGroupInput\n type=\"search\"\n value={query ?? \"\"}\n onChange={(e) => onQueryChange(e.target.value)}\n placeholder={searchPlaceholder}\n aria-label={searchPlaceholder}\n autoFocus={autoFocusSearch}\n />\n </InputGroup>\n ) : null}\n\n {isEmpty ? (\n <p className=\"text-muted-foreground py-16 text-center text-sm\">\n {emptyLabel}\n </p>\n ) : grouped ? (\n <div className=\"space-y-10\">\n {sections.map((g) => (\n <section key={g.key} className=\"space-y-4\">\n <div className=\"space-y-1\">\n <h2 className=\"text-sm font-semibold tracking-tight\">{g.label}</h2>\n {g.description ? (\n <p className=\"text-muted-foreground text-xs\">{g.description}</p>\n ) : null}\n </div>\n <AppTileGrid apps={g.apps} />\n </section>\n ))}\n </div>\n ) : (\n <AppTileGrid apps={flat} />\n )}\n </div>\n )\n}\n\n/** The responsive tile grid shared by {@link AppGrid}'s flat and grouped modes. */\nfunction AppTileGrid({ apps }: { apps: AppGridItem[] }) {\n return (\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">\n {apps.map((app) => (\n <AppTile key={app.key} app={app} />\n ))}\n </div>\n )\n}\n\n/**\n * A single application tile: the icon in a tinted rounded chip above the name +\n * description. Exported for callers that render their own grid.\n */\nexport function AppTile({ app }: { app: AppGridItem }) {\n return (\n <a\n href={app.href}\n target={app.external ? \"_blank\" : undefined}\n rel={app.external ? \"noreferrer\" : undefined}\n className=\"focus-visible:ring-ring group rounded-none outline-none focus-visible:ring-2\"\n >\n <Card className=\"h-full items-center gap-4 px-6 py-8 text-center transition-all duration-200 group-hover:-translate-y-0.5 group-hover:shadow-md group-hover:ring-foreground/30\">\n {/* Tinted icon tile (sharp — matches lyra's rounded-none aesthetic);\n `accent` carries the text-… (icon, via currentColor) + bg-… tint. */}\n {/* An app image arrives with its own plate, so the hairline ring would frame it twice. */}\n <div\n className={cn(\n \"flex size-14 items-center justify-center rounded-none ring-1 ring-foreground/5 ring-inset transition-transform duration-200 group-hover:scale-105 has-[img]:ring-0 [&_svg]:size-7\",\n app.accent,\n )}\n >\n {app.icon}\n </div>\n <div className=\"space-y-1\">\n <CardTitle>{app.name}</CardTitle>\n {app.description ? (\n <CardDescription className=\"line-clamp-2\">\n {app.description}\n </CardDescription>\n ) : null}\n </div>\n </Card>\n </a>\n )\n}\n"]}
|
package/package.json
CHANGED