@devframes/hub 0.5.1 → 0.5.2

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,131 @@
1
+ import { EventEmitter } from "devframe/types";
2
+
3
+ //#region src/types/commands.d.ts
4
+ interface DevframeCommandKeybinding {
5
+ /**
6
+ * Keyboard shortcut string.
7
+ * Use "Mod" for platform-aware modifier (Cmd on macOS, Ctrl elsewhere).
8
+ * Examples: "Mod+K", "Mod+Shift+P", "Alt+N"
9
+ */
10
+ key: string;
11
+ }
12
+ interface DevframeCommandBase {
13
+ /**
14
+ * Unique namespaced ID, e.g. "vite:open-in-editor"
15
+ */
16
+ id: string;
17
+ title: string;
18
+ description?: string;
19
+ /**
20
+ * Iconify icon string, e.g. "ph:pencil-duotone"
21
+ */
22
+ icon?: string;
23
+ category?: string;
24
+ /**
25
+ * Whether to show in command palette. Default: true
26
+ *
27
+ * - `true` — show the command and flatten its children into search results
28
+ * - `false` — hide the command entirely from the palette
29
+ * - `'without-children'` — show the command but don't flatten children into top-level search (children are still accessible via drill-down)
30
+ */
31
+ showInPalette?: boolean | 'without-children';
32
+ /**
33
+ * Optional context expression for conditional visibility.
34
+ * When set, the command is only shown in the palette and only executable
35
+ * when the expression evaluates to true.
36
+ */
37
+ when?: string;
38
+ /**
39
+ * Default keyboard shortcut(s) for this command
40
+ */
41
+ keybindings?: DevframeCommandKeybinding[];
42
+ }
43
+ /**
44
+ * Server command input — what plugins pass to `ctx.commands.register()`.
45
+ */
46
+ interface DevframeServerCommandInput extends DevframeCommandBase {
47
+ /**
48
+ * Handler for this command. Optional if the command only serves as a group for children.
49
+ */
50
+ handler?: (...args: any[]) => any | Promise<any>;
51
+ /**
52
+ * Static sub-commands. Two levels max (parent → children).
53
+ * Each child must have a globally unique `id`.
54
+ */
55
+ children?: DevframeServerCommandInput[];
56
+ }
57
+ /**
58
+ * Serializable server command entry — sent over RPC (no handler).
59
+ */
60
+ interface DevframeServerCommandEntry extends DevframeCommandBase {
61
+ source: 'server';
62
+ children?: DevframeServerCommandEntry[];
63
+ }
64
+ /**
65
+ * Client command — registered in the webcomponent context.
66
+ */
67
+ interface DevframeClientCommand extends DevframeCommandBase {
68
+ source: 'client';
69
+ /**
70
+ * Action for this command. Optional if the command only serves as a group for children.
71
+ * Return sub-commands for dynamic nested palette menus (runtime submenus).
72
+ */
73
+ action?: (...args: any[]) => void | DevframeClientCommand[] | Promise<void | DevframeClientCommand[]>;
74
+ /**
75
+ * Static sub-commands. Two levels max (parent → children).
76
+ */
77
+ children?: DevframeClientCommand[];
78
+ }
79
+ /**
80
+ * Union of command entries visible in the palette.
81
+ */
82
+ type DevframeCommandEntry = DevframeServerCommandEntry | DevframeClientCommand;
83
+ interface DevframeCommandHandle {
84
+ readonly id: string;
85
+ update: (patch: Partial<Omit<DevframeServerCommandInput, 'id'>>) => void;
86
+ unregister: () => void;
87
+ }
88
+ interface DevframeCommandsHostEvents {
89
+ 'command:registered': (command: DevframeServerCommandEntry) => void;
90
+ 'command:unregistered': (id: string) => void;
91
+ }
92
+ interface DevframeCommandsHost {
93
+ readonly commands: Map<string, DevframeServerCommandInput>;
94
+ readonly events: EventEmitter<DevframeCommandsHostEvents>;
95
+ /**
96
+ * Register a command (with optional children).
97
+ */
98
+ register: (command: DevframeServerCommandInput) => DevframeCommandHandle;
99
+ /**
100
+ * Unregister a command by ID (removes parent and all children).
101
+ */
102
+ unregister: (id: string) => boolean;
103
+ /**
104
+ * Execute a command by ID. Searches top-level and children.
105
+ * Throws if not found or if command has no handler.
106
+ */
107
+ execute: (id: string, ...args: any[]) => Promise<unknown>;
108
+ /**
109
+ * Returns serializable list (no handlers), preserving tree structure.
110
+ */
111
+ list: () => DevframeServerCommandEntry[];
112
+ }
113
+ interface DevframeCommandShortcutOverrides {
114
+ /**
115
+ * Command ID → keybinding overrides. Empty array = shortcut disabled.
116
+ */
117
+ [commandId: string]: DevframeCommandKeybinding[];
118
+ }
119
+ //#endregion
120
+ //#region src/types/settings.d.ts
121
+ interface DevframeDocksUserSettings {
122
+ docksHidden: string[];
123
+ docksCategoriesHidden: string[];
124
+ docksPinned: string[];
125
+ docksCustomOrder: Record<string, number>;
126
+ showIframeAddressBar: boolean;
127
+ closeOnOutsideClick: boolean;
128
+ commandShortcuts: DevframeCommandShortcutOverrides;
129
+ }
130
+ //#endregion
131
+ export { DevframeCommandHandle as a, DevframeCommandsHost as c, DevframeServerCommandInput as d, DevframeCommandEntry as i, DevframeCommandsHostEvents as l, DevframeClientCommand as n, DevframeCommandKeybinding as o, DevframeCommandBase as r, DevframeCommandShortcutOverrides as s, DevframeDocksUserSettings as t, DevframeServerCommandEntry as u };
@@ -0,0 +1,4 @@
1
+ import { A as DevframeMessageElementPosition, C as DevframeViewLauncher, D as JsonRenderElement, E as RemoteDockOptions, F as DevframeMessageHandle, I as DevframeMessageLevel, L as DevframeMessagesClient, M as DevframeMessageEntryFrom, N as DevframeMessageEntryInput, O as JsonRenderSpec, P as DevframeMessageFilePosition, R as DevframeMessagesHost, S as DevframeViewJsonRender, T as RemoteConnectionInfo, _ as DevframeDocksHost, a as DevframeChildProcessTerminalSession, b as DevframeViewCustomRender, c as DevframeTerminalStatus, d as DevframeDockEntriesGrouped, f as DevframeDockEntry, g as DevframeDockUserEntry, h as DevframeDockEntryIcon, i as DevframeChildProcessExecuteOptions, j as DevframeMessageEntry, k as JsonRenderer, l as DevframeTerminalsHost, m as DevframeDockEntryCategory, n as DevframeHubContext, o as DevframeTerminalSession, p as DevframeDockEntryBase, s as DevframeTerminalSessionBase, t as CreateHubContextOptions, u as ClientScriptEntry, v as DevframeViewAction, w as DevframeViewLauncherStatus, x as DevframeViewIframe, y as DevframeViewBuiltin } from "../context-BGXfnFEd.mjs";
2
+ import { a as DevframeCommandHandle, c as DevframeCommandsHost, d as DevframeServerCommandInput, i as DevframeCommandEntry, l as DevframeCommandsHostEvents, n as DevframeClientCommand, o as DevframeCommandKeybinding, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry } from "../settings-Bp5Ax6Os.mjs";
3
+ import { C as RpcStreamingChannel, E as Thenable, S as RpcSharedStateHost, T as RpcStreamingHost, _ as RpcBroadcastOptions, a as DevframeDiagnosticsLogger, b as RpcFunctionsHost, c as DevframeRpcClientFunctions, d as DevframeViewHost, f as EntriesToObject, g as PartialWithoutId, h as EventsMap, i as DevframeDiagnosticsHost, l as DevframeRpcServerFunctions, m as EventUnsubscribe, n as DevframeCapabilities, o as DevframeHost, p as EventEmitter, r as DevframeDiagnosticsDefinition, s as DevframeNodeRpcSession, t as ConnectionMeta, u as DevframeRpcSharedStates, v as RpcDefinitionsFilter, w as RpcStreamingChannelOptions, x as RpcSharedStateGetOptions, y as RpcDefinitionsToFunctions } from "../index-BWTfvdqa.mjs";
4
+ export { ClientScriptEntry, ConnectionMeta, CreateHubContextOptions, DevframeCapabilities, DevframeChildProcessExecuteOptions, DevframeChildProcessTerminalSession, DevframeClientCommand, DevframeCommandBase, DevframeCommandEntry, DevframeCommandHandle, DevframeCommandKeybinding, DevframeCommandShortcutOverrides, DevframeCommandsHost, DevframeCommandsHostEvents, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockEntriesGrouped, DevframeDockEntry, DevframeDockEntryBase, DevframeDockEntryCategory, DevframeDockEntryIcon, DevframeDockUserEntry, DevframeDocksHost, DevframeDocksUserSettings, DevframeHost, DevframeHubContext, DevframeMessageElementPosition, DevframeMessageEntry, DevframeMessageEntryFrom, DevframeMessageEntryInput, DevframeMessageFilePosition, DevframeMessageHandle, DevframeMessageLevel, DevframeMessagesClient, DevframeMessagesHost, DevframeNodeRpcSession, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeServerCommandEntry, DevframeServerCommandInput, DevframeTerminalSession, DevframeTerminalSessionBase, DevframeTerminalStatus, DevframeTerminalsHost, DevframeViewAction, DevframeViewBuiltin, DevframeViewCustomRender, DevframeViewHost, DevframeViewIframe, DevframeViewJsonRender, DevframeViewLauncher, DevframeViewLauncherStatus, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, JsonRenderElement, JsonRenderSpec, JsonRenderer, PartialWithoutId, RemoteConnectionInfo, RemoteDockOptions, RpcBroadcastOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable };
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@devframes/hub",
3
3
  "type": "module",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "description": "Framework-neutral hub layer for devframe — docks, terminals, messages, commands.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "peerDependencies": {
36
- "devframe": "0.5.1"
36
+ "devframe": "0.5.2"
37
37
  },
38
38
  "dependencies": {
39
39
  "birpc": "^4.0.0",
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "mlly": "^1.8.2",
47
47
  "tsdown": "^0.22.0",
48
- "devframe": "0.5.1"
48
+ "devframe": "0.5.2"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsdown",