Skip to content

Commit c94c198

Browse files
committed
chore: update fields
1 parent 43f1198 commit c94c198

9 files changed

Lines changed: 51 additions & 35 deletions

File tree

‎packages/hub-ui/src/client/components/views/ViewIframe.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ onMounted(() => {
252252
const panelSession = props.context.panel.session
253253
watchEffect(() => {
254254
if (props.context.docks.selectedId === props.entry.id)
255-
panelSession.route = currentUrl.value
255+
panelSession.selectedDockRoute = currentUrl.value
256256
})
257257
258258
// Listen for iframe load events

‎packages/hub-ui/src/client/state/context.ts‎

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,27 @@ export async function createDocksContext(
8383
// the live session state. Re-applied once the RPC becomes trusted so a reload
8484
// lands back on the same dock — see the restore effect near the end.
8585
const restoreIntent = {
86-
open: sessionStore.value.open,
87-
selectedId: sessionStore.value.selectedId,
88-
route: sessionStore.value.route,
86+
...sessionStore.value,
8987
}
9088

91-
// `selectedId` is backed by the session store so the current selection both
89+
// `selectedDockId` is backed by the session store so the current selection both
9290
// drives the UI and persists across reloads through one source of truth.
93-
const selectedId = computed<string | null>({
94-
get: () => sessionStore.value.selectedId,
91+
const selectedDockId = computed<string | null>({
92+
get: () => sessionStore.value.selectedDockId,
9593
set: (id) => {
96-
sessionStore.value.selectedId = id
94+
sessionStore.value.selectedDockId = id
9795
},
9896
})
97+
const selectedDockRoute = computed<string | null>({
98+
get: () => sessionStore.value.selectedDockRoute,
99+
set: (route) => {
100+
sessionStore.value.selectedDockRoute = route
101+
},
102+
})
103+
99104
const selected = computed(
100-
() => entries.value.find(entry => entry.id === selectedId.value)
101-
?? BUILTIN_ENTRIES.find(entry => entry.id === selectedId.value)
105+
() => entries.value.find(entry => entry.id === selectedDockId.value)
106+
?? BUILTIN_ENTRIES.find(entry => entry.id === selectedDockId.value)
102107
?? null,
103108
)
104109

@@ -142,8 +147,8 @@ export async function createDocksContext(
142147
// Clearing the selection when the active member vanishes matches the
143148
// hub reconcile behavior for a removed selected entry (shared-iframe
144149
// soft-nav §7.5).
145-
if (selectedId.value === entry.id)
146-
selectedId.value = null
150+
if (selectedDockId.value === entry.id)
151+
selectedDockId.value = null
147152
},
148153
}
149154
}
@@ -179,7 +184,7 @@ export async function createDocksContext(
179184
clientType,
180185
dockOpen: sessionStore.value.open,
181186
paletteOpen: commandsContext?.paletteOpen ?? false,
182-
dockSelectedId: selectedId.value ?? '',
187+
dockSelectedId: selectedDockId.value ?? '',
183188
popupOpen: isDockPopupOpen.value,
184189
})
185190

@@ -195,13 +200,13 @@ export async function createDocksContext(
195200

196201
const switchEntry = async (id: string | null = null) => {
197202
if (id == null) {
198-
selectedId.value = null
203+
selectedDockId.value = null
199204
sessionStore.value.open = false
200-
sessionStore.value.route = null
205+
sessionStore.value.selectedDockRoute = null
201206
return true
202207
}
203208
if (id === '~client-auth-notice') {
204-
selectedId.value = id
209+
selectedDockId.value = id
205210
sessionStore.value.open = true
206211
return true
207212
}
@@ -268,18 +273,18 @@ export async function createDocksContext(
268273
if (entry.type === 'iframe' && entry.frameId && !entry.subTabs)
269274
frameNavCurrentMember.set(entry.frameId, entry.id)
270275

271-
selectedId.value = entry.id
276+
selectedDockId.value = entry.id
272277
sessionStore.value.open = true
273278
// Only an iframe dock owns an address-bar route; ViewIframe keeps
274279
// `session.route` current for it. Clear it for anything else so a stale
275280
// route from a previous iframe isn't persisted against a non-iframe dock.
276281
if (entry.type !== 'iframe')
277-
sessionStore.value.route = null
282+
sessionStore.value.selectedDockRoute = null
278283
return true
279284
}
280285

281286
const toggleEntry = async (id: string) => {
282-
if (selectedId.value === id)
287+
if (selectedDockId.value === id)
283288
return switchEntry(null)
284289
return switchEntry(id)
285290
}
@@ -415,7 +420,7 @@ export async function createDocksContext(
415420
keybindings: [{ key: 'Escape' }],
416421
action: () => {
417422
sessionStore.value.open = false
418-
selectedId.value = null
423+
selectedDockId.value = null
419424
},
420425
},
421426
{
@@ -533,9 +538,9 @@ export async function createDocksContext(
533538
// One-shot boot route (see `DocksPanelContext.consumeBootRoute`): the persisted
534539
// address-bar URL is handed back to exactly the iframe dock that was selected
535540
// before the reload, once.
536-
let bootRoute: string | null = restoreIntent.selectedId != null ? restoreIntent.route : null
541+
let bootRoute: string | null = restoreIntent.selectedDockId != null ? restoreIntent.selectedDockRoute : null
537542
const consumeBootRoute = (id: string): string | null => {
538-
if (bootRoute != null && id === restoreIntent.selectedId) {
543+
if (bootRoute != null && id === restoreIntent.selectedDockId) {
539544
const route = bootRoute
540545
bootRoute = null
541546
return route
@@ -553,7 +558,8 @@ export async function createDocksContext(
553558
consumeBootRoute,
554559
},
555560
docks: {
556-
selectedId,
561+
selectedId: selectedDockId,
562+
selectedRoute: selectedDockRoute,
557563
selected,
558564
entries,
559565
entryToStateMap: markRaw(dockEntryStateMap),
@@ -604,8 +610,8 @@ export async function createDocksContext(
604610
// open. `switchEntry` reads `session.route` back through `consumeBootRoute`
605611
// when the restored iframe boots.
606612
const applyRestore = (): void => {
607-
if (restoreIntent.open && restoreIntent.selectedId != null)
608-
void switchEntry(restoreIntent.selectedId)
613+
if (restoreIntent.open && restoreIntent.selectedDockId != null)
614+
void switchEntry(restoreIntent.selectedDockId)
609615
}
610616
if (rpc.isTrusted) {
611617
applyRestore()

‎packages/hub-ui/src/client/state/docks.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function DEFAULT_DOCK_SESSION_STORE(): DockSessionStorage {
2828
return {
2929
open: false,
3030
selectedId: null,
31-
route: null,
31+
selectedDockRoute: null,
3232
}
3333
}
3434

‎packages/hub/src/client/docks.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ export interface DockSessionStorage {
3333
/** Whether the dock panel is open. */
3434
open: boolean
3535
/** The currently selected dock entry id, or `null` when nothing is open. */
36-
selectedId: string | null
36+
selectedDockId: string | null
3737
/**
3838
* The live address-bar URL of the selected iframe dock, restored as that
3939
* iframe's boot `src` on the next load so the deep-linked route survives a
4040
* reload. `null` when the selected dock has no iframe route to remember.
4141
*/
42-
route: string | null
42+
selectedDockRoute: string | null
4343
}
4444

4545
export type DockClientType = 'embedded' | 'standalone'
@@ -117,18 +117,19 @@ export interface DocksPanelContext {
117117
isResizing: boolean
118118
readonly isVertical: boolean
119119
/**
120-
* Claim the persisted {@link DockSessionStorage.route boot route} for a dock
120+
* Claim the persisted {@link DockSessionStorage.selectedDockRoute boot route} for a dock
121121
* id, once. Returns the saved address-bar URL only for the dock that was
122122
* selected before the last reload — and only on the first call for it — so a
123123
* restored iframe boots deep-linked while a later switch to a different dock
124-
* (whose live route isn't reflected in {@link DockSessionStorage.route} yet)
124+
* (whose live route isn't reflected in {@link DockSessionStorage.selectedDockRoute} yet)
125125
* doesn't reuse the stale value. Returns `null` otherwise.
126126
*/
127127
consumeBootRoute?: (id: string) => string | null
128128
}
129129

130130
export interface DocksEntriesContext {
131131
selectedId: string | null
132+
selectedRoute: string | null
132133
readonly selected: DevframeDockEntry | null
133134
entries: DevframeDockEntry[]
134135
entryToStateMap: Map<string, DockEntryState>

‎packages/hub/src/client/host.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ export async function createDevframeClientHost(
332332
docks.groupedEntries = groupByCategory(entries, categoryOrder)
333333
if (selectedId && !entryToStateMap.has(selectedId)) {
334334
selectedId = null
335-
panel.session.selectedId = null
335+
panel.session.selectedDockId = null
336336
}
337337
}
338338

@@ -397,7 +397,7 @@ export async function createDevframeClientHost(
397397
selectedId = next
398398
// Mirror onto the session context so a persisting host and the when-clause
399399
// context see the current selection.
400-
panel.session.selectedId = next
400+
panel.session.selectedDockId = next
401401
if (previous)
402402
entryToStateMap.get(previous)?.events.emit('entry:deactivated')
403403
if (next)
@@ -526,8 +526,8 @@ function createPanelContext(clientType: DockClientType): DocksPanelContext {
526526
const session: DocksPanelContext['session'] = {
527527
// A standalone runtime owns the page, so its "panel" is always open.
528528
open: clientType === 'standalone',
529-
selectedId: null,
530-
route: null,
529+
selectedDockId: null,
530+
selectedDockRoute: null,
531531
}
532532
return {
533533
store,

‎tests/__snapshots__/tsnapi/devframe/constants.snapshot.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export declare const DEVFRAME_CONNECTION_META_FILENAME: string;
1313
export declare const DEVFRAME_DOCK_IMPORTS_FILENAME: string;
1414
export declare const DEVFRAME_MCP_ROUTE: string;
1515
export declare const DEVFRAME_OTP_URL_PARAM: string;
16+
export declare const DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE: string;
1617
export declare const DEVFRAME_RPC_DUMP_DIRNAME: string;
1718
export declare const DEVFRAME_RPC_DUMP_MANIFEST_FILENAME: string;
1819
export declare const DEVFRAME_SSE_ROUTE: string;

‎tests/__snapshots__/tsnapi/devframe/constants.snapshot.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export var DEVFRAME_CONNECTION_META_FILENAME /* const */
1313
export var DEVFRAME_DOCK_IMPORTS_FILENAME /* const */
1414
export var DEVFRAME_MCP_ROUTE /* const */
1515
export var DEVFRAME_OTP_URL_PARAM /* const */
16+
export var DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE /* const */
1617
export var DEVFRAME_RPC_DUMP_DIRNAME /* const */
1718
export var DEVFRAME_RPC_DUMP_MANIFEST_FILENAME /* const */
1819
export var DEVFRAME_SSE_ROUTE /* const */

‎tests/__snapshots__/tsnapi/devframe/index.snapshot.d.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,16 @@ export interface RemoteAssets {
356356
version: string;
357357
path?: string;
358358
provider?: RemoteAssetsProvider;
359-
resolveFrom?: string;
359+
resolveFrom?: string | null;
360360
fetch?: typeof globalThis.fetch;
361361
offline?: boolean;
362362
}
363+
export interface RemoteAssetsErrorMessage {
364+
type: 'devframe:remote-assets-error';
365+
package: string;
366+
version: string;
367+
reason: string;
368+
}
363369
export interface RemoteAssetsProviderCustom {
364370
fileUrl: (_: string, _: string, _: string) => string;
365371
listFiles?: (_: string, _: string, _: typeof globalThis.fetch) => Promise<string[]>;

‎tests/__snapshots__/tsnapi/devframe/types.snapshot.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export { EventsMap }
5656
export { EventUnsubscribe }
5757
export { McpRouteOptions }
5858
export { RemoteAssets }
59+
export { RemoteAssetsErrorMessage }
5960
export { RemoteAssetsProvider }
6061
export { RemoteAssetsProviderCustom }
6162
export { RemoteAssetsStore }

0 commit comments

Comments
 (0)