Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/hub/src/client/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,28 @@ export interface DevframeClientHostOptions {
* `@devframes/json-render-ui`). The hub ships none by default.
*/
renderers?: Record<string, DockRenderer>
/**
* Hub-wide override of the top-level dock-bar category ordering — a map of
* category id → ordering weight (lower sorts earlier), mirroring the shape
* of {@link import('../constants').DEFAULT_CATEGORIES_ORDER}.
*
* This is the OUTER bucket ordering: it governs every ungrouped entry's own
* `category` and every group's `category` (see
* {@link import('../types/docks').DevframeDockEntryBase.category}). It is
* distinct from {@link import('../types/docks').DevframeViewGroup.categoryOrder},
* which only reorders the IN-GROUP sub-categories of one specific group.
*
* Keys are merged over `DEFAULT_CATEGORIES_ORDER`, so the host app only
* lists the categories it wants to move; any category absent from the map
* keeps its default weight (falling back to `0`).
*
* @example
* ```ts
* // Surface `data` tools ahead of `app` tools, hub-wide.
* createDevframeClientHost({ categoryOrder: { data: 50 } })
* ```
*/
categoryOrder?: Record<string, number>
}

export interface DevframeClientHost {
Expand Down
23 changes: 23 additions & 0 deletions packages/hub/src/types/docks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,29 @@ export interface DevframeViewGroup extends DevframeDockEntryBase {
* opens until a member is chosen.
*/
defaultChildId?: string
/**
* Per-group override of the in-group sub-category ordering — a map of
* sub-category id → ordering weight (lower sorts earlier), mirroring the
* shape of {@link import('../constants').DEFAULT_CATEGORIES_ORDER}.
*
* A member's own {@link DevframeDockEntryBase.category} is reinterpreted as
* its IN-GROUP sub-category, and members are sub-divided and sorted by those
* sub-categories. By default that sort follows the hub-wide
* `DEFAULT_CATEGORIES_ORDER`; set this to reorder the sub-categories **inside
* this group only**, leaving the outer dock-bar ordering (and every other
* group) untouched.
*
* Keys are merged over the defaults, so you only list the sub-categories you
* want to move; any sub-category absent from the map keeps its default weight
* (falling back to `0`).
*
* @example
* ```ts
* // In the "nuxt" group, surface `app` tools before `framework` internals.
* { type: 'group', id: 'nuxt', categoryOrder: { app: -200 } }
* ```
*/
categoryOrder?: Record<string, number>
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface DevframeClientHostOptions {
clientType?: DockClientType;
loadClientScripts?: boolean;
renderers?: Record<string, DockRenderer>;
categoryOrder?: Record<string, number>;
}
export interface DockClientScriptContext extends DocksContext {
current: DockEntryState;
Expand Down
Loading