@petrarca/sonnet-shell 0.1.6 → 0.3.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/index.d.ts +183 -32
- package/dist/index.js +523 -211
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { RouteObject } from 'react-router-dom';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import React__default, { ReactNode } from 'react';
|
|
4
|
+
import { RouteObject } from 'react-router-dom';
|
|
5
5
|
import { LucideIcon } from 'lucide-react';
|
|
6
6
|
|
|
7
7
|
interface SidePaneOptions {
|
|
@@ -50,7 +50,7 @@ declare function useSidePaneState(): SidePaneState;
|
|
|
50
50
|
* Shell type definitions.
|
|
51
51
|
*
|
|
52
52
|
* These types define the contract between the shell and modules.
|
|
53
|
-
* Modules implement
|
|
53
|
+
* Modules implement ShellModule; the shell consumes it.
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
interface NavLink {
|
|
@@ -62,17 +62,21 @@ interface NavLink {
|
|
|
62
62
|
id?: string;
|
|
63
63
|
label: string;
|
|
64
64
|
path: string;
|
|
65
|
+
/** Optional trailing badge (count or status text) for sidebar display. */
|
|
66
|
+
badge?: string | number;
|
|
65
67
|
}
|
|
66
68
|
interface NavGroup {
|
|
67
69
|
/** Stable identifier used as React key. Defaults to heading if omitted. */
|
|
68
70
|
id: string;
|
|
69
71
|
heading?: string;
|
|
70
72
|
links: NavLink[];
|
|
73
|
+
/** Whether this group can be collapsed in sidebar mode. */
|
|
74
|
+
collapsible?: boolean;
|
|
71
75
|
}
|
|
72
76
|
/**
|
|
73
77
|
* An action contributed by a module to the CommandMenu.
|
|
74
78
|
*
|
|
75
|
-
* Modules declare commands in
|
|
79
|
+
* Modules declare commands in ShellModule.commands[]. The CommandMenu
|
|
76
80
|
* renders them in a dedicated group so users can trigger module actions
|
|
77
81
|
* (open side pane, trigger a workflow, etc.) directly from Cmd+K without
|
|
78
82
|
* navigating to a route first.
|
|
@@ -123,7 +127,7 @@ interface Contribution {
|
|
|
123
127
|
interface ShellEventMap {
|
|
124
128
|
[custom: string]: unknown;
|
|
125
129
|
}
|
|
126
|
-
interface
|
|
130
|
+
interface ShellModule {
|
|
127
131
|
/** Unique identifier for this module */
|
|
128
132
|
id: string;
|
|
129
133
|
/** Display name (icon rail tooltip, sub-nav header, command menu) */
|
|
@@ -134,7 +138,14 @@ interface ServiceModule {
|
|
|
134
138
|
icon: LucideIcon;
|
|
135
139
|
/** URL prefix used to match this module to the current route */
|
|
136
140
|
basePath: string;
|
|
137
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Fixed top-level navigation links shown in the sidebar's top zone
|
|
143
|
+
* (no group heading, separator below). Not shown in the icon-rail
|
|
144
|
+
* sub-nav panel — they are sidebar-specific shortcuts.
|
|
145
|
+
* Optional — omit if all navigation belongs in grouped sections.
|
|
146
|
+
*/
|
|
147
|
+
topNav?: NavLink[];
|
|
148
|
+
/** Navigation groups for the sub-nav panel and sidebar grouped sections */
|
|
138
149
|
navigation: NavGroup[];
|
|
139
150
|
/** React Router route definitions owned by this module */
|
|
140
151
|
routes: RouteObject[];
|
|
@@ -193,7 +204,7 @@ interface ServiceModule {
|
|
|
193
204
|
/**
|
|
194
205
|
* Module registry factory.
|
|
195
206
|
*
|
|
196
|
-
* Accepts a list of
|
|
207
|
+
* Accepts a list of ShellModules and returns derived data structures
|
|
197
208
|
* consumed by the shell (icon rail groups, flattened routes, extension
|
|
198
209
|
* point lookup). This is the reusable core; the app-specific module
|
|
199
210
|
* list lives in the consumer (e.g. modules/registry.ts).
|
|
@@ -201,22 +212,29 @@ interface ServiceModule {
|
|
|
201
212
|
|
|
202
213
|
interface ModuleRegistry {
|
|
203
214
|
/** All modules in registration order. */
|
|
204
|
-
modules:
|
|
215
|
+
modules: ShellModule[];
|
|
205
216
|
/** Visible modules shown in the main area of the icon rail. */
|
|
206
|
-
mainModules:
|
|
217
|
+
mainModules: ShellModule[];
|
|
207
218
|
/** Modules pinned to the bottom of the icon rail. */
|
|
208
|
-
bottomModules:
|
|
219
|
+
bottomModules: ShellModule[];
|
|
209
220
|
/** All routes from all modules, flattened. */
|
|
210
221
|
allRoutes: RouteObject[];
|
|
211
222
|
/** Get contributions for a named extension point, sorted by order. */
|
|
212
223
|
getExtensionPoint: (name: string) => Contribution[];
|
|
213
224
|
}
|
|
214
|
-
declare function createModuleRegistry(modules:
|
|
225
|
+
declare function createModuleRegistry(modules: ShellModule[]): ModuleRegistry;
|
|
215
226
|
|
|
216
227
|
interface AppShellProps {
|
|
217
228
|
registry: ModuleRegistry;
|
|
229
|
+
/**
|
|
230
|
+
* Optional custom sidebar replacing the default IconRail + SubNavPanel.
|
|
231
|
+
* When provided, the shell renders this element in place of the two-column
|
|
232
|
+
* navigation chrome. Use the Sidebar / SidebarGroup / SidebarItem components
|
|
233
|
+
* from this package to build a single-column navigation layout.
|
|
234
|
+
*/
|
|
235
|
+
sidebar?: React__default.ReactNode;
|
|
218
236
|
}
|
|
219
|
-
declare function AppShell({ registry }: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
237
|
+
declare function AppShell({ registry, sidebar }: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
220
238
|
|
|
221
239
|
interface ShellConfig {
|
|
222
240
|
/**
|
|
@@ -229,6 +247,15 @@ interface ShellConfig {
|
|
|
229
247
|
* components.
|
|
230
248
|
*/
|
|
231
249
|
topBar?: ReactNode;
|
|
250
|
+
/**
|
|
251
|
+
* Content rendered inside the ShellFooter. The shell provides the
|
|
252
|
+
* `<footer>` element with its sizing and border; the consumer owns
|
|
253
|
+
* everything inside it.
|
|
254
|
+
*
|
|
255
|
+
* Common uses: status bar, sync indicators, version info, quick actions.
|
|
256
|
+
* Omit to render no footer.
|
|
257
|
+
*/
|
|
258
|
+
footer?: ReactNode;
|
|
232
259
|
}
|
|
233
260
|
/**
|
|
234
261
|
* Read the shell configuration from context.
|
|
@@ -243,8 +270,10 @@ declare function useShellConfig(): ShellConfig;
|
|
|
243
270
|
interface RootLayoutProps {
|
|
244
271
|
config: ShellConfig;
|
|
245
272
|
registry: ModuleRegistry;
|
|
273
|
+
/** Optional custom sidebar replacing the default IconRail + SubNavPanel. */
|
|
274
|
+
sidebar?: React__default.ReactNode;
|
|
246
275
|
}
|
|
247
|
-
declare function RootLayout({ config, registry }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare function RootLayout({ config, registry, sidebar, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
248
277
|
|
|
249
278
|
/**
|
|
250
279
|
* TopBar -- persistent header across the entire application.
|
|
@@ -258,32 +287,39 @@ interface TopBarProps {
|
|
|
258
287
|
}
|
|
259
288
|
declare function TopBar({ children }: TopBarProps): react_jsx_runtime.JSX.Element;
|
|
260
289
|
|
|
261
|
-
interface IconRailProps {
|
|
262
|
-
activeServiceId: string | null;
|
|
263
|
-
/** moduleId of the module whose side pane is currently open, or null. */
|
|
264
|
-
activeSidePaneModuleId: string | null;
|
|
265
|
-
onServiceSelect: (serviceId: string) => void;
|
|
266
|
-
}
|
|
267
290
|
/**
|
|
268
|
-
* IconRail
|
|
291
|
+
* IconRail primitives — composable building blocks for the narrow
|
|
292
|
+
* vertical icon strip.
|
|
293
|
+
*
|
|
294
|
+
* - IconRail: the container (<nav> with flex column, border, bg)
|
|
295
|
+
* - RailIcon: a single icon button with tooltip
|
|
296
|
+
* - RailSeparator: divider between groups
|
|
269
297
|
*
|
|
270
|
-
*
|
|
271
|
-
* Tooltips show service labels on hover.
|
|
298
|
+
* For the auto-wired layout, use ShellRail instead.
|
|
272
299
|
*/
|
|
273
|
-
|
|
300
|
+
|
|
301
|
+
interface IconRailProps {
|
|
302
|
+
children: React__default.ReactNode;
|
|
303
|
+
className?: string;
|
|
304
|
+
}
|
|
305
|
+
/** Narrow vertical nav container for RailIcon items. */
|
|
306
|
+
declare function IconRail({ children, className, }: IconRailProps): React__default.ReactElement;
|
|
307
|
+
interface RailIconProps {
|
|
308
|
+
icon: LucideIcon;
|
|
309
|
+
label: string;
|
|
310
|
+
active?: boolean;
|
|
311
|
+
onClick?: () => void;
|
|
312
|
+
}
|
|
313
|
+
/** Single icon button with tooltip inside an IconRail. */
|
|
314
|
+
declare function RailIcon({ icon: Icon, label, active, onClick, }: RailIconProps): React__default.ReactElement;
|
|
315
|
+
/** Visual divider between icon groups inside an IconRail. */
|
|
316
|
+
declare function RailSeparator(): React__default.ReactElement;
|
|
274
317
|
|
|
275
318
|
interface SubNavPanelProps {
|
|
276
|
-
service:
|
|
319
|
+
service: ShellModule;
|
|
277
320
|
collapsed: boolean;
|
|
278
321
|
onToggleCollapse: () => void;
|
|
279
322
|
}
|
|
280
|
-
/**
|
|
281
|
-
* SubNavPanel -- contextual secondary navigation for the selected service domain.
|
|
282
|
-
*
|
|
283
|
-
* Shows the service label at top, then grouped nav links. If other modules
|
|
284
|
-
* contribute links via the "<moduleId>.nav" extension point, they are
|
|
285
|
-
* appended as an additional group.
|
|
286
|
-
*/
|
|
287
323
|
declare function SubNavPanel({ service, collapsed, onToggleCollapse, }: SubNavPanelProps): react_jsx_runtime.JSX.Element;
|
|
288
324
|
|
|
289
325
|
/**
|
|
@@ -351,6 +387,97 @@ interface ConfirmDialogProps {
|
|
|
351
387
|
*/
|
|
352
388
|
declare function ConfirmDialog({ open, title, description, confirmLabel, cancelLabel, variant, onConfirm, onCancel, }: ConfirmDialogProps): React__default.ReactElement;
|
|
353
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Sidebar — single-column navigation layout.
|
|
392
|
+
*
|
|
393
|
+
* Alternative to the IconRail + SubNavPanel two-column pattern.
|
|
394
|
+
* Renders an optional header, a scrollable body with SidebarGroup /
|
|
395
|
+
* SidebarItem children, and takes its full height from the shell.
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
interface SidebarProps {
|
|
399
|
+
children: React__default.ReactNode;
|
|
400
|
+
/** Optional header rendered above the scrollable nav (e.g. app name, collapse button). */
|
|
401
|
+
header?: React__default.ReactNode;
|
|
402
|
+
width?: number;
|
|
403
|
+
className?: string;
|
|
404
|
+
}
|
|
405
|
+
declare function Sidebar({ children, header, width, className, }: SidebarProps): React__default.ReactElement;
|
|
406
|
+
|
|
407
|
+
/** Labeled, optionally collapsible section within a Sidebar. */
|
|
408
|
+
|
|
409
|
+
interface SidebarGroupProps {
|
|
410
|
+
heading?: string;
|
|
411
|
+
collapsible?: boolean;
|
|
412
|
+
defaultOpen?: boolean;
|
|
413
|
+
/** Render a border separator below this group. */
|
|
414
|
+
separator?: boolean;
|
|
415
|
+
children: React__default.ReactNode;
|
|
416
|
+
}
|
|
417
|
+
declare function SidebarGroup({ heading, collapsible, defaultOpen, separator, children, }: SidebarGroupProps): React__default.ReactElement;
|
|
418
|
+
|
|
419
|
+
/** Single navigation row inside a Sidebar — icon + label + optional trailing slot. */
|
|
420
|
+
|
|
421
|
+
interface SidebarItemProps {
|
|
422
|
+
icon?: LucideIcon;
|
|
423
|
+
label: string;
|
|
424
|
+
path: string;
|
|
425
|
+
badge?: string | number;
|
|
426
|
+
indent?: number;
|
|
427
|
+
expandable?: boolean;
|
|
428
|
+
expanded?: boolean;
|
|
429
|
+
onToggle?: () => void;
|
|
430
|
+
onClick?: () => void;
|
|
431
|
+
}
|
|
432
|
+
declare function SidebarItem({ icon: Icon, label, path, badge, indent, expandable, expanded, onToggle, onClick, }: SidebarItemProps): React__default.ReactElement;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* ShellRail — icon-rail + sub-nav-panel layout, auto-wired from the
|
|
436
|
+
* module registry and shell navigation context.
|
|
437
|
+
*
|
|
438
|
+
* Reads active service state from ShellNavigationContext (provided by
|
|
439
|
+
* AppShell) and module list from ShellModulesContext. No props required.
|
|
440
|
+
*
|
|
441
|
+
* For custom layouts, compose IconRail, RailIcon, RailSeparator, and
|
|
442
|
+
* SubNavPanel directly.
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
declare function ShellRail(): React__default.ReactElement;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* ShellSidebar — single-column sidebar layout, auto-wired from the
|
|
449
|
+
* module registry.
|
|
450
|
+
*
|
|
451
|
+
* Reads module list from ShellModulesContext (provided by AppShell).
|
|
452
|
+
* For custom layouts, compose Sidebar / SidebarGroup / SidebarItem directly.
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
type ShellSidebarProps = Omit<SidebarProps, "children"> & {
|
|
456
|
+
/** Label for the bottom-pinned modules group. Default: "Tools". */
|
|
457
|
+
bottomGroupLabel?: string;
|
|
458
|
+
};
|
|
459
|
+
declare function ShellSidebar({ bottomGroupLabel, ...sidebarProps }: ShellSidebarProps): React__default.ReactElement;
|
|
460
|
+
|
|
461
|
+
interface ShellFooterProps {
|
|
462
|
+
children?: ReactNode;
|
|
463
|
+
}
|
|
464
|
+
declare function ShellFooter({ children }: ShellFooterProps): react_jsx_runtime.JSX.Element;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* ShellVersion — displays the app name and optional version in the footer.
|
|
468
|
+
*
|
|
469
|
+
* Typically used as ShellConfig.footer content alongside ShellFooter.
|
|
470
|
+
* The consumer provides name and version from their own package.json.
|
|
471
|
+
*/
|
|
472
|
+
|
|
473
|
+
interface ShellVersionProps {
|
|
474
|
+
/** Application name. */
|
|
475
|
+
name: string;
|
|
476
|
+
/** Version string (e.g. from package.json). Omit to show name only. */
|
|
477
|
+
version?: string;
|
|
478
|
+
}
|
|
479
|
+
declare function ShellVersion({ name, version, }: ShellVersionProps): React__default.ReactElement;
|
|
480
|
+
|
|
354
481
|
interface ShellConfigProviderProps {
|
|
355
482
|
config: ShellConfig;
|
|
356
483
|
children: ReactNode;
|
|
@@ -431,11 +558,18 @@ declare const dialog: {
|
|
|
431
558
|
};
|
|
432
559
|
type NavigateFn = (path: string) => void;
|
|
433
560
|
type CommandMenuFn = () => void;
|
|
561
|
+
type FeatureLookupFn = (featureId: string) => string | null;
|
|
434
562
|
/**
|
|
435
563
|
* Called by the shell during initialization to inject router + command menu.
|
|
436
564
|
* Not part of the public module API -- only the shell calls this.
|
|
437
565
|
*/
|
|
438
566
|
declare function initNavigation(navigateFn: NavigateFn, openCommandMenuFn: CommandMenuFn): void;
|
|
567
|
+
/**
|
|
568
|
+
* Called by the shell during initialization to inject the feature lookup.
|
|
569
|
+
* Resolves a stable feature id (e.g. "auditing.audit-events") to a path.
|
|
570
|
+
* Not part of the public module API -- only the shell calls this.
|
|
571
|
+
*/
|
|
572
|
+
declare function initFeatureNav(lookupFn: FeatureLookupFn): void;
|
|
439
573
|
declare const navigation: {
|
|
440
574
|
/** Navigate to a path within the shell. */
|
|
441
575
|
goTo(path: string): void;
|
|
@@ -537,6 +671,13 @@ interface FullscreenOptions {
|
|
|
537
671
|
/** React content to render inside the fullscreen overlay. */
|
|
538
672
|
content: ReactNode;
|
|
539
673
|
}
|
|
674
|
+
type FullscreenEnterFn = (opts: FullscreenOptions) => void;
|
|
675
|
+
type FullscreenExitFn = () => void;
|
|
676
|
+
/**
|
|
677
|
+
* Called by the shell during initialization to inject fullscreen controls.
|
|
678
|
+
* Not part of the public module API -- only the shell calls this.
|
|
679
|
+
*/
|
|
680
|
+
declare function initFullscreen(enterFn: FullscreenEnterFn, exitFn: FullscreenExitFn): void;
|
|
540
681
|
declare const fullscreen: {
|
|
541
682
|
/** Enter fullscreen mode, rendering content over all shell chrome. */
|
|
542
683
|
enter(opts: FullscreenOptions): void;
|
|
@@ -559,6 +700,16 @@ declare const events: {
|
|
|
559
700
|
*/
|
|
560
701
|
declare function useShellModules(): ModuleRegistry;
|
|
561
702
|
|
|
703
|
+
interface ShellNavigationState {
|
|
704
|
+
activeService: ShellModule | null;
|
|
705
|
+
sidePaneModuleId: string | null;
|
|
706
|
+
subNavCollapsed: boolean;
|
|
707
|
+
onToggleSubNav: () => void;
|
|
708
|
+
onServiceSelect: (id: string) => void;
|
|
709
|
+
}
|
|
710
|
+
/** Read shell navigation state. Must be used within AppShell. */
|
|
711
|
+
declare function useShellNavigation(): ShellNavigationState;
|
|
712
|
+
|
|
562
713
|
/**
|
|
563
714
|
* OverviewCard and FeatureLink -- building blocks for module overview pages.
|
|
564
715
|
*
|
|
@@ -622,7 +773,7 @@ declare function useExtensionPoint(name: string): Contribution[];
|
|
|
622
773
|
*
|
|
623
774
|
* Useful for building overviews like the home page.
|
|
624
775
|
*/
|
|
625
|
-
declare function useMainModules():
|
|
776
|
+
declare function useMainModules(): ShellModule[];
|
|
626
777
|
/**
|
|
627
778
|
* Subscribe to a shell event, auto-unsubscribing on unmount.
|
|
628
779
|
*
|
|
@@ -638,4 +789,4 @@ declare function useMainModules(): ServiceModule[];
|
|
|
638
789
|
*/
|
|
639
790
|
declare function useShellEvent<K extends keyof ShellEventMap>(key: K, handler: (payload: ShellEventMap[K]) => void): void;
|
|
640
791
|
|
|
641
|
-
export { AppShell, CommandMenu, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, type Contribution, FeatureLink, type FullscreenOptions, IconRail, type ModuleCommand, type ModuleRegistry, type NavGroup, type NavLink, OverviewCard, type PanelOptions, PlaceholderPage,
|
|
792
|
+
export { AppShell, CommandMenu, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, type Contribution, FeatureLink, type FullscreenOptions, IconRail, type IconRailProps, type ModuleCommand, type ModuleRegistry, type NavGroup, type NavLink, OverviewCard, type PanelOptions, PlaceholderPage, RailIcon, type RailIconProps, RailSeparator, RootLayout, SearchTrigger, type ShellConfig, ShellConfigProvider, type ShellEventMap, ShellFooter, type ShellFooterProps, type ShellModule, type ShellNavigationState, ShellRail, ShellSidebar, type ShellSidebarProps, ShellVersion, type ShellVersionProps, SidePane, type SidePaneOptions as SidePaneApiOptions, SidePaneContext, type SidePaneOptions, type SidePaneState, Sidebar, SidebarGroup, type SidebarGroupProps, SidebarItem, type SidebarItemProps, type SidebarProps, SubNavPanel, type SubNavPanelProps, TopBar, UserMenu, type UserMenuUser, createModuleRegistry, dialog, events, fullscreen, initDialog, initFeatureNav, initFullscreen, initNavigation, initPanel, initSidePane, navigation, notification, panel, sidePane, useExtensionPoint, useMainModules, useShellConfig, useShellEvent, useShellModules, useShellNavigation, useSidePaneState };
|