@devframes/hub 0.9.7 → 0.9.9
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/client/index.d.mts +72 -51
- package/dist/client/index.mjs +119 -44
- package/dist/{constants-DrF61GFx.mjs → constants-BUd6oMci.mjs} +9 -8
- package/dist/{constants-C5t0DeZ0.d.mts → constants-Coo1p3ja.d.mts} +12 -9
- package/dist/constants.d.mts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{context-C3hUUCC1.mjs → context-D4L966cN.mjs} +233 -135
- package/dist/{context-D5JSW_X5.d.mts → context-Di-fhMKP.d.mts} +40 -18
- package/dist/{index-DhxIxS-Q.d.mts → index-faD2d5iX.d.mts} +2 -2
- package/dist/index.d.mts +4 -4
- package/dist/node/index.d.mts +28 -19
- package/dist/node/index.mjs +2 -2
- package/dist/node/initiate.d.mts +35 -30
- package/dist/node/initiate.mjs +80 -53
- package/dist/{remote-url-Bgc7gtsP.mjs → remote-url-UClKLQ5_.mjs} +34 -39
- package/dist/{settings-D7whfcx2.d.mts → settings-CWHPzCWS.d.mts} +65 -39
- package/dist/types/index.d.mts +4 -4
- package/package.json +6 -6
package/dist/client/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, t as DEFAULT_CATEGORIES_ORDER } from "../constants-
|
|
2
|
-
import { a as resolveClientModuleSpecifier, n as stripRemoteConnectionFromUrl, r as clientScriptFailureHint, t as buildRemoteConnectionUrl } from "../remote-url-
|
|
1
|
+
import { i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, t as DEFAULT_CATEGORIES_ORDER } from "../constants-BUd6oMci.mjs";
|
|
2
|
+
import { a as resolveClientModuleSpecifier, n as stripRemoteConnectionFromUrl, r as clientScriptFailureHint, t as buildRemoteConnectionUrl } from "../remote-url-UClKLQ5_.mjs";
|
|
3
3
|
import { REMOTE_CONNECTION_KEY } from "devframe/constants";
|
|
4
4
|
import { connectDevframe, getDevframeRpcClient, resolveWsUrl } from "devframe/client";
|
|
5
5
|
import { createEventEmitter } from "devframe/utils/events";
|
|
@@ -82,7 +82,7 @@ function watchFrameLocation(options) {
|
|
|
82
82
|
let disposed = false;
|
|
83
83
|
/**
|
|
84
84
|
* The frame's window, or `null` when its location can't be read. Touching
|
|
85
|
-
* `location.href` is the cross-origin probe
|
|
85
|
+
* `location.href` is the cross-origin probe, since it throws for a foreign
|
|
86
86
|
* document, where there is nothing to observe.
|
|
87
87
|
*/
|
|
88
88
|
function readableWindow() {
|
|
@@ -153,7 +153,7 @@ function watchFrameLocation(options) {
|
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region src/client/frame-nav.ts
|
|
155
155
|
/**
|
|
156
|
-
* Shared-iframe soft navigation
|
|
156
|
+
* Shared-iframe soft navigation: the hub-UI-provider-side half of a host-page↔iframe
|
|
157
157
|
* `postMessage` protocol.
|
|
158
158
|
*
|
|
159
159
|
* An {@link DevframeViewIframe.subTabs anchor} iframe dock owns one live iframe
|
|
@@ -169,7 +169,7 @@ function watchFrameLocation(options) {
|
|
|
169
169
|
* highlight to match.
|
|
170
170
|
*
|
|
171
171
|
* The protocol is server-free (works cross-origin and in static builds) and
|
|
172
|
-
* decoupled
|
|
172
|
+
* decoupled, so the embedded app takes no hub/RPC dependency, only the shim.
|
|
173
173
|
*/
|
|
174
174
|
/** `postMessage` channel tag shared by both halves of the protocol. */
|
|
175
175
|
const FRAME_NAV_CHANNEL = HUB_EVENTS.postMessage.frameNav;
|
|
@@ -341,17 +341,18 @@ function deriveFallbackUrl(base, navTarget) {
|
|
|
341
341
|
}
|
|
342
342
|
const path = navTarget.path.startsWith("#") ? navTarget.path.slice(1) : navTarget.path;
|
|
343
343
|
let hash = `#${path}`;
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
const params = new URLSearchParams();
|
|
347
|
-
for (const [key, value] of Object.entries(query)) if (typeof value === "string") params.set(key, value);
|
|
348
|
-
else for (const v of value) params.append(key, v);
|
|
349
|
-
const qs = params.toString();
|
|
350
|
-
if (qs) hash += (path.includes("?") ? "&" : "?") + qs;
|
|
351
|
-
}
|
|
344
|
+
const qs = navTarget.query ? serializeNavQuery(navTarget.query) : "";
|
|
345
|
+
if (qs) hash += (path.includes("?") ? "&" : "?") + qs;
|
|
352
346
|
url.hash = hash;
|
|
353
347
|
return url.toString();
|
|
354
348
|
}
|
|
349
|
+
/** Serialize a {@link NavTarget.query} into a URL query string. */
|
|
350
|
+
function serializeNavQuery(query) {
|
|
351
|
+
const params = new URLSearchParams();
|
|
352
|
+
for (const [key, value] of Object.entries(query)) if (typeof value === "string") params.set(key, value);
|
|
353
|
+
else for (const v of value) params.append(key, v);
|
|
354
|
+
return params.toString();
|
|
355
|
+
}
|
|
355
356
|
//#endregion
|
|
356
357
|
//#region src/client/messages.ts
|
|
357
358
|
/**
|
|
@@ -406,7 +407,7 @@ function createMessagesClient(rpc, options = {}) {
|
|
|
406
407
|
//#endregion
|
|
407
408
|
//#region src/client/renderers.ts
|
|
408
409
|
/**
|
|
409
|
-
* Build the {@link DockRenderersContext} shared by every hub-aware client
|
|
410
|
+
* Build the {@link DockRenderersContext} shared by every hub-aware client.
|
|
410
411
|
* `createDevframeClientRuntime` and hub UI providers that assemble their own context
|
|
411
412
|
* (`@devframes/hub-ui`) both delegate here so local-first resolution, lazy
|
|
412
413
|
* manifest imports, and the typed mount result behave identically everywhere.
|
|
@@ -504,7 +505,7 @@ const DOCKS_ACTIVATE_EVENT = HUB_EVENTS.broadcast.docksActivate;
|
|
|
504
505
|
* Boot the client runtime: connect RPC, assemble the full
|
|
505
506
|
* {@link DevframeClientContext} (panel, docks, commands, when) from the hub's
|
|
506
507
|
* shared state, publish it at `__DEVFRAME_HUB_CLIENT_CONTEXT__`, and load every
|
|
507
|
-
* dock entry's client script into this page
|
|
508
|
+
* dock entry's client script into this page, the devframe equivalent of the
|
|
508
509
|
* runtime `@vitejs/devtools-kit` injects into a host app.
|
|
509
510
|
*
|
|
510
511
|
* A hub UI provider keeps rendering its own dock UI (reading the same shared state); this
|
|
@@ -575,7 +576,7 @@ async function createDevframeClientRuntime(options = {}) {
|
|
|
575
576
|
type: "action",
|
|
576
577
|
handler: (activation) => activateHandler(activation)
|
|
577
578
|
});
|
|
578
|
-
if (getDevframeClientContext()) console.warn("[@devframes/hub] A client context is already published on this page
|
|
579
|
+
if (getDevframeClientContext()) console.warn("[@devframes/hub] A client context is already published on this page; replacing it. Boot createDevframeClientRuntime() once per page (e.g. HTML injection combined with a manual import boots it twice).");
|
|
579
580
|
setDevframeClientContext(context);
|
|
580
581
|
const loadedScripts = /* @__PURE__ */ new Set();
|
|
581
582
|
if (loadScriptsEnabled) {
|
|
@@ -678,6 +679,10 @@ async function createDevframeClientRuntime(options = {}) {
|
|
|
678
679
|
set selectedId(id) {
|
|
679
680
|
switchEntry(id);
|
|
680
681
|
},
|
|
682
|
+
/**
|
|
683
|
+
* A mirror of the session field, so a persisting host reads and writes the
|
|
684
|
+
* selected iframe's route through the same context every hub UI provider uses.
|
|
685
|
+
*/
|
|
681
686
|
get selectedRoute() {
|
|
682
687
|
return panel.session.selectedDockRoute;
|
|
683
688
|
},
|
|
@@ -696,14 +701,14 @@ async function createDevframeClientRuntime(options = {}) {
|
|
|
696
701
|
switchEntry,
|
|
697
702
|
toggleEntry: (id) => selectedId === id ? switchEntry(null) : switchEntry(id),
|
|
698
703
|
register(entry, force) {
|
|
699
|
-
if (clientDocks.has(entry.id) && !force) throw new Error(`[@devframes/hub] a client dock "${entry.id}" is already registered
|
|
704
|
+
if (clientDocks.has(entry.id) && !force) throw new Error(`[@devframes/hub] a client dock "${entry.id}" is already registered; pass force to overwrite`);
|
|
700
705
|
clientDocks.set(entry.id, entry);
|
|
701
706
|
refreshEntries();
|
|
702
707
|
return {
|
|
703
708
|
update: (patch) => {
|
|
704
709
|
if (patch.id && patch.id !== entry.id) throw new Error(`[@devframes/hub] cannot change a dock id ("${entry.id}" → "${patch.id}")`);
|
|
705
710
|
const existing = clientDocks.get(entry.id);
|
|
706
|
-
if (!existing) throw new Error(`[@devframes/hub] client dock "${entry.id}" was removed
|
|
711
|
+
if (!existing) throw new Error(`[@devframes/hub] client dock "${entry.id}" was removed; register it again to update`);
|
|
707
712
|
clientDocks.set(entry.id, {
|
|
708
713
|
...existing,
|
|
709
714
|
...patch
|
|
@@ -716,7 +721,7 @@ async function createDevframeClientRuntime(options = {}) {
|
|
|
716
721
|
};
|
|
717
722
|
},
|
|
718
723
|
update(entry) {
|
|
719
|
-
if (!clientDocks.has(entry.id)) throw new Error(`[@devframes/hub] no client dock "${entry.id}" to update
|
|
724
|
+
if (!clientDocks.has(entry.id)) throw new Error(`[@devframes/hub] no client dock "${entry.id}" to update; register it first`);
|
|
720
725
|
clientDocks.set(entry.id, entry);
|
|
721
726
|
refreshEntries();
|
|
722
727
|
}
|
|
@@ -739,7 +744,14 @@ async function createDevframeClientRuntime(options = {}) {
|
|
|
739
744
|
function allCommands() {
|
|
740
745
|
return [...commandsState.value(), ...clientCommands.values()];
|
|
741
746
|
}
|
|
742
|
-
|
|
747
|
+
function findCommand(commands, id) {
|
|
748
|
+
for (const command of commands) {
|
|
749
|
+
if (command.id === id) return command;
|
|
750
|
+
const child = findCommand(command.children ?? [], id);
|
|
751
|
+
if (child) return child;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
const ctx = {
|
|
743
755
|
get commands() {
|
|
744
756
|
return allCommands();
|
|
745
757
|
},
|
|
@@ -754,18 +766,24 @@ async function createDevframeClientRuntime(options = {}) {
|
|
|
754
766
|
};
|
|
755
767
|
},
|
|
756
768
|
async execute(id, ...args) {
|
|
757
|
-
const client = clientCommands.
|
|
758
|
-
if (client?.action) return client.action(...args);
|
|
769
|
+
const client = findCommand(clientCommands.values(), id);
|
|
770
|
+
if (client?.source === "client" && client.action) return client.action(...args);
|
|
759
771
|
return rpc.call("hub:commands:execute", id, ...args);
|
|
760
772
|
},
|
|
761
773
|
getKeybindings(id) {
|
|
762
774
|
const override = settings.value().commandShortcuts?.[id];
|
|
763
775
|
if (override) return override;
|
|
764
|
-
return allCommands()
|
|
776
|
+
return findCommand(allCommands(), id)?.keybindings ?? [];
|
|
765
777
|
},
|
|
766
778
|
settings,
|
|
767
|
-
paletteOpen: false
|
|
779
|
+
paletteOpen: false,
|
|
780
|
+
paletteScopeId: null,
|
|
781
|
+
openPalette(atCommandId) {
|
|
782
|
+
ctx.paletteScopeId = atCommandId ?? null;
|
|
783
|
+
ctx.paletteOpen = true;
|
|
784
|
+
}
|
|
768
785
|
};
|
|
786
|
+
return ctx;
|
|
769
787
|
}
|
|
770
788
|
function createRenderersContext() {
|
|
771
789
|
const mountedDisposers = /* @__PURE__ */ new Set();
|
|
@@ -833,11 +851,50 @@ function createPanelContext(clientType) {
|
|
|
833
851
|
position: "right",
|
|
834
852
|
inactiveTimeout: 0
|
|
835
853
|
};
|
|
854
|
+
let open = clientType === "standalone";
|
|
855
|
+
let selectedDockId = null;
|
|
856
|
+
const events = createEventEmitter();
|
|
857
|
+
let panelStateChangePending = false;
|
|
858
|
+
function createDockPanelState() {
|
|
859
|
+
const panelState = { state: open ? "open" : "closed" };
|
|
860
|
+
if (selectedDockId !== null) panelState.selectedDockId = selectedDockId;
|
|
861
|
+
return panelState;
|
|
862
|
+
}
|
|
863
|
+
let previousPanelState = createDockPanelState();
|
|
864
|
+
function schedulePanelStateChange() {
|
|
865
|
+
if (panelStateChangePending) return;
|
|
866
|
+
panelStateChangePending = true;
|
|
867
|
+
queueMicrotask(() => {
|
|
868
|
+
panelStateChangePending = false;
|
|
869
|
+
const panelState = createDockPanelState();
|
|
870
|
+
if (panelState.state === previousPanelState.state && panelState.selectedDockId === previousPanelState.selectedDockId) return;
|
|
871
|
+
previousPanelState = panelState;
|
|
872
|
+
events.emit(HUB_EVENTS.client.docksPanelStateChanged, panelState);
|
|
873
|
+
});
|
|
874
|
+
}
|
|
836
875
|
return {
|
|
876
|
+
get state() {
|
|
877
|
+
return createDockPanelState();
|
|
878
|
+
},
|
|
879
|
+
events,
|
|
837
880
|
store,
|
|
838
881
|
session: {
|
|
839
|
-
open
|
|
840
|
-
|
|
882
|
+
get open() {
|
|
883
|
+
return open;
|
|
884
|
+
},
|
|
885
|
+
set open(nextOpen) {
|
|
886
|
+
if (nextOpen === open) return;
|
|
887
|
+
open = nextOpen;
|
|
888
|
+
schedulePanelStateChange();
|
|
889
|
+
},
|
|
890
|
+
get selectedDockId() {
|
|
891
|
+
return selectedDockId;
|
|
892
|
+
},
|
|
893
|
+
set selectedDockId(nextSelectedDockId) {
|
|
894
|
+
if (nextSelectedDockId === selectedDockId) return;
|
|
895
|
+
selectedDockId = nextSelectedDockId;
|
|
896
|
+
schedulePanelStateChange();
|
|
897
|
+
},
|
|
841
898
|
selectedDockRoute: null
|
|
842
899
|
},
|
|
843
900
|
isDragging: false,
|
|
@@ -863,7 +920,7 @@ function groupByCategory(entries, categoryOrder) {
|
|
|
863
920
|
}
|
|
864
921
|
return [...groups.entries()].sort(([a], [b]) => (categoryOrder[a] ?? 0) - (categoryOrder[b] ?? 0));
|
|
865
922
|
}
|
|
866
|
-
/** @deprecated Renamed
|
|
923
|
+
/** @deprecated Renamed; use {@link createDevframeClientRuntime}. */
|
|
867
924
|
const createDevframeClientHost = createDevframeClientRuntime;
|
|
868
925
|
//#endregion
|
|
869
926
|
//#region src/client/remote.ts
|
|
@@ -923,22 +980,9 @@ function extractKeyFromQuery(search) {
|
|
|
923
980
|
* Throws if the descriptor is malformed or its schema version is unsupported.
|
|
924
981
|
*/
|
|
925
982
|
function parseRemoteConnection(input) {
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
if (typeof location === "undefined") return null;
|
|
930
|
-
hash = location.hash;
|
|
931
|
-
search = location.search;
|
|
932
|
-
} else try {
|
|
933
|
-
const parsed = new URL(input, "http://_");
|
|
934
|
-
hash = parsed.hash;
|
|
935
|
-
search = parsed.search;
|
|
936
|
-
} catch {
|
|
937
|
-
if (input.startsWith("#")) hash = input;
|
|
938
|
-
else if (input.startsWith("?")) search = input;
|
|
939
|
-
else return null;
|
|
940
|
-
}
|
|
941
|
-
const encoded = extractKeyFromFragment(hash) ?? extractKeyFromQuery(search);
|
|
983
|
+
const parts = resolveUrlParts(input);
|
|
984
|
+
if (!parts) return null;
|
|
985
|
+
const encoded = extractKeyFromFragment(parts.hash) ?? extractKeyFromQuery(parts.search);
|
|
942
986
|
if (!encoded) return null;
|
|
943
987
|
let payload;
|
|
944
988
|
try {
|
|
@@ -946,6 +990,37 @@ function parseRemoteConnection(input) {
|
|
|
946
990
|
} catch (cause) {
|
|
947
991
|
throw new Error("[@devframes/hub] Failed to decode remote connection descriptor.", { cause });
|
|
948
992
|
}
|
|
993
|
+
return validateConnectionDescriptor(payload);
|
|
994
|
+
}
|
|
995
|
+
/** Resolve the URL fragment/query to inspect, from an explicit input or `location`. */
|
|
996
|
+
function resolveUrlParts(input) {
|
|
997
|
+
if (input === void 0) {
|
|
998
|
+
if (typeof location === "undefined") return null;
|
|
999
|
+
return {
|
|
1000
|
+
hash: location.hash,
|
|
1001
|
+
search: location.search
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
try {
|
|
1005
|
+
const parsed = new URL(input, "http://_");
|
|
1006
|
+
return {
|
|
1007
|
+
hash: parsed.hash,
|
|
1008
|
+
search: parsed.search
|
|
1009
|
+
};
|
|
1010
|
+
} catch {
|
|
1011
|
+
if (input.startsWith("#")) return {
|
|
1012
|
+
hash: input,
|
|
1013
|
+
search: ""
|
|
1014
|
+
};
|
|
1015
|
+
if (input.startsWith("?")) return {
|
|
1016
|
+
hash: "",
|
|
1017
|
+
search: input
|
|
1018
|
+
};
|
|
1019
|
+
return null;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
/** Validate a decoded payload as a {@link RemoteConnectionInfo}, throwing on any mismatch. */
|
|
1023
|
+
function validateConnectionDescriptor(payload) {
|
|
949
1024
|
if (!payload || typeof payload !== "object") throw new Error("[@devframes/hub] Remote connection descriptor must be an object.");
|
|
950
1025
|
const info = payload;
|
|
951
1026
|
if (info.v !== 1) throw new Error(`[@devframes/hub] Unsupported remote connection descriptor version: ${String(info.v)}`);
|
|
@@ -959,7 +1034,7 @@ function parseRemoteConnection(input) {
|
|
|
959
1034
|
* the current URL and returns a connected {@link DevframeRpcClient}.
|
|
960
1035
|
*
|
|
961
1036
|
* Pairs with `remote: true` on a `DevframeViewIframe` registered on the node
|
|
962
|
-
* side
|
|
1037
|
+
* side, where the hub injects the descriptor into the iframe URL.
|
|
963
1038
|
*
|
|
964
1039
|
* @throws if no descriptor is present in the URL.
|
|
965
1040
|
*/
|
|
@@ -2,7 +2,7 @@ import { cleanDoubleSlashes, withLeadingSlash, withTrailingSlash } from "ufo";
|
|
|
2
2
|
//#region src/events.ts
|
|
3
3
|
/**
|
|
4
4
|
* Centralized registry of every event, broadcast, RPC method, shared-state
|
|
5
|
-
* key, and channel name the hub uses
|
|
5
|
+
* key, and channel name the hub uses: the single source of truth that keeps
|
|
6
6
|
* these names out of scattered string literals.
|
|
7
7
|
*
|
|
8
8
|
* **Keep this in sync with [`docs/content/8.references/3.events.md`](../../../docs/content/8.references/3.events.md)**
|
|
@@ -11,10 +11,9 @@ import { cleanDoubleSlashes, withLeadingSlash, withTrailingSlash } from "ufo";
|
|
|
11
11
|
* both places in the same change, and reference `HUB_EVENTS.*` from call sites
|
|
12
12
|
* instead of re-typing a literal.
|
|
13
13
|
*
|
|
14
|
-
* The `.events` EventEmitter maps
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* declarations mirror this map and move with it.
|
|
14
|
+
* The `.events` EventEmitter maps and RPC augmentation interfaces declare these
|
|
15
|
+
* same names as type-level keys (a literal is unavoidable in a type position);
|
|
16
|
+
* those declarations mirror this map and move with it.
|
|
18
17
|
*/
|
|
19
18
|
const HUB_EVENTS = {
|
|
20
19
|
/**
|
|
@@ -47,6 +46,8 @@ const HUB_EVENTS = {
|
|
|
47
46
|
terminalsRestart: "hub:terminals:restart",
|
|
48
47
|
terminalsRemove: "hub:terminals:remove"
|
|
49
48
|
},
|
|
49
|
+
/** Client-context events emitted inside the host page. */
|
|
50
|
+
client: { docksPanelStateChanged: "panel:state:changed" },
|
|
50
51
|
/** Broadcast notifications the server pushes to clients (server → client), `devframe:` prefix. */
|
|
51
52
|
broadcast: {
|
|
52
53
|
docksActivate: "devframe:docks:activate",
|
|
@@ -68,7 +69,7 @@ const HUB_EVENTS = {
|
|
|
68
69
|
};
|
|
69
70
|
//#endregion
|
|
70
71
|
//#region src/constants.ts
|
|
71
|
-
/** Default mount base for a hub instance
|
|
72
|
+
/** Default mount base for a hub instance: one namespace, one catch-all. */
|
|
72
73
|
const DEVFRAMES_HUB_BASE = "/__devframes/";
|
|
73
74
|
/**
|
|
74
75
|
* Normalize a hub mount base to an absolute path with leading and trailing
|
|
@@ -81,7 +82,7 @@ function normalizeHubBase(base) {
|
|
|
81
82
|
return cleanDoubleSlashes(withTrailingSlash(withLeadingSlash(base)));
|
|
82
83
|
}
|
|
83
84
|
/**
|
|
84
|
-
* The default ordering weight for each known dock category
|
|
85
|
+
* The default ordering weight for each known dock category, where lower sorts
|
|
85
86
|
* earlier. Downstream viewers (e.g. `@vitejs/devtools-kit`) import this as the
|
|
86
87
|
* single source of truth so the hub and its viewers agree on category order.
|
|
87
88
|
* `framework` sorts first; `~builtin` (the viewer's own built-in views) last.
|
|
@@ -103,7 +104,7 @@ const DEFAULT_CATEGORIES_ORDER = {
|
|
|
103
104
|
"~builtin": 1e3
|
|
104
105
|
};
|
|
105
106
|
/**
|
|
106
|
-
* Shared-state slot carrying the hub's renderer manifest
|
|
107
|
+
* Shared-state slot carrying the hub's renderer manifest: one
|
|
107
108
|
* {@link import('./client/renderers').DockRendererManifest} entry per dock
|
|
108
109
|
* `type`, published by `initHub({ renderers })` and consumed by every
|
|
109
110
|
* hub-aware client (the headless client host and viewers alike).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as DevframeDocksUserSettings } from "./settings-
|
|
1
|
+
import { t as DevframeDocksUserSettings } from "./settings-CWHPzCWS.mjs";
|
|
2
2
|
//#region src/events.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Centralized registry of every event, broadcast, RPC method, shared-state
|
|
5
|
-
* key, and channel name the hub uses
|
|
5
|
+
* key, and channel name the hub uses: the single source of truth that keeps
|
|
6
6
|
* these names out of scattered string literals.
|
|
7
7
|
*
|
|
8
8
|
* **Keep this in sync with [`docs/content/8.references/3.events.md`](../../../docs/content/8.references/3.events.md)**
|
|
@@ -11,10 +11,9 @@ import { t as DevframeDocksUserSettings } from "./settings-D7whfcx2.mjs";
|
|
|
11
11
|
* both places in the same change, and reference `HUB_EVENTS.*` from call sites
|
|
12
12
|
* instead of re-typing a literal.
|
|
13
13
|
*
|
|
14
|
-
* The `.events` EventEmitter maps
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* declarations mirror this map and move with it.
|
|
14
|
+
* The `.events` EventEmitter maps and RPC augmentation interfaces declare these
|
|
15
|
+
* same names as type-level keys (a literal is unavoidable in a type position);
|
|
16
|
+
* those declarations mirror this map and move with it.
|
|
18
17
|
*/
|
|
19
18
|
declare const HUB_EVENTS: {
|
|
20
19
|
/**
|
|
@@ -47,6 +46,10 @@ declare const HUB_EVENTS: {
|
|
|
47
46
|
readonly terminalsRestart: "hub:terminals:restart";
|
|
48
47
|
readonly terminalsRemove: "hub:terminals:remove";
|
|
49
48
|
};
|
|
49
|
+
/** Client-context events emitted inside the host page. */
|
|
50
|
+
readonly client: {
|
|
51
|
+
readonly docksPanelStateChanged: "panel:state:changed";
|
|
52
|
+
};
|
|
50
53
|
/** Broadcast notifications the server pushes to clients (server → client), `devframe:` prefix. */
|
|
51
54
|
readonly broadcast: {
|
|
52
55
|
readonly docksActivate: "devframe:docks:activate";
|
|
@@ -72,7 +75,7 @@ declare const HUB_EVENTS: {
|
|
|
72
75
|
};
|
|
73
76
|
//#endregion
|
|
74
77
|
//#region src/constants.d.ts
|
|
75
|
-
/** Default mount base for a hub instance
|
|
78
|
+
/** Default mount base for a hub instance: one namespace, one catch-all. */
|
|
76
79
|
declare const DEVFRAMES_HUB_BASE = "/__devframes/";
|
|
77
80
|
/**
|
|
78
81
|
* Normalize a hub mount base to an absolute path with leading and trailing
|
|
@@ -83,7 +86,7 @@ declare const DEVFRAMES_HUB_BASE = "/__devframes/";
|
|
|
83
86
|
*/
|
|
84
87
|
declare function normalizeHubBase(base: string): string;
|
|
85
88
|
/**
|
|
86
|
-
* The default ordering weight for each known dock category
|
|
89
|
+
* The default ordering weight for each known dock category, where lower sorts
|
|
87
90
|
* earlier. Downstream viewers (e.g. `@vitejs/devtools-kit`) import this as the
|
|
88
91
|
* single source of truth so the hub and its viewers agree on category order.
|
|
89
92
|
* `framework` sorts first; `~builtin` (the viewer's own built-in views) last.
|
|
@@ -94,7 +97,7 @@ declare function normalizeHubBase(base: string): string;
|
|
|
94
97
|
*/
|
|
95
98
|
declare const DEFAULT_CATEGORIES_ORDER: Record<string, number>;
|
|
96
99
|
/**
|
|
97
|
-
* Shared-state slot carrying the hub's renderer manifest
|
|
100
|
+
* Shared-state slot carrying the hub's renderer manifest: one
|
|
98
101
|
* {@link import('./client/renderers').DockRendererManifest} entry per dock
|
|
99
102
|
* `type`, published by `initHub({ renderers })` and consumed by every
|
|
100
103
|
* hub-aware client (the headless client host and viewers alike).
|
package/dist/constants.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, r as DEVFRAMES_HUB_BASE, t as DEFAULT_CATEGORIES_ORDER } from "./constants-
|
|
1
|
+
import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, r as DEVFRAMES_HUB_BASE, t as DEFAULT_CATEGORIES_ORDER } from "./constants-Coo1p3ja.mjs";
|
|
2
2
|
export * from "devframe/constants";
|
|
3
3
|
export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVFRAMES_HUB_BASE, DOCK_RENDERERS_STATE_KEY, HUB_EVENTS, normalizeHubBase };
|
package/dist/constants.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, r as DEVFRAMES_HUB_BASE, t as DEFAULT_CATEGORIES_ORDER } from "./constants-
|
|
1
|
+
import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, r as DEVFRAMES_HUB_BASE, t as DEFAULT_CATEGORIES_ORDER } from "./constants-BUd6oMci.mjs";
|
|
2
2
|
export * from "devframe/constants";
|
|
3
3
|
export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVFRAMES_HUB_BASE, DOCK_RENDERERS_STATE_KEY, HUB_EVENTS, normalizeHubBase };
|