@medalsocial/meda 0.3.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +26 -0
  2. package/dist/brand/index.d.ts +2 -0
  3. package/dist/brand/index.js +1 -0
  4. package/dist/brand/medal-social-mark.d.ts +7 -0
  5. package/dist/brand/medal-social-mark.js +6 -0
  6. package/dist/brand/public.d.ts +2 -0
  7. package/dist/brand/public.js +1 -0
  8. package/dist/chat/latency-badge.js +6 -2
  9. package/dist/chat/tool-call-block.js +1 -1
  10. package/dist/chat/turn-card.js +3 -1
  11. package/dist/components/ui/command.d.ts +19 -0
  12. package/dist/components/ui/command.js +37 -0
  13. package/dist/components/ui/dialog.d.ts +26 -0
  14. package/dist/components/ui/dialog.js +39 -0
  15. package/dist/components/ui/drawer.d.ts +16 -0
  16. package/dist/components/ui/drawer.js +35 -0
  17. package/dist/components/ui/dropdown-menu.d.ts +32 -0
  18. package/dist/components/ui/dropdown-menu.js +68 -0
  19. package/dist/components/ui/tooltip.d.ts +6 -0
  20. package/dist/components/ui/tooltip.js +17 -0
  21. package/dist/index.d.ts +3 -1
  22. package/dist/index.js +3 -1
  23. package/dist/lib/utils.d.ts +2 -0
  24. package/dist/lib/utils.js +5 -0
  25. package/dist/marketing/index.d.ts +5 -0
  26. package/dist/marketing/index.js +4 -0
  27. package/dist/marketing/marketing-callout.d.ts +2 -0
  28. package/dist/marketing/marketing-callout.js +8 -0
  29. package/dist/marketing/marketing-contact.d.ts +2 -0
  30. package/dist/marketing/marketing-contact.js +19 -0
  31. package/dist/marketing/marketing-cta-list.d.ts +2 -0
  32. package/dist/marketing/marketing-cta-list.js +21 -0
  33. package/dist/marketing/marketing-lead-magnet.d.ts +2 -0
  34. package/dist/marketing/marketing-lead-magnet.js +9 -0
  35. package/dist/marketing/public.d.ts +1 -0
  36. package/dist/marketing/public.js +1 -0
  37. package/dist/marketing/types.d.ts +67 -0
  38. package/dist/marketing/types.js +1 -0
  39. package/dist/marketing/utils.d.ts +2 -0
  40. package/dist/marketing/utils.js +6 -0
  41. package/dist/panel/inspector-json.js +5 -3
  42. package/dist/shell/app-shell.d.ts +9 -0
  43. package/dist/shell/app-shell.js +11 -0
  44. package/dist/shell/command-palette.d.ts +23 -0
  45. package/dist/shell/command-palette.js +138 -0
  46. package/dist/shell/context-rail.d.ts +31 -0
  47. package/dist/shell/context-rail.js +81 -0
  48. package/dist/shell/extras/index.d.ts +4 -0
  49. package/dist/shell/extras/index.js +4 -0
  50. package/dist/shell/extras/shell-desktop-panel-dock.d.ts +14 -0
  51. package/dist/shell/extras/shell-desktop-panel-dock.js +43 -0
  52. package/dist/shell/extras/shell-scrollable-content.d.ts +9 -0
  53. package/dist/shell/extras/shell-scrollable-content.js +7 -0
  54. package/dist/shell/extras/shell-tab-bar.d.ts +18 -0
  55. package/dist/shell/extras/shell-tab-bar.js +27 -0
  56. package/dist/shell/extras/types.d.ts +64 -0
  57. package/dist/shell/extras/types.js +2 -0
  58. package/dist/shell/extras/workbench-layout.d.ts +10 -0
  59. package/dist/shell/extras/workbench-layout.js +29 -0
  60. package/dist/shell/icon-rail.d.ts +29 -0
  61. package/dist/shell/icon-rail.js +38 -0
  62. package/dist/shell/index.d.ts +24 -15
  63. package/dist/shell/index.js +35 -15
  64. package/dist/shell/layout-state.d.ts +32 -0
  65. package/dist/shell/layout-state.js +98 -0
  66. package/dist/shell/mobile/mobile-bottom-nav.d.ts +15 -0
  67. package/dist/shell/mobile/mobile-bottom-nav.js +76 -0
  68. package/dist/shell/mobile/mobile-drawers.d.ts +20 -0
  69. package/dist/shell/mobile/mobile-drawers.js +62 -0
  70. package/dist/shell/mobile/mobile-header.d.ts +23 -0
  71. package/dist/shell/mobile/mobile-header.js +22 -0
  72. package/dist/shell/motion.d.ts +22 -0
  73. package/dist/shell/motion.js +19 -0
  74. package/dist/shell/public.d.ts +16 -2
  75. package/dist/shell/public.js +20 -1
  76. package/dist/shell/resizable-shell.d.ts +45 -0
  77. package/dist/shell/resizable-shell.js +15 -0
  78. package/dist/shell/right-panel.d.ts +15 -0
  79. package/dist/shell/right-panel.js +126 -0
  80. package/dist/shell/shell-auth-frame.d.ts +22 -0
  81. package/dist/shell/shell-auth-frame.js +60 -0
  82. package/dist/shell/shell-header.d.ts +10 -9
  83. package/dist/shell/shell-header.js +57 -14
  84. package/dist/shell/shell-layout-utils.d.ts +2 -2
  85. package/dist/shell/shell-main.d.ts +8 -0
  86. package/dist/shell/shell-main.js +11 -0
  87. package/dist/shell/shell-provider.d.ts +65 -0
  88. package/dist/shell/shell-provider.js +152 -0
  89. package/dist/shell/shell-route-utils.d.ts +1 -1
  90. package/dist/shell/theme-next-themes.d.ts +4 -0
  91. package/dist/shell/theme-next-themes.js +24 -0
  92. package/dist/shell/theme.d.ts +9 -0
  93. package/dist/shell/theme.js +58 -0
  94. package/dist/shell/types.d.ts +41 -41
  95. package/dist/shell/types.js +1 -0
  96. package/dist/shell/use-shell-viewport.d.ts +2 -0
  97. package/dist/shell/use-shell-viewport.js +40 -0
  98. package/dist/shell/utils.d.ts +1 -1
  99. package/dist/styles/globals.css +26 -0
  100. package/dist/styles/theme.css +147 -0
  101. package/dist/styles/tokens.css +338 -0
  102. package/dist/timeline/date-switcher.js +3 -1
  103. package/dist/timeline/event-card.js +5 -13
  104. package/dist/timeline/live-indicator.js +3 -1
  105. package/dist/timeline/scrub-bar.js +8 -9
  106. package/dist/timeline/timeline-rail.js +6 -4
  107. package/dist/timeline/timeline-tape.js +7 -8
  108. package/dist/voice/voice-level.js +3 -1
  109. package/dist/voice/voice-orb-scene.js +1 -0
  110. package/dist/voice/voice-orb.js +9 -11
  111. package/dist/voice/voice-status-pill.js +4 -9
  112. package/package.json +53 -6
@@ -0,0 +1,67 @@
1
+ import type { MouseEventHandler, ReactNode } from 'react';
2
+ export type MarketingCtaVariant = 'primary' | 'secondary';
3
+ export type MarketingAlign = 'start' | 'center';
4
+ export interface MarketingCta {
5
+ label: ReactNode;
6
+ href?: string;
7
+ onClick?: MouseEventHandler<HTMLButtonElement>;
8
+ variant?: MarketingCtaVariant;
9
+ ariaLabel?: string;
10
+ target?: string;
11
+ rel?: string;
12
+ }
13
+ export interface MarketingCtaListProps {
14
+ ctas?: MarketingCta[];
15
+ align?: MarketingAlign;
16
+ className?: string;
17
+ }
18
+ export type MarketingCalloutVariant = 'band' | 'card';
19
+ export interface MarketingCalloutProps {
20
+ eyebrow?: ReactNode;
21
+ title: ReactNode;
22
+ description?: ReactNode;
23
+ children?: ReactNode;
24
+ ctas?: MarketingCta[];
25
+ variant?: MarketingCalloutVariant;
26
+ align?: MarketingAlign;
27
+ className?: string;
28
+ }
29
+ export interface MarketingOffice {
30
+ title?: ReactNode;
31
+ address?: ReactNode;
32
+ email?: string;
33
+ phone?: string;
34
+ hours?: ReactNode;
35
+ }
36
+ export interface MarketingContactPerson {
37
+ title?: ReactNode;
38
+ name: ReactNode;
39
+ role?: ReactNode;
40
+ description?: ReactNode;
41
+ image?: ReactNode;
42
+ email?: string;
43
+ phone?: string;
44
+ }
45
+ export interface MarketingContactProps {
46
+ intro?: ReactNode;
47
+ form: ReactNode;
48
+ office?: MarketingOffice;
49
+ contactPerson?: MarketingContactPerson;
50
+ compact?: boolean;
51
+ className?: string;
52
+ }
53
+ export type MarketingLeadMagnetVariant = 'featured' | 'sidebar';
54
+ export interface MarketingLeadMagnetProps {
55
+ title: ReactNode;
56
+ description?: ReactNode;
57
+ benefits?: ReactNode[];
58
+ image?: ReactNode;
59
+ buttonText?: ReactNode;
60
+ formTitle?: ReactNode;
61
+ form?: ReactNode;
62
+ variant?: MarketingLeadMagnetVariant;
63
+ open?: boolean;
64
+ defaultOpen?: boolean;
65
+ onOpenChange?: (open: boolean) => void;
66
+ className?: string;
67
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function cx(...values: Array<string | false | null | undefined>): string;
2
+ export declare function toTelHref(phone: string): string;
@@ -0,0 +1,6 @@
1
+ export function cx(...values) {
2
+ return values.filter(Boolean).join(' ');
3
+ }
4
+ export function toTelHref(phone) {
5
+ return `tel:${phone.replace(/[^\d+]/g, '')}`;
6
+ }
@@ -57,12 +57,14 @@ function tokenize(value, level, key, indent, seen) {
57
57
  }
58
58
  return out;
59
59
  }
60
+ // 700-shade variants for syntax tokens so 11px monospace text clears
61
+ // WCAG AA (4.5:1) against the inspector's near-white background.
60
62
  const KIND_CLASS = {
61
63
  punct: 'text-muted-foreground',
62
64
  key: 'text-primary',
63
- string: 'text-emerald-500',
64
- number: 'text-amber-500',
65
- literal: 'text-amber-500',
65
+ string: 'text-emerald-700',
66
+ number: 'text-amber-700',
67
+ literal: 'text-amber-700',
66
68
  };
67
69
  export function InspectorJSON({ data, indent = 2, className }) {
68
70
  const tokens = tokenize(data, 0, null, indent, new WeakSet());
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function AppShell({ children, className }: {
3
+ children: ReactNode;
4
+ className?: string;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export declare function AppShellBody({ children, className }: {
7
+ children: ReactNode;
8
+ className?: string;
9
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { cn } from '../lib/utils.js';
4
+ import { useMedaShell } from './shell-provider.js';
5
+ export function AppShell({ children, className }) {
6
+ const { workspace, activeAppId } = useMedaShell();
7
+ return (_jsx("div", { "data-meda-app": activeAppId, "data-meda-workspace": workspace.id, className: cn('h-screen overflow-hidden bg-background text-foreground', className), children: children }));
8
+ }
9
+ export function AppShellBody({ children, className }) {
10
+ return (_jsx("div", { className: cn('relative flex h-[calc(100vh-var(--shell-header-height))] overflow-hidden', className), children: children }));
11
+ }
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { CommandDefinition } from './types.js';
3
+ export interface CommandGroupDefinition {
4
+ id: string;
5
+ label: string;
6
+ /** Lower value = rendered earlier. Default: 100. */
7
+ priority?: number;
8
+ }
9
+ interface CommandRegistry {
10
+ register: (commands: CommandDefinition[]) => void;
11
+ unregister: (ids: string[]) => void;
12
+ registerGroup: (group: CommandGroupDefinition) => void;
13
+ unregisterGroup: (id: string) => void;
14
+ }
15
+ export declare const CommandRegistryContext: import("react").Context<CommandRegistry | null>;
16
+ export declare function matchesHotkey(e: KeyboardEvent, spec: string): boolean;
17
+ export interface CommandPaletteProps {
18
+ children?: ReactNode;
19
+ }
20
+ export declare function CommandPalette({ children }: CommandPaletteProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function useCommands(commands: CommandDefinition[]): void;
22
+ export declare function useCommandGroup(group: CommandGroupDefinition): void;
23
+ export {};
@@ -0,0 +1,138 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
4
+ import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandShortcut, } from '../components/ui/command.js';
5
+ import { useMedaShell } from './shell-provider.js';
6
+ // ---------------------------------------------------------------------------
7
+ // Context
8
+ // ---------------------------------------------------------------------------
9
+ export const CommandRegistryContext = createContext(null);
10
+ // ---------------------------------------------------------------------------
11
+ // matchesHotkey — strict modifier matching
12
+ //
13
+ // 'mod+k' → matches Cmd+K on macOS, Ctrl+K on Windows/Linux
14
+ // 'mod+shift+k' → requires modifier + shift + key; no other modifiers
15
+ // 'mod+alt+k' → requires modifier + alt + key; no other modifiers
16
+ //
17
+ // Modifiers not listed in `spec` MUST NOT be pressed.
18
+ // ---------------------------------------------------------------------------
19
+ export function matchesHotkey(e, spec) {
20
+ const parts = spec.toLowerCase().split('+');
21
+ const key = parts.at(-1) ?? '';
22
+ const mods = parts.slice(0, -1);
23
+ const wantMod = mods.includes('mod');
24
+ const wantShift = mods.includes('shift');
25
+ const wantAlt = mods.includes('alt');
26
+ const hasMod = e.metaKey || e.ctrlKey;
27
+ return (e.key.toLowerCase() === key &&
28
+ (wantMod ? hasMod : !hasMod) &&
29
+ (wantShift ? e.shiftKey : !e.shiftKey) &&
30
+ (wantAlt ? e.altKey : !e.altKey));
31
+ }
32
+ export function CommandPalette({ children }) {
33
+ const ctx = useMedaShell();
34
+ const { open, setOpen } = ctx.commandPalette;
35
+ const hotkey = ctx.commandPaletteHotkey;
36
+ const [commands, setCommands] = useState([]);
37
+ const [groups, setGroups] = useState([]);
38
+ // -------------------------------------------------------------------------
39
+ // Registry methods
40
+ // -------------------------------------------------------------------------
41
+ const register = useCallback((cmds) => {
42
+ setCommands((prev) => {
43
+ const ids = new Set(cmds.map((c) => c.id));
44
+ return [...prev.filter((c) => !ids.has(c.id)), ...cmds];
45
+ });
46
+ }, []);
47
+ const unregister = useCallback((ids) => {
48
+ setCommands((prev) => prev.filter((c) => !ids.includes(c.id)));
49
+ }, []);
50
+ const registerGroup = useCallback((group) => {
51
+ setGroups((prev) => [...prev.filter((g) => g.id !== group.id), group]);
52
+ }, []);
53
+ const unregisterGroup = useCallback((id) => {
54
+ setGroups((prev) => prev.filter((g) => g.id !== id));
55
+ }, []);
56
+ const registry = useMemo(() => ({ register, unregister, registerGroup, unregisterGroup }), [register, unregister, registerGroup, unregisterGroup]);
57
+ // -------------------------------------------------------------------------
58
+ // Hotkey listener
59
+ // -------------------------------------------------------------------------
60
+ useEffect(() => {
61
+ const onKey = (e) => {
62
+ if (matchesHotkey(e, hotkey)) {
63
+ e.preventDefault();
64
+ setOpen(true);
65
+ }
66
+ };
67
+ window.addEventListener('keydown', onKey);
68
+ return () => window.removeEventListener('keydown', onKey);
69
+ }, [hotkey, setOpen]);
70
+ // -------------------------------------------------------------------------
71
+ // Group + sort commands
72
+ // -------------------------------------------------------------------------
73
+ const grouped = useMemo(() => {
74
+ const byGroup = new Map();
75
+ for (const cmd of commands) {
76
+ const list = byGroup.get(cmd.group) ?? [];
77
+ list.push(cmd);
78
+ byGroup.set(cmd.group, list);
79
+ }
80
+ const orderedGroupIds = [...byGroup.keys()].sort((a, b) => {
81
+ const ga = groups.find((g) => g.id === a);
82
+ const gb = groups.find((g) => g.id === b);
83
+ const pa = ga?.priority ?? 100;
84
+ const pb = gb?.priority ?? 100;
85
+ if (pa !== pb)
86
+ return pa - pb;
87
+ const la = ga?.label ?? a;
88
+ const lb = gb?.label ?? b;
89
+ return la.localeCompare(lb);
90
+ });
91
+ return orderedGroupIds.map((groupId) => {
92
+ const def = groups.find((g) => g.id === groupId);
93
+ return {
94
+ id: groupId,
95
+ label: def?.label ?? groupId,
96
+ commands: (byGroup.get(groupId) ?? []).sort((a, b) => a.label.localeCompare(b.label)),
97
+ };
98
+ });
99
+ }, [commands, groups]);
100
+ // -------------------------------------------------------------------------
101
+ // Handlers
102
+ // -------------------------------------------------------------------------
103
+ const handleSelect = (cmd) => {
104
+ setOpen(false);
105
+ void cmd.run();
106
+ };
107
+ // -------------------------------------------------------------------------
108
+ // Render
109
+ // -------------------------------------------------------------------------
110
+ return (_jsxs(CommandRegistryContext.Provider, { value: registry, children: [children, _jsx(CommandDialog, { open: open, onOpenChange: setOpen, children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search commands\u2026" }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results." }), grouped.map((group) => (_jsx(CommandGroup, { heading: group.label, children: group.commands.map((cmd) => {
111
+ const Icon = cmd.icon;
112
+ return (_jsxs(CommandItem, { value: `${group.label} ${cmd.label}`, onSelect: () => handleSelect(cmd), children: [Icon && _jsx(Icon, { size: 16, "aria-hidden": "true" }), _jsx("span", { children: cmd.label }), cmd.shortcut && _jsx(CommandShortcut, { children: cmd.shortcut })] }, cmd.id));
113
+ }) }, group.id)))] })] }) })] }));
114
+ }
115
+ // ---------------------------------------------------------------------------
116
+ // useCommands — registers on mount, unregisters on unmount
117
+ // ---------------------------------------------------------------------------
118
+ export function useCommands(commands) {
119
+ const registry = useContext(CommandRegistryContext);
120
+ if (!registry)
121
+ throw new Error('useCommands must be used inside <CommandPalette>');
122
+ useEffect(() => {
123
+ registry.register(commands);
124
+ return () => registry.unregister(commands.map((c) => c.id));
125
+ }, [commands, registry.register, registry.unregister]);
126
+ }
127
+ // ---------------------------------------------------------------------------
128
+ // useCommandGroup — registers group metadata for ordering
129
+ // ---------------------------------------------------------------------------
130
+ export function useCommandGroup(group) {
131
+ const registry = useContext(CommandRegistryContext);
132
+ if (!registry)
133
+ throw new Error('useCommandGroup must be used inside <CommandPalette>');
134
+ useEffect(() => {
135
+ registry.registerGroup(group);
136
+ return () => registry.unregisterGroup(group.id);
137
+ }, [group, registry.registerGroup, registry.unregisterGroup]);
138
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ContextRail — spec §10
3
+ *
4
+ * Renders a resizable, collapsible, persisted context navigation rail.
5
+ * Width is stored per-(workspaceId, appId) via useShellLayoutState through
6
+ * the MedaShellProvider context.
7
+ *
8
+ * Resize integration note (Phase 9 / Pattern B):
9
+ * The rail uses its own pointer-events resize handle on the right edge instead
10
+ * of wrapping in <ResizableShell> (Pattern A). Pattern A requires migrating
11
+ * <AppShellBody> to a PanelGroup layout — that is Phase 11 territory.
12
+ * TODO(phase-11): replace pointer-events handle with <ResizableShellPanel>
13
+ * once <AppShellBody> ships as a ResizableShell Group.
14
+ */
15
+ import type { ReactNode } from 'react';
16
+ import type { ContextModule, ShellLinkRenderArgs } from './types.js';
17
+ export interface ContextRailProps {
18
+ /** Drives the persistence key for layout state. */
19
+ appId: string;
20
+ module?: ContextModule;
21
+ /** Starting width in px. Falls back to provider's stored width (default 300). */
22
+ defaultWidth?: number;
23
+ collapsible?: boolean;
24
+ /** When true, the rail evaporates — renders an aria-hidden placeholder. */
25
+ hidden?: boolean;
26
+ /** Optional active item id for nav active state (preferred over useMedaShell().selection). */
27
+ activeItemId?: string;
28
+ renderLink?: (args: ShellLinkRenderArgs) => ReactNode;
29
+ className?: string;
30
+ }
31
+ export declare function ContextRail({ appId: _appId, module, hidden, collapsible: _collapsible, activeItemId, renderLink, className, }: ContextRailProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,81 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useRef, useState } from 'react';
4
+ import { cn } from '../lib/utils.js';
5
+ import { useMedaShell } from './shell-provider.js';
6
+ import { useShellViewport } from './use-shell-viewport.js';
7
+ // ---------------------------------------------------------------------------
8
+ // Constants — spec §10 dimensions
9
+ // ---------------------------------------------------------------------------
10
+ const MIN_WIDTH = 240;
11
+ const MAX_WIDTH = 420;
12
+ function ResizeHandle({ currentWidth, onResize, onCommit }) {
13
+ const startWidthRef = useRef(currentWidth);
14
+ const startXRef = useRef(0);
15
+ const draggingRef = useRef(false);
16
+ const handlePointerDown = (e) => {
17
+ // setPointerCapture may not be available in all test environments (jsdom)
18
+ try {
19
+ e.currentTarget.setPointerCapture(e.pointerId);
20
+ }
21
+ catch {
22
+ // ignore — drag still functions via draggingRef
23
+ }
24
+ startWidthRef.current = currentWidth;
25
+ startXRef.current = e.clientX;
26
+ draggingRef.current = true;
27
+ };
28
+ const handlePointerMove = (e) => {
29
+ if (!draggingRef.current)
30
+ return;
31
+ const next = Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, startWidthRef.current + (e.clientX - startXRef.current)));
32
+ onResize(next);
33
+ };
34
+ const handlePointerUp = (e) => {
35
+ if (!draggingRef.current)
36
+ return;
37
+ draggingRef.current = false;
38
+ const next = Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, startWidthRef.current + (e.clientX - startXRef.current)));
39
+ onCommit(next);
40
+ };
41
+ return (_jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": "Resize context rail", "aria-valuenow": currentWidth, "aria-valuemin": MIN_WIDTH, "aria-valuemax": MAX_WIDTH, tabIndex: 0, className: cn('absolute top-0 right-0 h-full w-1 cursor-col-resize', 'opacity-0 transition-opacity hover:opacity-100 hover:bg-ring'), onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerUp }));
42
+ }
43
+ // ---------------------------------------------------------------------------
44
+ // ContextRail
45
+ // ---------------------------------------------------------------------------
46
+ export function ContextRail({ appId: _appId, module, hidden = false, collapsible: _collapsible = true, activeItemId, renderLink, className, }) {
47
+ const band = useShellViewport();
48
+ const ctx = useMedaShell();
49
+ const collapsed = ctx.contextRail.collapsed;
50
+ // Local display width tracks pointer-move updates; ctx.contextRail.setWidth
51
+ // is called on pointerUp to persist via useShellLayoutState.
52
+ const [displayWidth, setDisplayWidth] = useState(null);
53
+ const width = displayWidth ?? ctx.contextRail.width;
54
+ if (band === 'mobile')
55
+ return null;
56
+ if (hidden) {
57
+ return _jsx("div", { "aria-hidden": "true", className: "hidden", "data-testid": "context-rail-hidden" });
58
+ }
59
+ if (!module || module.items.length === 0) {
60
+ return _jsx("div", { "aria-hidden": "true", className: "hidden", "data-testid": "context-rail-empty" });
61
+ }
62
+ const handleResize = (w) => {
63
+ setDisplayWidth(w);
64
+ };
65
+ const handleCommit = (w) => {
66
+ setDisplayWidth(null);
67
+ ctx.contextRail.setWidth(w);
68
+ };
69
+ return (_jsxs("aside", { "aria-label": module.label, className: cn('relative h-full shrink-0 overflow-hidden border-r border-shell-border bg-shell-context', collapsed && 'w-0', className), style: { width: collapsed ? 0 : width }, children: [_jsxs("div", { className: "border-b border-shell-border px-4 py-3", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: module.label }), module.description && (_jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: module.description }))] }), _jsx("nav", { "aria-label": `${module.label} navigation`, className: "flex flex-col gap-0.5 p-2", children: module.items.map((item) => {
70
+ const isActive = item.id === activeItemId;
71
+ const klass = cn('flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors', isActive
72
+ ? 'bg-primary/10 text-primary'
73
+ : 'text-muted-foreground hover:bg-accent hover:text-foreground');
74
+ const IconComp = item.icon;
75
+ const inner = (_jsxs(_Fragment, { children: [_jsx(IconComp, { size: 16, "aria-hidden": "true", className: "shrink-0" }), _jsx("span", { className: "truncate", children: item.label }), item.shortcut && (_jsx("kbd", { className: "ml-auto font-mono text-[10px] text-muted-foreground", children: item.shortcut }))] }));
76
+ if (renderLink) {
77
+ return renderLink({ item, isActive, className: klass, children: inner });
78
+ }
79
+ return (_jsx("a", { href: item.to, "aria-current": isActive ? 'page' : undefined, className: klass, children: inner }, item.id));
80
+ }) }), _jsx(ResizeHandle, { currentWidth: width, onResize: handleResize, onCommit: handleCommit })] }));
81
+ }
@@ -0,0 +1,4 @@
1
+ export * from './shell-desktop-panel-dock.js';
2
+ export * from './shell-scrollable-content.js';
3
+ export * from './shell-tab-bar.js';
4
+ export * from './workbench-layout.js';
@@ -0,0 +1,4 @@
1
+ export * from './shell-desktop-panel-dock.js';
2
+ export * from './shell-scrollable-content.js';
3
+ export * from './shell-tab-bar.js';
4
+ export * from './workbench-layout.js';
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ export declare function ShellDesktopPanelDock({ defaultView, panelOpen, viewIds, width, onWidthChange, renderPanel, className, }: {
3
+ defaultView: string;
4
+ panelOpen: boolean;
5
+ viewIds?: string[];
6
+ width: number;
7
+ onWidthChange: (width: number) => void;
8
+ renderPanel: (options: {
9
+ defaultView: string;
10
+ viewIds?: string[];
11
+ className?: string;
12
+ }) => React.ReactNode;
13
+ className?: string;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ function ShellPanelResizeHandle({ width, onWidthChange, }) {
4
+ const startXRef = React.useRef(0);
5
+ const startWidthRef = React.useRef(width);
6
+ const cleanupRef = React.useRef(null);
7
+ React.useEffect(() => {
8
+ return () => {
9
+ cleanupRef.current?.();
10
+ };
11
+ }, []);
12
+ function handlePointerDown(event) {
13
+ if (event.button !== 0)
14
+ return;
15
+ startXRef.current = event.clientX;
16
+ startWidthRef.current = width;
17
+ const handlePointerMove = (moveEvent) => {
18
+ onWidthChange(startWidthRef.current + (startXRef.current - moveEvent.clientX));
19
+ };
20
+ const handlePointerEnd = () => {
21
+ window.removeEventListener('pointermove', handlePointerMove);
22
+ window.removeEventListener('pointerup', handlePointerEnd);
23
+ window.removeEventListener('pointercancel', handlePointerEnd);
24
+ cleanupRef.current = null;
25
+ };
26
+ cleanupRef.current?.();
27
+ window.addEventListener('pointermove', handlePointerMove);
28
+ window.addEventListener('pointerup', handlePointerEnd);
29
+ window.addEventListener('pointercancel', handlePointerEnd);
30
+ cleanupRef.current = handlePointerEnd;
31
+ }
32
+ return (_jsx("button", { type: "button", "aria-label": "Resize panel", onPointerDown: handlePointerDown, className: "absolute inset-y-0 left-0 z-10 flex w-2 shrink-0 cursor-col-resize items-center justify-center bg-transparent transition-colors hover:bg-[var(--primary)]/10", children: _jsx("span", { className: "h-12 w-px rounded-full bg-[var(--border-subtle)]" }) }));
33
+ }
34
+ export function ShellDesktopPanelDock({ defaultView, panelOpen, viewIds, width, onWidthChange, renderPanel, className, }) {
35
+ return (_jsx("div", { "data-testid": "desktop-panel-dock", "aria-hidden": !panelOpen, "data-state": panelOpen ? 'open' : 'closed', className: panelOpen
36
+ ? 'pointer-events-auto absolute inset-y-4 right-4 z-20 translate-x-0 opacity-100 transition-[transform,opacity] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]'
37
+ : 'pointer-events-none absolute inset-y-4 right-4 z-20 translate-x-[calc(100%+1.25rem)] opacity-0 transition-[transform,opacity] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]', style: { width: `${width}px` }, children: _jsxs("div", { className: "relative h-full w-full", children: [_jsx(ShellPanelResizeHandle, { width: width, onWidthChange: onWidthChange }), renderPanel({
38
+ defaultView,
39
+ viewIds,
40
+ className: className ??
41
+ 'ml-2 rounded-[var(--radius-4xl)] border border-[var(--border)] bg-[color-mix(in_srgb,var(--shell-panel)_90%,transparent)] shadow-[var(--shell-shadow)] backdrop-blur-xl',
42
+ })] }) }));
43
+ }
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ShellContentLayout } from './types.js';
3
+ export interface ShellScrollableContentProps {
4
+ children: ReactNode;
5
+ desktopDockOffset?: number;
6
+ layout: ShellContentLayout;
7
+ maxWidth?: number;
8
+ }
9
+ export declare function ShellScrollableContent({ children, desktopDockOffset, layout, maxWidth, }: ShellScrollableContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ function joinClasses(...values) {
3
+ return values.filter(Boolean).join(' ');
4
+ }
5
+ export function ShellScrollableContent({ children, desktopDockOffset = 0, layout, maxWidth, }) {
6
+ return (_jsx("main", { "data-testid": "shell-workspace-viewport", className: "shell-scrollbar-hidden absolute inset-0 min-w-0 overflow-y-auto overflow-x-hidden pb-[var(--bottom-nav-height)] transition-[padding] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] md:pb-0", style: desktopDockOffset > 0 ? { paddingRight: `${desktopDockOffset}px` } : undefined, children: layout === 'centered' ? (_jsx("div", { "data-testid": "shell-content-centered", className: "flex min-h-full items-center justify-center px-5 py-5 sm:px-6 sm:py-6 md:px-8 md:py-8 lg:px-10", children: _jsx("div", { className: "flex w-full max-w-3xl items-center justify-center", children: children }) })) : layout === 'fullbleed' ? (_jsx("div", { "data-testid": "shell-content-fullbleed", className: "mx-auto w-full px-5 py-5 sm:px-6 sm:py-6 md:px-8 md:py-8 lg:px-10", style: maxWidth ? { maxWidth: `${maxWidth}px` } : undefined, children: children })) : (_jsx("div", { "data-testid": "shell-content-workspace", className: joinClasses('mx-auto w-full px-5 py-5 sm:px-6 sm:py-6 md:px-8 md:py-8 lg:px-10'), style: maxWidth ? { maxWidth: `${maxWidth}px` } : undefined, children: children })) }));
7
+ }
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ShellTab } from './types.js';
3
+ interface ShellTabBarRenderArgs {
4
+ children: ReactNode;
5
+ className: string;
6
+ isActive: boolean;
7
+ tab: ShellTab;
8
+ }
9
+ export interface ShellTabBarProps {
10
+ tabs: ShellTab[];
11
+ activeTab?: string;
12
+ onTabChange?: (tabId: string) => void;
13
+ className?: string;
14
+ ariaLabel?: string;
15
+ renderLink?: (args: ShellTabBarRenderArgs) => ReactNode;
16
+ }
17
+ export declare function ShellTabBar({ tabs, activeTab, onTabChange, className, ariaLabel, renderLink, }: ShellTabBarProps): import("react/jsx-runtime").JSX.Element | null;
18
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ function joinClasses(...values) {
3
+ return values.filter(Boolean).join(' ');
4
+ }
5
+ const tabBarClassName = 'flex h-[var(--tab-bar-height)] shrink-0 items-center gap-3 overflow-x-auto bg-[var(--background)] px-3';
6
+ const tabClassName = 'border-b-[1.5px] pb-2.5 pt-2.5 text-xs whitespace-nowrap transition-colors';
7
+ const activeTabClassName = 'border-[var(--primary)] text-[var(--primary)]';
8
+ const inactiveTabClassName = 'border-transparent text-[var(--muted-foreground)] hover:text-[var(--foreground)]';
9
+ export function ShellTabBar({ tabs, activeTab, onTabChange, className, ariaLabel = 'Tabs', renderLink, }) {
10
+ if (tabs.length === 0)
11
+ return null;
12
+ if (renderLink && tabs.every((tab) => Boolean(tab.to))) {
13
+ return (_jsx("nav", { "aria-label": ariaLabel, className: joinClasses(tabBarClassName, className), children: tabs.map((tab) => {
14
+ const isActive = tab.id === activeTab;
15
+ return renderLink({
16
+ tab,
17
+ isActive,
18
+ className: joinClasses(tabClassName, isActive ? activeTabClassName : inactiveTabClassName),
19
+ children: tab.label,
20
+ });
21
+ }) }));
22
+ }
23
+ return (_jsx("nav", { "aria-label": ariaLabel, className: joinClasses(tabBarClassName, className), children: tabs.map((tab) => {
24
+ const isActive = tab.id === activeTab;
25
+ return (_jsx("button", { type: "button", "data-active": isActive, onClick: () => onTabChange?.(tab.id), className: joinClasses(tabClassName, isActive ? activeTabClassName : inactiveTabClassName), children: tab.label }, tab.id));
26
+ }) }));
27
+ }
@@ -0,0 +1,64 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import type { ReactNode } from 'react';
3
+ export type ShellContentLayout = 'workspace' | 'centered' | 'fullbleed';
4
+ export type ShellViewportBand = 'mobile' | 'tablet' | 'desktop' | 'wide' | 'ultrawide';
5
+ export interface ShellTab {
6
+ id: string;
7
+ label: string;
8
+ to?: string;
9
+ icon?: LucideIcon;
10
+ }
11
+ export interface ShellNavItem {
12
+ to: string;
13
+ label: string;
14
+ description?: string;
15
+ icon: LucideIcon;
16
+ shortcut?: string;
17
+ }
18
+ export interface ShellRailItem {
19
+ to: string;
20
+ label: string;
21
+ icon: LucideIcon;
22
+ }
23
+ export interface ShellModuleDefinition {
24
+ id: string;
25
+ label: string;
26
+ description: string;
27
+ items: ShellNavItem[];
28
+ headerTabs?: ShellTab[];
29
+ }
30
+ export interface ShellPanelDefinition {
31
+ id: string;
32
+ label: string;
33
+ icon: LucideIcon;
34
+ global?: boolean;
35
+ hidden?: boolean;
36
+ }
37
+ export interface ShellCommandDefinition {
38
+ id: string;
39
+ label: string;
40
+ to: string;
41
+ icon: LucideIcon;
42
+ group: string;
43
+ shortcut?: string;
44
+ }
45
+ export interface ShellPanelRenderContext {
46
+ sectionKey: string;
47
+ viewId: string;
48
+ selectedProductId: string | null;
49
+ }
50
+ export type ShellPanelRenderer = (context: ShellPanelRenderContext) => ReactNode;
51
+ export interface ShellRouteContext {
52
+ pathname: string;
53
+ params: Record<string, string | undefined>;
54
+ }
55
+ export interface ShellHostAdapter {
56
+ route: ShellRouteContext;
57
+ navigate: (to: string) => void;
58
+ }
59
+ export interface ShellViewDefinition {
60
+ shellContentLayout?: ShellContentLayout;
61
+ shellTabs?: ShellTab[] | ((context: ShellRouteContext) => ShellTab[]);
62
+ shellActions?: ReactNode | ((context: ShellRouteContext) => ReactNode);
63
+ shellPanelViews?: string[];
64
+ }
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ShellViewportBand } from './types.js';
3
+ export interface WorkbenchLayoutProps {
4
+ viewportBand: ShellViewportBand;
5
+ main: ReactNode;
6
+ aside?: ReactNode;
7
+ toolbar?: ReactNode;
8
+ className?: string;
9
+ }
10
+ export declare function WorkbenchLayout({ viewportBand, main, aside, toolbar, className, }: WorkbenchLayoutProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ function joinClasses(...values) {
3
+ return values.filter(Boolean).join(' ');
4
+ }
5
+ function getWorkbenchMaxWidth(viewportBand) {
6
+ if (viewportBand === 'desktop')
7
+ return 1440;
8
+ if (viewportBand === 'wide')
9
+ return 1760;
10
+ if (viewportBand === 'ultrawide')
11
+ return 1920;
12
+ return undefined;
13
+ }
14
+ export function WorkbenchLayout({ viewportBand, main, aside, toolbar, className, }) {
15
+ const maxWidth = getWorkbenchMaxWidth(viewportBand);
16
+ const layout = !aside
17
+ ? 'single'
18
+ : viewportBand === 'mobile' || viewportBand === 'tablet'
19
+ ? 'stacked'
20
+ : viewportBand === 'desktop'
21
+ ? 'split'
22
+ : 'multi-zone';
23
+ const columnStyle = layout === 'split'
24
+ ? { gridTemplateColumns: 'minmax(0, 1fr) minmax(280px, 320px)' }
25
+ : layout === 'multi-zone'
26
+ ? { gridTemplateColumns: 'minmax(0, 1fr) minmax(300px, 360px)' }
27
+ : undefined;
28
+ return (_jsxs("section", { "data-testid": "workbench-layout", "data-band": viewportBand, className: joinClasses('mx-auto flex w-full flex-col gap-6', className), style: maxWidth ? { maxWidth: `${maxWidth}px` } : undefined, children: [toolbar ? _jsx("div", { "data-testid": "workbench-toolbar", children: toolbar }) : null, _jsxs("div", { "data-testid": "workbench-columns", "data-layout": layout, className: joinClasses('w-full gap-5', layout === 'stacked' ? 'flex flex-col' : layout === 'single' ? 'flex flex-col' : 'grid'), style: columnStyle, children: [_jsx("div", { "data-testid": "workbench-main", className: "min-w-0", children: main }), aside ? (_jsx("aside", { "data-testid": "workbench-aside", className: "min-w-0", children: aside })) : null] })] }));
29
+ }