@medalsocial/meda 1.0.0 → 1.1.1

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 (54) hide show
  1. package/dist/chat/latency-badge.js +1 -1
  2. package/dist/chat/latency-breakdown.js +1 -1
  3. package/dist/chat/turn-card.js +1 -1
  4. package/dist/shell/app-shell-auth.d.ts +5 -0
  5. package/dist/shell/app-shell-auth.js +50 -0
  6. package/dist/shell/app-shell-chat.d.ts +6 -0
  7. package/dist/shell/app-shell-chat.js +9 -0
  8. package/dist/shell/app-shell-workspace.d.ts +10 -0
  9. package/dist/shell/app-shell-workspace.js +55 -0
  10. package/dist/shell/app-shell.d.ts +18 -2
  11. package/dist/shell/app-shell.js +17 -2
  12. package/dist/shell/context-rail.d.ts +1 -15
  13. package/dist/shell/context-rail.js +61 -15
  14. package/dist/shell/icon-rail.js +1 -1
  15. package/dist/shell/index.d.ts +1 -6
  16. package/dist/shell/index.js +0 -5
  17. package/dist/shell/{mobile → internal}/mobile-bottom-nav.d.ts +9 -1
  18. package/dist/shell/{mobile → internal}/mobile-bottom-nav.js +5 -2
  19. package/dist/shell/{mobile → internal}/mobile-drawers.d.ts +7 -1
  20. package/dist/shell/{mobile → internal}/mobile-drawers.js +18 -4
  21. package/dist/shell/internal/mobile-header.js +22 -0
  22. package/dist/shell/layout-state.js +4 -1
  23. package/dist/shell/types.d.ts +35 -0
  24. package/dist/timeline/event-card.js +1 -1
  25. package/dist/timeline/live-indicator.js +1 -1
  26. package/dist/timeline/scrub-bar.js +1 -1
  27. package/package.json +5 -1
  28. package/dist/shell/mobile/mobile-header.js +0 -22
  29. package/dist/shell/navigation-area.d.ts +0 -4
  30. package/dist/shell/navigation-area.js +0 -4
  31. package/dist/shell/public.d.ts +0 -16
  32. package/dist/shell/public.js +0 -20
  33. package/dist/shell/shell-app-rail.d.ts +0 -18
  34. package/dist/shell/shell-app-rail.js +0 -27
  35. package/dist/shell/shell-auth-frame.d.ts +0 -22
  36. package/dist/shell/shell-auth-frame.js +0 -60
  37. package/dist/shell/shell-desktop-panel-dock.d.ts +0 -14
  38. package/dist/shell/shell-desktop-panel-dock.js +0 -43
  39. package/dist/shell/shell-frame.d.ts +0 -13
  40. package/dist/shell/shell-frame.js +0 -4
  41. package/dist/shell/shell-module-nav.d.ts +0 -29
  42. package/dist/shell/shell-module-nav.js +0 -16
  43. package/dist/shell/shell-panel-rail.d.ts +0 -9
  44. package/dist/shell/shell-panel-rail.js +0 -17
  45. package/dist/shell/shell-scrollable-content.d.ts +0 -9
  46. package/dist/shell/shell-scrollable-content.js +0 -7
  47. package/dist/shell/shell-state.d.ts +0 -39
  48. package/dist/shell/shell-state.js +0 -135
  49. package/dist/shell/shell-tab-bar.d.ts +0 -18
  50. package/dist/shell/shell-tab-bar.js +0 -27
  51. package/dist/shell/workbench-layout.d.ts +0 -10
  52. package/dist/shell/workbench-layout.js +0 -29
  53. package/dist/styles.css +0 -26
  54. /package/dist/shell/{mobile → internal}/mobile-header.d.ts +0 -0
@@ -1,135 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useEffect, useMemo, useRef, useState, } from 'react';
3
- export const DEFAULT_SIDE_PANEL_WIDTH = 360;
4
- export const MIN_SIDE_PANEL_WIDTH = 280;
5
- export const MAX_SIDE_PANEL_WIDTH = 520;
6
- const ShellStateContext = createContext(null);
7
- export function clampSidePanelWidth(width) {
8
- return Math.min(MAX_SIDE_PANEL_WIDTH, Math.max(MIN_SIDE_PANEL_WIDTH, width));
9
- }
10
- function readStoredSidePanelWidth(storageKey) {
11
- if (typeof window === 'undefined')
12
- return DEFAULT_SIDE_PANEL_WIDTH;
13
- const storedValue = typeof window.localStorage?.getItem === 'function'
14
- ? window.localStorage.getItem(storageKey)
15
- : null;
16
- const stored = Number(storedValue);
17
- return Number.isFinite(stored) && stored > 0
18
- ? clampSidePanelWidth(stored)
19
- : DEFAULT_SIDE_PANEL_WIDTH;
20
- }
21
- export function ShellStateProvider({ children, adapter, initialActiveRail = 'home', panelQueryParam = 'panel', selectionQueryParam = 'selection', sidePanelWidthStorageKey = 'meda.side-panel.width', }) {
22
- const { searchParams, setSearchParams } = adapter;
23
- const [sidePanelWidthState, setSidePanelWidthState] = useState(() => readStoredSidePanelWidth(sidePanelWidthStorageKey));
24
- const [activeRail, setActiveRail] = useState(initialActiveRail);
25
- const [commandPaletteOpen, setCommandPaletteOpen] = useState(false);
26
- const lastPanelViewRef = useRef(null);
27
- const persistTimerRef = useRef(undefined);
28
- const activePanelView = searchParams.get(panelQueryParam);
29
- const selectedEntityId = searchParams.get(selectionQueryParam);
30
- useEffect(() => {
31
- if (activePanelView) {
32
- lastPanelViewRef.current = activePanelView;
33
- }
34
- }, [activePanelView]);
35
- useEffect(() => {
36
- return () => {
37
- clearTimeout(persistTimerRef.current);
38
- };
39
- }, []);
40
- function updateSearchParams(mutate) {
41
- setSearchParams((currentSearchParams) => {
42
- const nextSearchParams = new URLSearchParams(currentSearchParams);
43
- mutate(nextSearchParams);
44
- return nextSearchParams;
45
- });
46
- }
47
- function setActivePanelView(view) {
48
- if (view) {
49
- lastPanelViewRef.current = view;
50
- }
51
- updateSearchParams((nextSearchParams) => {
52
- if (view) {
53
- nextSearchParams.set(panelQueryParam, view);
54
- }
55
- else {
56
- nextSearchParams.delete(panelQueryParam);
57
- }
58
- });
59
- }
60
- function closePanelView() {
61
- updateSearchParams((nextSearchParams) => {
62
- nextSearchParams.delete(panelQueryParam);
63
- });
64
- }
65
- function restoreLastPanelView(fallbackView) {
66
- const nextView = lastPanelViewRef.current ?? fallbackView;
67
- if (!nextView)
68
- return;
69
- setActivePanelView(nextView);
70
- }
71
- function setSidePanelWidth(width) {
72
- const nextWidth = clampSidePanelWidth(width);
73
- setSidePanelWidthState(nextWidth);
74
- clearTimeout(persistTimerRef.current);
75
- persistTimerRef.current = setTimeout(() => {
76
- if (typeof window !== 'undefined' && typeof window.localStorage?.setItem === 'function') {
77
- window.localStorage.setItem(sidePanelWidthStorageKey, String(nextWidth));
78
- }
79
- }, 300);
80
- }
81
- function togglePanelView(viewId) {
82
- if (activePanelView === viewId) {
83
- closePanelView();
84
- return;
85
- }
86
- setActivePanelView(viewId);
87
- }
88
- function selectEntity(entityId, options) {
89
- updateSearchParams((nextSearchParams) => {
90
- nextSearchParams.set(selectionQueryParam, entityId);
91
- if (options?.panelView) {
92
- nextSearchParams.set(panelQueryParam, options.panelView);
93
- }
94
- });
95
- }
96
- function clearEntity() {
97
- updateSearchParams((nextSearchParams) => {
98
- nextSearchParams.delete(selectionQueryParam);
99
- });
100
- }
101
- function openCommandPalette() {
102
- setCommandPaletteOpen(true);
103
- }
104
- function closeCommandPalette() {
105
- setCommandPaletteOpen(false);
106
- }
107
- // biome-ignore lint/correctness/useExhaustiveDependencies: inner setters/handlers are re-created each render; wrapping all of them in useCallback is a separate refactor — deps here are the observable state values only.
108
- const value = useMemo(() => ({
109
- activePanelView,
110
- lastPanelView: lastPanelViewRef.current,
111
- setActivePanelView,
112
- closePanelView,
113
- restoreLastPanelView,
114
- togglePanelView,
115
- sidePanelWidth: sidePanelWidthState,
116
- setSidePanelWidth,
117
- activeRail,
118
- setActiveRail,
119
- selectedEntityId,
120
- selectEntity,
121
- clearEntity,
122
- commandPaletteOpen,
123
- setCommandPaletteOpen,
124
- openCommandPalette,
125
- closeCommandPalette,
126
- }), [activePanelView, activeRail, commandPaletteOpen, selectedEntityId, sidePanelWidthState]);
127
- return _jsx(ShellStateContext.Provider, { value: value, children: children });
128
- }
129
- export function useShellState() {
130
- const context = useContext(ShellStateContext);
131
- if (!context) {
132
- throw new Error('useShellState must be used within a ShellStateProvider');
133
- }
134
- return context;
135
- }
@@ -1,18 +0,0 @@
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 {};
@@ -1,27 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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;
@@ -1,29 +0,0 @@
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
- }
package/dist/styles.css DELETED
@@ -1,26 +0,0 @@
1
- :root {
2
- --meda-shell-panel-dock-radius: var(--radius-4xl, 1.5rem);
3
- --meda-shell-panel-dock-shadow: var(--shadow-panel-elevated, 0 32px 90px rgb(0 0 0 / 0.45));
4
- }
5
-
6
- /* VoiceOrb (WebGL): minimal container styles — visual identity lives in the GLSL shader. */
7
- .meda-voice-orb {
8
- background: transparent;
9
- border: 0;
10
- padding: 0;
11
- isolation: isolate;
12
- overflow: hidden;
13
- border-radius: 9999px;
14
- cursor: pointer;
15
- position: relative;
16
- }
17
- .meda-voice-orb[disabled] {
18
- cursor: not-allowed;
19
- opacity: 0.6;
20
- }
21
- .meda-voice-orb canvas {
22
- display: block;
23
- width: 100% !important;
24
- height: 100% !important;
25
- pointer-events: none;
26
- }