@asymmetric-effort/specifyjs 0.2.140 → 0.2.143

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.
@@ -0,0 +1,60 @@
1
+ import type { SpecNode } from 'specifyjs';
2
+ export interface DragPayload<T = unknown> {
3
+ /** MIME-like type identifier (e.g., "application/project-card", "text/plain") */
4
+ type: string;
5
+ /** The dragged data */
6
+ data: T;
7
+ /** Source app ID */
8
+ sourceAppId: string;
9
+ /** Optional visual preview element */
10
+ preview?: unknown;
11
+ }
12
+ export interface DropZone {
13
+ /** Types this zone accepts */
14
+ acceptTypes: string[];
15
+ /** Called when a compatible drag enters the zone */
16
+ onDragEnter?: (payload: DragPayload) => void;
17
+ /** Called when drag leaves the zone */
18
+ onDragLeave?: () => void;
19
+ /** Called when a compatible payload is dropped */
20
+ onDrop: (payload: DragPayload) => void;
21
+ }
22
+ export interface DragDropContextValue {
23
+ /** Start dragging a payload */
24
+ startDrag(payload: DragPayload): void;
25
+ /** Cancel the current drag operation */
26
+ cancelDrag(): void;
27
+ /** Register a drop zone. Returns cleanup function. */
28
+ registerDropZone(zoneId: string, zone: DropZone): () => void;
29
+ /** Current drag state (null if no drag in progress) */
30
+ currentDrag: DragPayload | null;
31
+ /** Whether a drag is in progress */
32
+ isDragging: boolean;
33
+ }
34
+ export interface DragDropProviderProps {
35
+ children?: unknown;
36
+ }
37
+ export declare function DragDropProvider(props: DragDropProviderProps): SpecNode;
38
+ /**
39
+ * Access the drag-drop context.
40
+ */
41
+ export declare function useDragDrop(): DragDropContextValue;
42
+ /**
43
+ * Make an element draggable with a typed payload.
44
+ * Returns event handlers and state to attach to the draggable element.
45
+ */
46
+ export declare function useDraggable<T>(type: string, data: T): {
47
+ onMouseDown: (e: Event) => void;
48
+ isDragging: boolean;
49
+ };
50
+ /**
51
+ * Make an element a drop zone that accepts specific drag types.
52
+ * Returns state about the current drag interaction.
53
+ */
54
+ export declare function useDropZone(config: DropZone & {
55
+ zoneId?: string;
56
+ }): {
57
+ isOver: boolean;
58
+ canDrop: boolean;
59
+ zoneId: string;
60
+ };
@@ -0,0 +1,2 @@
1
+ export { DragDropProvider, useDragDrop, useDraggable, useDropZone, } from './DragDrop';
2
+ export type { DragPayload, DropZone, DragDropContextValue, DragDropProviderProps, } from './DragDrop';
@@ -0,0 +1,43 @@
1
+ import type { SpecNode } from 'specifyjs';
2
+ export interface AppMessage<T = unknown> {
3
+ /** Channel name (e.g., "clipboard", "data-update", "file-open") */
4
+ channel: string;
5
+ /** Sender app ID */
6
+ from: string;
7
+ /** Optional target app ID (null = broadcast) */
8
+ to?: string | null;
9
+ /** Message payload */
10
+ payload: T;
11
+ /** Timestamp */
12
+ timestamp: number;
13
+ }
14
+ export interface MessageBusContextValue {
15
+ /** Publish a message to a channel */
16
+ publish<T>(channel: string, payload: T, to?: string): void;
17
+ /** Subscribe to a channel. Returns unsubscribe function. */
18
+ subscribe<T>(channel: string, handler: (message: AppMessage<T>) => void): () => void;
19
+ /** Subscribe to all messages (for debugging/logging) */
20
+ subscribeAll(handler: (message: AppMessage) => void): () => void;
21
+ }
22
+ export interface MessageBusProviderProps {
23
+ children?: unknown;
24
+ }
25
+ export interface AppContextValue {
26
+ appId: string;
27
+ }
28
+ export interface AppContextProviderProps {
29
+ appId: string;
30
+ children?: unknown;
31
+ }
32
+ export declare function AppContextProvider(props: AppContextProviderProps): SpecNode;
33
+ export declare function useAppId(): string;
34
+ export declare function MessageBusProvider(props: MessageBusProviderProps): SpecNode;
35
+ /**
36
+ * Access the message bus context. Wraps publish and subscribe to
37
+ * automatically inject the current app's ID.
38
+ */
39
+ export declare function useMessageBus(): MessageBusContextValue;
40
+ /**
41
+ * Convenience hook for subscribing to a channel with auto-cleanup.
42
+ */
43
+ export declare function useChannel<T>(channel: string, handler: (message: AppMessage<T>) => void): void;
@@ -0,0 +1,2 @@
1
+ export { MessageBusProvider, useMessageBus, useChannel, AppContextProvider, useAppId, } from './MessageBus';
2
+ export type { AppMessage, MessageBusContextValue, MessageBusProviderProps, AppContextValue, AppContextProviderProps, } from './MessageBus';
@@ -1,4 +1,26 @@
1
1
  import type { SpecNode } from 'specifyjs';
2
+ export interface AppMenuItem {
3
+ label?: string;
4
+ onClick?: () => void;
5
+ shortcut?: string;
6
+ disabled?: boolean;
7
+ divider?: boolean;
8
+ children?: AppMenuItem[];
9
+ checked?: boolean;
10
+ }
11
+ export interface AppMenu {
12
+ label: string;
13
+ items: AppMenuItem[];
14
+ }
15
+ export interface AppMenuBar {
16
+ menus: AppMenu[];
17
+ }
18
+ export interface DockSignal {
19
+ badge?: number | null;
20
+ progress?: number | null;
21
+ urgent?: boolean;
22
+ tooltip?: string;
23
+ }
2
24
  export interface WindowState {
3
25
  /** Unique window identifier */
4
26
  id: string;
@@ -71,6 +93,16 @@ export interface WindowManagerContextValue {
71
93
  minimizeAll(): void;
72
94
  /** Currently focused window ID, or null */
73
95
  focusedWindowId: string | null;
96
+ /** Register or update a menu bar for an app */
97
+ setMenuBar(appId: string, menuBar: AppMenuBar): void;
98
+ /** Clear (deregister) a menu bar for an app */
99
+ clearMenuBar(appId: string): void;
100
+ /** The active (focused) app's menu bar, or null */
101
+ activeMenuBar: AppMenuBar | null;
102
+ /** Send a dock signal (badge, progress, urgent, tooltip) from an app */
103
+ signalDock(appId: string, signal: DockSignal): void;
104
+ /** Current dock signals keyed by app ID */
105
+ dockSignals: Map<string, DockSignal>;
74
106
  }
75
107
  export interface WindowManagerProps {
76
108
  /** Workspace bounds */
@@ -1,2 +1,2 @@
1
1
  export { WindowManagerProvider, useWindowManager } from './WindowManager';
2
- export type { WindowState, WindowManagerContextValue, WindowManagerProps } from './WindowManager';
2
+ export type { WindowState, WindowManagerContextValue, WindowManagerProps, AppMenuBar, AppMenu, AppMenuItem, DockSignal, } from './WindowManager';
@@ -19,6 +19,10 @@ export interface DockItem {
19
19
  badge?: number;
20
20
  /** Whether this icon is disabled (greyed out, non-clickable). Default: false */
21
21
  disabled?: boolean;
22
+ /** Optional progress bar (0-1). Renders a thin bar at the bottom of the icon. */
23
+ progress?: number;
24
+ /** Whether to animate (pulse/bounce) the icon to request attention. Default: false */
25
+ urgent?: boolean;
22
26
  }
23
27
  export interface DockProps {
24
28
  /** The dock items to display */
@@ -14,6 +14,27 @@ export interface SystemTrayUser {
14
14
  /** Avatar URL or emoji fallback */
15
15
  avatar?: string;
16
16
  }
17
+ export interface AppMenuBarDef {
18
+ menus: Array<{
19
+ label: string;
20
+ items: Array<{
21
+ label?: string;
22
+ onClick?: () => void;
23
+ shortcut?: string;
24
+ disabled?: boolean;
25
+ divider?: boolean;
26
+ children?: Array<{
27
+ label?: string;
28
+ onClick?: () => void;
29
+ shortcut?: string;
30
+ disabled?: boolean;
31
+ divider?: boolean;
32
+ checked?: boolean;
33
+ }>;
34
+ checked?: boolean;
35
+ }>;
36
+ }>;
37
+ }
17
38
  export interface SystemTrayProps {
18
39
  /** Text shown on the left -- typically the active application name */
19
40
  activeAppName?: string;
@@ -22,6 +43,8 @@ export interface SystemTrayProps {
22
43
  label: string;
23
44
  onClick: () => void;
24
45
  };
46
+ /** App menu bar from the focused application */
47
+ appMenuBar?: AppMenuBarDef;
25
48
  /** Clock format. Default: '24h'. Options: '12h', '24h' */
26
49
  clockFormat?: '12h' | '24h';
27
50
  /** Whether to show seconds in the clock. Default: true */
@@ -1,2 +1,2 @@
1
1
  export { SystemTray } from './SystemTray';
2
- export type { SystemTrayProps, SystemTrayIndicator, SystemTrayUser, } from './SystemTray';
2
+ export type { SystemTrayProps, SystemTrayIndicator, SystemTrayUser, AppMenuBarDef, } from './SystemTray';
@@ -1,3 +1,4 @@
1
+ import type { AppMenuBar } from '../../../layout/window-manager/src/index';
1
2
  export interface UnityAppProps {
2
3
  /** Unique identifier for this app window */
3
4
  id: string;
@@ -24,6 +25,12 @@ export interface UnityAppProps {
24
25
  resizable?: boolean;
25
26
  /** Called when the window is closed */
26
27
  onClose?: () => void;
28
+ /** Menu bar definition; registered with WindowManager when provided */
29
+ menuBar?: AppMenuBar;
30
+ /** Called when this window gains focus */
31
+ onActivate?: () => void;
32
+ /** Called when this window loses focus */
33
+ onDeactivate?: () => void;
27
34
  /** Application content */
28
35
  children?: unknown;
29
36
  }
@@ -2,3 +2,7 @@ export { UnityDesktop } from './UnityDesktop';
2
2
  export type { UnityDesktopProps, UnityDesktopApp, UnityDesktopUser, ToastNotification } from './UnityDesktop';
3
3
  export { UnityApp } from './UnityApp';
4
4
  export type { UnityAppProps } from './UnityApp';
5
+ export { MessageBusProvider, useMessageBus, useChannel, AppContextProvider, useAppId, } from '../../../layout/app-message-bus/src/index';
6
+ export type { AppMessage, MessageBusContextValue, AppContextValue, } from '../../../layout/app-message-bus/src/index';
7
+ export { DragDropProvider, useDragDrop, useDraggable, useDropZone, } from '../../../layout/app-drag-drop/src/index';
8
+ export type { DragPayload, DropZone, DragDropContextValue, } from '../../../layout/app-drag-drop/src/index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asymmetric-effort/specifyjs",
3
- "version": "0.2.140",
3
+ "version": "0.2.143",
4
4
  "description": "A declarative TypeScript UI framework built for performance and simplicity",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -95,7 +95,7 @@
95
95
  ],
96
96
  "license": "MIT",
97
97
  "devDependencies": {
98
- "@asymmetric-effort/nogginlessdom": "^0.0.16",
98
+ "@asymmetric-effort/nogginlessdom": "^0.0.22",
99
99
  "@playwright/test": "^1.59.0",
100
100
  "@types/node": "^25.6.2",
101
101
  "@typescript-eslint/eslint-plugin": "^8.0.0",