@wildo-ai/saas-frontend-lib 1.1.16 → 1.1.17
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/esm/components/compliance/EmbeddedSigningFrame.d.ts.map +1 -1
- package/dist/esm/components/compliance/EmbeddedSigningFrame.js +17 -6
- package/dist/esm/components/compliance/EmbeddedSigningFrame.js.map +1 -1
- package/dist/esm/components/data-display/approval-seal.d.ts +7 -5
- package/dist/esm/components/data-display/approval-seal.d.ts.map +1 -1
- package/dist/esm/components/data-display/approval-seal.js +10 -4
- package/dist/esm/components/data-display/approval-seal.js.map +1 -1
- package/dist/esm/components/data-display/signature-requests.d.ts +81 -0
- package/dist/esm/components/data-display/signature-requests.d.ts.map +1 -0
- package/dist/esm/components/data-display/signature-requests.js +123 -0
- package/dist/esm/components/data-display/signature-requests.js.map +1 -0
- package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/approval.js +8 -15
- package/dist/esm/components/flows-actors/approval.js.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js +44 -29
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
- package/dist/esm/components/navigation/NavigationItemBadge.d.ts +16 -0
- package/dist/esm/components/navigation/NavigationItemBadge.d.ts.map +1 -1
- package/dist/esm/components/navigation/NavigationItemBadge.js +14 -2
- package/dist/esm/components/navigation/NavigationItemBadge.js.map +1 -1
- package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.d.ts +3 -3
- package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js +3 -3
- package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js.map +1 -1
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts +5 -13
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js +30 -255
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts +22 -1
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js +57 -26
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts +1 -1
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js +35 -1
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts +1 -1
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js +26 -4
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts +31 -0
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts.map +1 -0
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js +42 -0
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js.map +1 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts +76 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts.map +1 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js +268 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js.map +1 -0
- package/dist/esm/components/navigation/command.d.ts +5 -0
- package/dist/esm/components/navigation/command.d.ts.map +1 -1
- package/dist/esm/components/navigation/command.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js +5 -2
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_InsertedViews.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_InsertedViews.js +5 -1
- package/dist/esm/components/resources/ResourceLayout_InsertedViews.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_List.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_List.js +4 -1
- package/dist/esm/components/resources/ResourceLayout_List.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +4 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
- package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js +4 -1
- package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js +4 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map +1 -1
- package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js +4 -1
- package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js.map +1 -1
- package/dist/esm/components/resources/skeleton/Group.d.ts.map +1 -1
- package/dist/esm/components/resources/skeleton/Group.js +4 -1
- package/dist/esm/components/resources/skeleton/Group.js.map +1 -1
- package/dist/esm/components/sections/ContentSectionContainer.d.ts.map +1 -1
- package/dist/esm/components/sections/ContentSectionContainer.js +11 -7
- package/dist/esm/components/sections/ContentSectionContainer.js.map +1 -1
- package/dist/esm/components/sections/content-section.d.ts +1 -3
- package/dist/esm/components/sections/content-section.d.ts.map +1 -1
- package/dist/esm/components/sections/content-section.js.map +1 -1
- package/dist/esm/components/settings/AppPage_AgentActivitySettings.d.ts.map +1 -1
- package/dist/esm/components/settings/AppPage_AgentActivitySettings.js +2 -1
- package/dist/esm/components/settings/AppPage_AgentActivitySettings.js.map +1 -1
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts +12 -0
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts.map +1 -1
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js +28 -6
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js.map +1 -1
- package/dist/esm/components/typography/document-heading-level.d.ts +28 -0
- package/dist/esm/components/typography/document-heading-level.d.ts.map +1 -0
- package/dist/esm/components/typography/document-heading-level.js +63 -0
- package/dist/esm/components/typography/document-heading-level.js.map +1 -0
- package/dist/esm/components/views/chart-view/ChartView.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.js +20 -16
- package/dist/esm/components/views/chart-view/ChartView.js.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.labels.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.labels.js +7 -0
- package/dist/esm/components/views/chart-view/ChartView.labels.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts +12 -3
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.js +18 -11
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js +2 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js +7 -3
- package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js +6 -2
- package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js +7 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js +13 -9
- package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js +2 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js +2 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js +4 -3
- package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js +2 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js +5 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js +4 -3
- package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js.map +1 -1
- package/dist/esm/core/app-shell/app-shell.schemas.d.ts +87 -16
- package/dist/esm/core/app-shell/app-shell.schemas.d.ts.map +1 -1
- package/dist/esm/core/app-shell/app-shell.schemas.js +16 -0
- package/dist/esm/core/app-shell/app-shell.schemas.js.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +39 -4
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +33 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
- package/dist/esm/core/resources/hooks/useOperationEnabled.d.ts.map +1 -1
- package/dist/esm/core/resources/hooks/useOperationEnabled.js +41 -3
- package/dist/esm/core/resources/hooks/useOperationEnabled.js.map +1 -1
- package/dist/esm/core/search/command-score.d.ts +33 -0
- package/dist/esm/core/search/command-score.d.ts.map +1 -0
- package/dist/esm/core/search/command-score.js +109 -0
- package/dist/esm/core/search/command-score.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FrontendComponentType } from '@wildo-ai/presets-components-models';
|
|
2
2
|
import type { FrontendResourcesRegistry } from '../../../core/resources/resources.frontend.schemas';
|
|
3
|
-
import type { CommandMenuBehavior } from '../../../core/app-shell/app-shell.schemas';
|
|
3
|
+
import type { CommandMenuBehavior, CommandMenuGroup, CommandMenuSearchResultGroup, CommandMenuPaletteGroup } from '../../../core/app-shell/app-shell.schemas';
|
|
4
4
|
/**
|
|
5
5
|
* The heading of a record-search group (#3122): its declared category's words, or, when the entry names none, the
|
|
6
6
|
* resource's own title, since the group IS the resource's records.
|
|
@@ -17,6 +17,27 @@ export declare function resolveSearchGroupLabel(t: (key: string) => string, tCom
|
|
|
17
17
|
export declare function useCommandMenuBehavior(externalIsOpen?: boolean, onOpenChange?: (open: boolean) => void, options?: {
|
|
18
18
|
listenForHotkeys?: boolean;
|
|
19
19
|
}): CommandMenuBehavior;
|
|
20
|
+
/**
|
|
21
|
+
* The palette's groups, in render order, holding what matches `searchQuery` (#1828): the one place the command menu's text
|
|
22
|
+
* search decides what a renderer shows, so the hook and a renderer that is not the DOM agree.
|
|
23
|
+
*
|
|
24
|
+
* - Record groups are the server's answer, ranked by `commandScore`, the scorer the palette's `cmdk` ranked them with. A
|
|
25
|
+
* result carries the query it was found for among its keywords, so a hit on a field absent from the label still matches
|
|
26
|
+
* that query. While a newer query is typed the previous answer is still held and may match nothing: a group left empty
|
|
27
|
+
* is left out, as `cmdk` hid it (review F2).
|
|
28
|
+
* - Command groups hold only the commands matching the query, best first; a group matching nothing is left out.
|
|
29
|
+
* - The groups keep their declared order (record groups by `recordOrderByCategory`, else first; then the command
|
|
30
|
+
* categories), where `cmdk` also moved a group ahead when its best item scored higher: the order weights are the
|
|
31
|
+
* authority over which group comes first.
|
|
32
|
+
*
|
|
33
|
+
* An empty `searchQuery` returns every group as it is.
|
|
34
|
+
*/
|
|
35
|
+
export declare function paletteGroupsFor(input: {
|
|
36
|
+
readonly searchResultGroups: readonly CommandMenuSearchResultGroup[];
|
|
37
|
+
readonly commandGroups: readonly CommandMenuGroup[];
|
|
38
|
+
readonly recordOrderByCategory: ReadonlyMap<string, number>;
|
|
39
|
+
readonly searchQuery: string;
|
|
40
|
+
}): CommandMenuPaletteGroup[];
|
|
20
41
|
/**
|
|
21
42
|
* The context identifiers of ONE record opened from an omnibox result (#3548, the #2746 invariant).
|
|
22
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommandMenuBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useCommandMenuBehavior.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,qBAAqB,EAA+C,MAAM,qCAAqC,CAAC;AAiBpJ,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AA4B/G,OAAO,KAAK,EACV,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useCommandMenuBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useCommandMenuBehavior.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,qBAAqB,EAA+C,MAAM,qCAAqC,CAAC;AAiBpJ,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AA4B/G,OAAO,KAAK,EACV,mBAAmB,EAEnB,gBAAgB,EAEhB,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,sDAAsD,CAAC;AAmG9D;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAC1B,UAAU,EAAE,CAAC,SAAS,EAAE,qBAAqB,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,EAC/G,KAAK,EAAE;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACnE,MAAM,CAIR;AAmBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,CAAC,EAAE,OAAO,EACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,EACtC,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3C,mBAAmB,CAoerB;AAKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,4BAA4B,EAAE,CAAC;IACrE,QAAQ,CAAC,aAAa,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACpD,QAAQ,CAAC,qBAAqB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GAAG,uBAAuB,EAAE,CA0B5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAAC,MAAM,EAAE;IAC3D,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,yBAAyB,CAAC;CACrC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWzB"}
|
|
@@ -27,6 +27,7 @@ import { useHotkeyRegistry } from '../../../core/hotkey/useHotkey.js';
|
|
|
27
27
|
import { useI18n } from '../../../core/i18n/useI18n.js';
|
|
28
28
|
import { envLoader } from '../../../core/runtime/env-variable-loader.frontend.service.js';
|
|
29
29
|
import { CommandMenuPaletteGroupKind } from '../../../core/app-shell/app-shell.schemas.js';
|
|
30
|
+
import { rankByCommandScore } from '../../../core/search/command-score.js';
|
|
30
31
|
const DEFAULT_CATEGORY_ORDER = [CommandMenuEngineCategory.NAVIGATION, CommandMenuEngineCategory.ACTIONS];
|
|
31
32
|
/**
|
|
32
33
|
* Order weights for the SINGLE palette ordering axis. Record groups occupy the
|
|
@@ -274,12 +275,18 @@ export function useCommandMenuBehavior(externalIsOpen, onOpenChange, options = {
|
|
|
274
275
|
}
|
|
275
276
|
return ordered;
|
|
276
277
|
}, [commandItems, categoryOrder, t, tComponent]);
|
|
277
|
-
const
|
|
278
|
+
const recentCommands = useMemo(() => {
|
|
278
279
|
if (recentCommandIds.length === 0)
|
|
279
280
|
return [];
|
|
280
281
|
const itemById = new Map(commandItems.map(item => [item.id, item]));
|
|
281
282
|
return recentCommandIds.map(id => itemById.get(id)).filter(Boolean);
|
|
282
283
|
}, [commandItems, recentCommandIds]);
|
|
284
|
+
/*
|
|
285
|
+
* Text search is this hook's (#1828), so every renderer shows the same matches: a command matches `searchQuery` by
|
|
286
|
+
* `commandScore` over `"<id> <label>"` and its keywords, the scorer and value the palette's `cmdk` used when it filtered
|
|
287
|
+
* by itself, and the matches come best first. The preset now renders these lists as they are (`shouldFilter={false}`).
|
|
288
|
+
*/
|
|
289
|
+
const recentItems = useMemo(() => rankByCommandScore(recentCommands, searchQuery, commandSearchValueOf, (item) => item.keywords), [recentCommands, searchQuery]);
|
|
283
290
|
// ===================================================================
|
|
284
291
|
// Omnibox record-search layer (policy: OMNIBOX)
|
|
285
292
|
// ===================================================================
|
|
@@ -437,8 +444,8 @@ export function useCommandMenuBehavior(externalIsOpen, onOpenChange, options = {
|
|
|
437
444
|
|| entry.resultDisplay === ForeignKeyDisplayMode.ID
|
|
438
445
|
? ForeignKeyDisplayMode.LABEL
|
|
439
446
|
: ForeignKeyDisplayMode.SUMMARY;
|
|
440
|
-
// The raw query is always carried as a keyword so
|
|
441
|
-
//
|
|
447
|
+
// The raw query is always carried as a keyword so the client-side match
|
|
448
|
+
// never drops a legitimate server hit (matches may be on a field
|
|
442
449
|
// absent from the label, e.g. `description`). We also fold in the
|
|
443
450
|
// LOCALIZED "search" verb synonyms so typing a translated synonym keeps
|
|
444
451
|
// the group visible, plus any app-specific literal supplements.
|
|
@@ -530,29 +537,7 @@ export function useCommandMenuBehavior(externalIsOpen, onOpenChange, options = {
|
|
|
530
537
|
const entry = searchEntryByCategory.get(group.category);
|
|
531
538
|
return entry ? { ...group, label: resolveSearchGroupLabel(t, tComponent, entry) } : group;
|
|
532
539
|
}), [searchResultGroups, searchEntryByCategory, t, tComponent]);
|
|
533
|
-
const orderedGroups = useMemo(() => {
|
|
534
|
-
const entries = [];
|
|
535
|
-
labelledSearchResultGroups.forEach((group, index) => {
|
|
536
|
-
entries.push({
|
|
537
|
-
kind: CommandMenuPaletteGroupKind.RECORDS,
|
|
538
|
-
order: recordOrderByCategory.get(group.category) ?? RECORD_GROUP_ORDER_BASE + index,
|
|
539
|
-
group,
|
|
540
|
-
});
|
|
541
|
-
});
|
|
542
|
-
groupedItems.forEach((group, index) => {
|
|
543
|
-
entries.push({
|
|
544
|
-
kind: CommandMenuPaletteGroupKind.COMMANDS,
|
|
545
|
-
order: COMMAND_GROUP_ORDER_BASE + index,
|
|
546
|
-
group,
|
|
547
|
-
});
|
|
548
|
-
});
|
|
549
|
-
// Stable sort by the single order axis (index tiebreak preserves the
|
|
550
|
-
// per-source sequence when two groups share a weight).
|
|
551
|
-
return entries
|
|
552
|
-
.map((entry, index) => ({ entry, index }))
|
|
553
|
-
.sort((a, b) => a.entry.order - b.entry.order || a.index - b.index)
|
|
554
|
-
.map(({ entry }) => entry);
|
|
555
|
-
}, [labelledSearchResultGroups, groupedItems, recordOrderByCategory]);
|
|
540
|
+
const orderedGroups = useMemo(() => paletteGroupsFor({ searchResultGroups: labelledSearchResultGroups, commandGroups: groupedItems, recordOrderByCategory, searchQuery }), [labelledSearchResultGroups, groupedItems, recordOrderByCategory, searchQuery]);
|
|
556
541
|
return {
|
|
557
542
|
isOpen,
|
|
558
543
|
handleOpenChange,
|
|
@@ -571,6 +556,52 @@ export function useCommandMenuBehavior(externalIsOpen, onOpenChange, options = {
|
|
|
571
556
|
authoredDialogWidth,
|
|
572
557
|
};
|
|
573
558
|
}
|
|
559
|
+
/** A command's value for the search: its id and label, as the palette's `cmdk` items were valued. */
|
|
560
|
+
const commandSearchValueOf = (item) => `${item.id} ${item.label}`;
|
|
561
|
+
/**
|
|
562
|
+
* The palette's groups, in render order, holding what matches `searchQuery` (#1828): the one place the command menu's text
|
|
563
|
+
* search decides what a renderer shows, so the hook and a renderer that is not the DOM agree.
|
|
564
|
+
*
|
|
565
|
+
* - Record groups are the server's answer, ranked by `commandScore`, the scorer the palette's `cmdk` ranked them with. A
|
|
566
|
+
* result carries the query it was found for among its keywords, so a hit on a field absent from the label still matches
|
|
567
|
+
* that query. While a newer query is typed the previous answer is still held and may match nothing: a group left empty
|
|
568
|
+
* is left out, as `cmdk` hid it (review F2).
|
|
569
|
+
* - Command groups hold only the commands matching the query, best first; a group matching nothing is left out.
|
|
570
|
+
* - The groups keep their declared order (record groups by `recordOrderByCategory`, else first; then the command
|
|
571
|
+
* categories), where `cmdk` also moved a group ahead when its best item scored higher: the order weights are the
|
|
572
|
+
* authority over which group comes first.
|
|
573
|
+
*
|
|
574
|
+
* An empty `searchQuery` returns every group as it is.
|
|
575
|
+
*/
|
|
576
|
+
export function paletteGroupsFor(input) {
|
|
577
|
+
const { searchQuery } = input;
|
|
578
|
+
const entries = [];
|
|
579
|
+
input.searchResultGroups.forEach((group, index) => {
|
|
580
|
+
const items = rankByCommandScore(group.items, searchQuery, commandSearchValueOf, (item) => item.keywords);
|
|
581
|
+
if (items.length === 0)
|
|
582
|
+
return;
|
|
583
|
+
entries.push({
|
|
584
|
+
kind: CommandMenuPaletteGroupKind.RECORDS,
|
|
585
|
+
order: input.recordOrderByCategory.get(group.category) ?? RECORD_GROUP_ORDER_BASE + index,
|
|
586
|
+
group: searchQuery ? { ...group, items } : group,
|
|
587
|
+
});
|
|
588
|
+
});
|
|
589
|
+
input.commandGroups.forEach((group, index) => {
|
|
590
|
+
const items = rankByCommandScore(group.items, searchQuery, commandSearchValueOf, (item) => item.keywords);
|
|
591
|
+
if (items.length === 0)
|
|
592
|
+
return;
|
|
593
|
+
entries.push({
|
|
594
|
+
kind: CommandMenuPaletteGroupKind.COMMANDS,
|
|
595
|
+
order: COMMAND_GROUP_ORDER_BASE + index,
|
|
596
|
+
group: searchQuery ? { ...group, items } : group,
|
|
597
|
+
});
|
|
598
|
+
});
|
|
599
|
+
// Stable sort by the single order axis (index tiebreak preserves the per-source sequence when two groups share a weight).
|
|
600
|
+
return entries
|
|
601
|
+
.map((entry, index) => ({ entry, index }))
|
|
602
|
+
.sort((a, b) => a.entry.order - b.entry.order || a.index - b.index)
|
|
603
|
+
.map(({ entry }) => entry);
|
|
604
|
+
}
|
|
574
605
|
/**
|
|
575
606
|
* The context identifiers of ONE record opened from an omnibox result (#3548, the #2746 invariant).
|
|
576
607
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommandMenuBehavior.js","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useCommandMenuBehavior.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AACpJ,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EACL,6BAA6B,EAC7B,WAAW,EACX,WAAW,GACZ,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uEAAuE,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oEAAoE,CAAC;AAEtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6DAA6D,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AAC1H,OAAO,EAAE,qBAAqB,EAAE,MAAM,2EAA2E,CAAC;AAElH,OAAO,EACL,qCAAqC,EACrC,0CAA0C,GAE3C,MAAM,uEAAu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AAY,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEtE,OAAO;QACL,MAAM;QACN,gBAAgB;QAChB,WAAW;QACX,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,kBAAkB,EAAE,0BAA0B;QAC9C,aAAa;QACb,WAAW;QACX,mBAAmB,EAAE,CAAC,aAAa;QACnC,UAAU;QACV,aAAa;QACb,YAAY;QACZ,mBAAmB;KACpB,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oCAAoC,CAAC,MAKpD;IACC,OAAO;QACL,GAAG,qBAAqB,CAAC;YACvB,eAAe,EAAE,MAAM,CAAC,gBAAgB;YACxC,wBAAwB,EAAE,EAAE;YAC5B,kBAAkB,EAAE,MAAM,CAAC,YAAY;YACvC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC,WAAW;QACd,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,QAAQ;KACvC,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { CommandMenuEngineCategory, FrontendComponentType, LabellingTypes, isCommandMenuEngineCategory } from '@wildo-ai/presets-components-models';\nimport { CoreResourceOperation } from '@wildo-ai/saas-models';\nimport { ForeignKeyDisplayMode } from '@wildo-ai/zod-decorators';\n\nimport {\n ApplicationLevelComponentType,\n HotkeyGroup,\n HotkeyScope,\n} from '~wildo-frontend-lib/core/config/app-level-components.frontend.schemas';\nimport { CommandMenuDisplayPolicy } from '~wildo-frontend-lib/core/config/app-level-components.frontend.schemas';\nimport { CommandBarPolicy } from '~wildo-frontend-lib/core/config/app-configuration-frontend.schemas';\nimport type { CommandMenuCommand, CommandMenuSearchResource } from '~wildo-frontend-lib/core/config/launcher-items.frontend.schemas';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { ScopeUtilsService } from '~wildo-frontend-lib/core/scope/scope.utils.frontend.service';\nimport { frontendResourceUtils, FrontendResourceUtils } from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport { scopeReferencedRecord } from '~wildo-frontend-lib/core/resources/referenced-record-scope.frontend.utils';\nimport type { FrontendResourcesRegistry } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport {\n pickPreferredOperationForCoreSemantic,\n resolveEffectiveCoreOperationFromOperation,\n type ResourceOperationSemanticsLike,\n} from '~wildo-frontend-lib/core/resources/operation-semantics.frontend.utils';\nimport { extractErrorInfo } from '~wildo-frontend-lib/core/errors/errors.frontend.schemas';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport {\n FrontendEvents,\n type FrontendEvent_HotkeyCommandMenuOpen,\n} from '~wildo-frontend-lib/core/events/events.frontend.schemas';\nimport { useEventBus } from '~wildo-frontend-lib/core/events/useEventBus';\nimport {\n filterCommandMenuCommandsByRuntimeAvailability,\n useLauncherRuntimeAvailabilityContext,\n} from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport { NavigationUtils } from '~wildo-frontend-lib/core/navigation/navigation.utils';\nimport { resolveCommandMenuCommands, type ResolvedCommandMenuItem } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { ApplicationContext } from '~wildo-frontend-lib/core/runtime/ApplicationContext.shared';\nimport { withEngineClientsCommand, withEngineDecisionInboxCommand } from '~wildo-frontend-lib/components/navigation/app-level/engine-launcher-entries';\nimport { useLauncherResolutionContext } from '~wildo-frontend-lib/core/navigation/useLauncherResolutionContext';\nimport { useNavigationController } from '~wildo-frontend-lib/core/navigation/useNavigationController';\nimport { useUI } from '~wildo-frontend-lib/core/ui/useUI';\nimport { useHotkeyRegistry } from '~wildo-frontend-lib/core/hotkey/useHotkey';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\n\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport type {\n CommandMenuBehavior,\n CommandMenuItem,\n CommandMenuGroup,\n CommandMenuSearchResultItem,\n CommandMenuSearchResultGroup,\n CommandMenuPaletteGroup,\n} from '~wildo-frontend-lib/core/app-shell/app-shell.schemas';\nimport { CommandMenuPaletteGroupKind } from '~wildo-frontend-lib/core/app-shell/app-shell.schemas';\n\nconst DEFAULT_CATEGORY_ORDER: readonly string[] = [CommandMenuEngineCategory.NAVIGATION, CommandMenuEngineCategory.ACTIONS];\n\n/**\n * Order weights for the SINGLE palette ordering axis. Record groups occupy the\n * low band (0..), static command-category groups the high band (1000..), so\n * live record matches surface ABOVE static commands by default while searching.\n * An app overrides per record group via `CommandMenuSearchResource.order`.\n */\nconst RECORD_GROUP_ORDER_BASE = 0;\nconst COMMAND_GROUP_ORDER_BASE = 1000;\n\n/** Omnibox record-search tuning — mirrors `useResourceSearch` (FK picker). */\nconst OMNIBOX_SEARCH_DEBOUNCE_MS = 300;\nconst OMNIBOX_MIN_SEARCH_CHARS = 2;\nconst OMNIBOX_DEFAULT_MAX_RESULTS = 5;\n\nconst omniboxLogger: LoggerFrontendService = LoggerFrontendService.getLogger();\n\n/**\n * Maps a command's core operation semantic to the command-menu component label\n * key holding that operation's LOCALIZED search synonyms (a comma-separated\n * list). `_MANY` variants share their base action's synonyms. Operations\n * without a meaningful synonym set (COUNT) are omitted — they contribute no\n * extra keywords and the command's localized label still matches.\n */\nconst OPERATION_KEYWORD_LABEL_KEY: Partial<Record<CoreResourceOperation, string>> = {\n [CoreResourceOperation.CREATE]: 'keywordsCreate',\n [CoreResourceOperation.CREATE_MANY]: 'keywordsCreate',\n [CoreResourceOperation.LIST]: 'keywordsList',\n [CoreResourceOperation.SEARCH]: 'keywordsSearch',\n [CoreResourceOperation.READ]: 'keywordsRead',\n [CoreResourceOperation.UPDATE]: 'keywordsUpdate',\n [CoreResourceOperation.UPDATE_MANY]: 'keywordsUpdate',\n [CoreResourceOperation.DELETE]: 'keywordsDelete',\n [CoreResourceOperation.DELETE_MANY]: 'keywordsDelete',\n};\n\ntype TComponentFn = (component: FrontendComponentType, key: string, params?: Record<string, string | number>) => string;\n\n/**\n * Resolve a command-menu component keyword label into its list of localized\n * synonyms. The label is authored (and translated) as a comma-separated string;\n * we split it into individual match terms. Fails OPEN to `[]` when the key is\n * not yet generated (`tComponent` returns the raw key path) so a missing\n * translation never injects the literal key path as a bogus keyword.\n */\nfunction resolveKeywordSynonyms(tComponent: TComponentFn, key: string): string[] {\n const componentType = FrontendComponentType.APPLICATION_LEVEL_COMMAND_MENU;\n const base = `components.${componentType}.${key}`;\n const resolved = tComponent(componentType, key);\n if (!resolved || resolved === base) return [];\n return resolved.split(',').map(term => term.trim()).filter(Boolean);\n}\n\n/** Localized verb synonyms for a resource-operation command's core semantic. */\nfunction resolveOperationKeywords(\n tComponent: TComponentFn,\n operation: ResourceOperationSemanticsLike | undefined,\n): string[] {\n if (!operation) return [];\n const coreOperation = resolveEffectiveCoreOperationFromOperation(operation);\n const key = coreOperation ? OPERATION_KEYWORD_LABEL_KEY[coreOperation] : undefined;\n return key ? resolveKeywordSynonyms(tComponent, key) : [];\n}\n\n/**\n * The category heading a person reads, from the label tree and nowhere else.\n *\n * This was `resolved === baseKey ? humanizeCategory(category) : resolved` — the exact shape\n * `.claude/rules/display-text-comes-from-i18n.md` names as forbidden, and the reason it is forbidden\n * is visible here: the formatter ran ONLY when the label was missing, which is precisely the case\n * somebody needs to notice. The palette read as finished in every locale, so the keys were never\n * authored and a French user was shown English produced by code — invisible to a translator, because\n * it was never in the tree at all.\n *\n * `tComponent` already answers with the KEY when it cannot resolve one, so returning its answer\n * unchanged IS the missing-looks-missing behaviour. A category with no label now shows its key,\n * which is what makes somebody author it.\n *\n * Whose words, by whose category (#3122). The engine's own categories ({@link CommandMenuEngineCategory}) are worded\n * on the command menu component. Any other category is the APPLICATION's ref, worded under\n * `command_categories.<category>.label`, which the labelling pipeline plans from the application's commands and\n * record searches. Reading an application's ref from the engine component's unit (as this did) left every\n * application-defined heading showing its key, since nothing could ever plan it there.\n */\nfunction resolveCategoryLabel(\n t: (key: string) => string,\n tComponent: (component: FrontendComponentType, key: string, params?: Record<string, string | number>) => string,\n category: string,\n): string {\n return isCommandMenuEngineCategory(category)\n ? tComponent(FrontendComponentType.APPLICATION_LEVEL_COMMAND_MENU, category)\n : t(`${LabellingTypes.COMMAND_CATEGORIES}.${category}.label`);\n}\n\n/**\n * The heading of a record-search group (#3122): its declared category's words, or, when the entry names none, the\n * resource's own title, since the group IS the resource's records.\n */\nexport function resolveSearchGroupLabel(\n t: (key: string) => string,\n tComponent: (component: FrontendComponentType, key: string, params?: Record<string, string | number>) => string,\n entry: { readonly resourceType: string; readonly category?: string },\n): string {\n return entry.category !== undefined\n ? resolveCategoryLabel(t, tComponent, entry.category)\n : t(`${LabellingTypes.RESOURCES}.${entry.resourceType}.header.title`);\n}\n\nfunction isCommandMenuConfigObject(\n config: unknown,\n): config is {\n policy?: CommandBarPolicy;\n showRecent?: boolean;\n maxRecentItems?: number;\n showShortcuts?: boolean;\n openShortcut?: string;\n defaultCategory?: string;\n categoryOrder?: string[];\n commands?: CommandMenuCommand[];\n searchResources?: CommandMenuSearchResource[];\n dialogWidth?: string;\n} {\n return typeof config === 'object' && config !== null && !Array.isArray(config);\n}\n\n/**\n * Behavior hook for CommandMenu — manages open state (controlled or\n * uncontrolled), search, recent commands, hotkey subscription, and\n * navigation items mapped to command menu entries.\n */\nexport function useCommandMenuBehavior(\n externalIsOpen?: boolean,\n onOpenChange?: (open: boolean) => void,\n options: { listenForHotkeys?: boolean } = {},\n): CommandMenuBehavior {\n const resolutionCtx = useLauncherResolutionContext();\n const { navigate, navigateToResource } = useNavigationController();\n const { registry, doOperation } = useResourceRegistry();\n const appScope = useAppScopeSafe();\n const { appComponentsConfiguration, suppressedEngineNavigationEntries } = useUI();\n const { on, emit } = useEventBus();\n const { register } = useHotkeyRegistry();\n const { t, tComponent, formatDate, formatDateTime } = useI18n({\n component: FrontendComponentType.APPLICATION_LEVEL_COMMAND_MENU,\n });\n\n const commandMenuConfig = appComponentsConfiguration?.[ApplicationLevelComponentType.COMMAND_MENU];\n const commandMenuObj = isCommandMenuConfigObject(commandMenuConfig) ? commandMenuConfig : undefined;\n const openShortcut = commandMenuObj?.openShortcut;\n const showRecent = commandMenuObj?.showRecent !== false;\n const maxRecentItems = commandMenuObj?.maxRecentItems ?? 5;\n const showShortcuts = commandMenuObj?.showShortcuts !== false;\n const defaultCategory = commandMenuObj?.defaultCategory ?? CommandMenuEngineCategory.NAVIGATION;\n const categoryOrder = commandMenuObj?.categoryOrder ?? DEFAULT_CATEGORY_ORDER;\n const isOmnibox = commandMenuObj?.policy === CommandBarPolicy.OMNIBOX;\n const searchResources = commandMenuObj?.searchResources;\n // The application's authored width only; the preset owns the default (#1828).\n const authoredDialogWidth = commandMenuObj?.dialogWidth;\n const runtimeAvailabilityContext = useLauncherRuntimeAvailabilityContext();\n // The engine's own command (#2527): the decision inbox, beside the application's, gated like its sidebar twin. Read\n // optionally: the command menu needs no application otherwise, and without one it simply offers no inbox.\n const decisionInboxOffer = useContext(ApplicationContext)?.appConfig?.decisionInbox;\n const configCommands = useMemo(() => (\n filterCommandMenuCommandsByRuntimeAvailability(\n withEngineClientsCommand(withEngineDecisionInboxCommand(commandMenuObj?.commands, decisionInboxOffer), suppressedEngineNavigationEntries),\n runtimeAvailabilityContext,\n )\n ), [commandMenuObj?.commands, decisionInboxOffer, suppressedEngineNavigationEntries, runtimeAvailabilityContext]);\n\n const [internalIsOpen, setInternalIsOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [recentCommandIds, setRecentCommandIds] = useState<string[]>([]);\n\n const isControlled = externalIsOpen !== undefined && onOpenChange !== undefined;\n const isOpen = isControlled ? externalIsOpen : internalIsOpen;\n const isOpenRef = useRef(isOpen);\n isOpenRef.current = isOpen;\n const listenForHotkeys = options.listenForHotkeys !== false;\n\n const handleOpenChange = useCallback((open: boolean) => {\n if (isControlled && onOpenChange) {\n onOpenChange(open);\n } else {\n setInternalIsOpen(open);\n }\n if (!open) {\n setSearchQuery('');\n }\n }, [isControlled, onOpenChange]);\n\n useEffect(() => {\n if (!listenForHotkeys) return;\n const unsubscribe = on(FrontendEvents.HOTKEY_COMMAND_MENU_OPEN, () => {\n handleOpenChange(!isOpenRef.current);\n });\n return unsubscribe;\n }, [on, handleOpenChange, listenForHotkeys]);\n\n useEffect(() => {\n if (!listenForHotkeys) return;\n if (!openShortcut || commandMenuConfig === false) return;\n return register({\n id: 'app-command-menu-open-shortcut',\n shortcut: openShortcut,\n description: t('engine.hotkeys.commandMenuOpen'),\n scope: HotkeyScope.GLOBAL,\n group: HotkeyGroup.NAVIGATION,\n launcher: ApplicationLevelComponentType.COMMAND_MENU,\n preventDefault: true,\n handler: () => {\n emit(FrontendEvents.HOTKEY_COMMAND_MENU_OPEN, {} as FrontendEvent_HotkeyCommandMenuOpen);\n },\n });\n }, [openShortcut, commandMenuConfig, register, emit, t, listenForHotkeys]);\n\n const resolvedCommands = useMemo((): ResolvedCommandMenuItem[] => {\n if (!configCommands || !resolutionCtx) return [];\n return resolveCommandMenuCommands(configCommands, resolutionCtx);\n }, [configCommands, resolutionCtx]);\n\n const commandItems = useMemo((): CommandMenuItem[] => {\n return resolvedCommands\n .filter(cmd => {\n const dp = cmd.displayPolicy;\n if (dp === undefined || dp === CommandMenuDisplayPolicy.ALWAYS) return true;\n if (dp === CommandMenuDisplayPolicy.NEVER) return false;\n if (dp === CommandMenuDisplayPolicy.RECENT) return true;\n if (dp === CommandMenuDisplayPolicy.CONTEXTUAL) {\n if (envLoader.isDevelopment()) {\n console.warn(`[CommandMenu] CONTEXTUAL displayPolicy requires a contextual source and is excluded from the global app-level menu for \"${cmd.id}\"`);\n }\n return false;\n }\n if (envLoader.isDevelopment()) {\n console.warn(`[CommandMenu] Unknown displayPolicy \"${dp}\" for command \"${cmd.id}\" — treating as ALWAYS`);\n }\n return true;\n })\n .map(cmd => ({\n id: cmd.id,\n label: cmd.label,\n shortcut: cmd.shortcut ?? '',\n iconReference: cmd.iconReference,\n category: cmd.category ?? defaultCategory,\n // Localized operation-verb synonyms (translated) + any app-specific\n // literal supplements. The command's localized `label` covers the noun.\n keywords: [\n ...resolveOperationKeywords(tComponent, cmd.operation),\n ...(cmd.searchKeywords ?? []),\n ],\n displayPolicy: cmd.displayPolicy,\n onExecute: () => {\n handleOpenChange(false);\n setRecentCommandIds(prev => {\n const next = [cmd.id, ...prev.filter(id => id !== cmd.id)];\n return next.slice(0, maxRecentItems);\n });\n if (cmd.urlPath) {\n NavigationUtils.dispatchNavigationForResolvedTarget(navigate, cmd, ApplicationLevelComponentType.COMMAND_MENU);\n }\n },\n }));\n }, [resolvedCommands, handleOpenChange, navigate, maxRecentItems, defaultCategory, tComponent]);\n\n const groupedItems = useMemo((): CommandMenuGroup[] => {\n const categoryMap = new Map<string, CommandMenuItem[]>();\n\n for (const item of commandItems) {\n if (item.displayPolicy === CommandMenuDisplayPolicy.RECENT) continue;\n const category = item.category;\n const existing = categoryMap.get(category) ?? [];\n existing.push(item);\n categoryMap.set(category, existing);\n }\n\n for (const items of categoryMap.values()) {\n items.sort((a, b) => a.label.localeCompare(b.label));\n }\n\n const ordered: CommandMenuGroup[] = [];\n for (const cat of categoryOrder) {\n const items = categoryMap.get(cat);\n if (items) {\n ordered.push({ category: cat, label: resolveCategoryLabel(t, tComponent, cat), items });\n categoryMap.delete(cat);\n }\n }\n for (const [cat, items] of categoryMap.entries()) {\n ordered.push({ category: cat, label: resolveCategoryLabel(t, tComponent, cat), items });\n }\n\n return ordered;\n }, [commandItems, categoryOrder, t, tComponent]);\n\n const recentItems = useMemo(() => {\n if (recentCommandIds.length === 0) return [];\n const itemById = new Map(commandItems.map(item => [item.id, item]));\n return recentCommandIds.map(id => itemById.get(id)).filter(Boolean) as CommandMenuItem[];\n }, [commandItems, recentCommandIds]);\n\n // ===================================================================\n // Omnibox record-search layer (policy: OMNIBOX)\n // ===================================================================\n //\n // A live, debounced query against each configured resource's addressable\n // SEARCH operation (falling back to LIST). This is the ONLY query-driven data\n // path in the command menu — static commands remain a synchronous, config-only\n // source. Scope + navigation reuse the proven `SidebarResourceBrowser`\n // precedent: the current org/user/app scope is projected into\n // `contextualParameters` (and `ScopedResourceRegistryProvider` additionally\n // injects the field-identifier-keyed org id onto every `doOperation`), and a\n // selection navigates to the record's addressable READ view.\n\n const [searchResultGroups, setSearchResultGroups] = useState<CommandMenuSearchResultGroup[]>([]);\n const [isSearching, setIsSearching] = useState(false);\n\n // Read mutable dependencies through refs so the debounced fetch effect only\n // re-fires on a genuine (isOpen, query, policy, resource-set) change — never\n // on incidental identity churn of the registry / scope / navigation handles\n // (see the react-effect-identity-churn discipline).\n const doOperationRef = useRef(doOperation);\n doOperationRef.current = doOperation;\n const registryRef = useRef(registry);\n registryRef.current = registry;\n const appScopeRef = useRef(appScope);\n appScopeRef.current = appScope;\n const navigateToResourceRef = useRef(navigateToResource);\n navigateToResourceRef.current = navigateToResource;\n const handleOpenChangeRef = useRef(handleOpenChange);\n handleOpenChangeRef.current = handleOpenChange;\n const tRef = useRef(t);\n tRef.current = t;\n const formatDateRef = useRef(formatDate);\n formatDateRef.current = formatDate;\n const formatDateTimeRef = useRef(formatDateTime);\n formatDateTimeRef.current = formatDateTime;\n const tComponentRef = useRef(tComponent);\n tComponentRef.current = tComponent;\n const searchResourcesRef = useRef(searchResources);\n searchResourcesRef.current = searchResources;\n const omniboxTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n /**\n * Project the current primary scope (user/org/app/anon) into the resource's\n * scope-filtered context identifiers — the same shape `SidebarResourceBrowser`\n * passes to `doOperation`. Keyed by resource type; the scoped provider maps\n * the org id to its field identifier (`organizationId`) on the wire.\n */\n const buildOmniboxScopeIdentifiers = useCallback((resourcePrimaryScope: unknown): Record<string, string> => {\n const scope = appScopeRef.current;\n const primaryScopeInitiatorIds = ScopeUtilsService.buildInitiatorIds({\n userId: scope?.currentUserId,\n organizationId: scope?.currentOrganizationId,\n applicationId: scope?.currentApplicationId,\n anonymousUserId: scope?.currentAnonymousUserId,\n });\n return {\n ...ScopeUtilsService.primaryScopeToContextIdentifiers(\n primaryScopeInitiatorIds,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourcePrimaryScope as any,\n ),\n ...(scope?.buildContextResourceIdentifiers() ?? {}),\n };\n }, []);\n\n /** Navigate to a matched record's addressable READ view, then close the menu. */\n const navigateToRecord = useCallback((resourceType: string, recordId: string): void => {\n const currentRegistry = registryRef.current;\n const resourceConfig = currentRegistry.resourceConfigurations[resourceType];\n if (!resourceConfig) return;\n\n const readOperation = pickPreferredOperationForCoreSemantic(\n resourceConfig.operations ?? [],\n CoreResourceOperation.READ,\n );\n if (!readOperation) {\n omniboxLogger.warn('[CommandMenu] Omnibox result has no addressable READ operation', { resourceType, recordId });\n return;\n }\n\n const contextIdentifiers = buildOmniboxRecordContextIdentifiers({\n scopeIdentifiers: buildOmniboxScopeIdentifiers(resourceConfig.resourcePrimaryScope),\n resourceType,\n recordId,\n registry: currentRegistry,\n });\n const parentResourcesRequirements = frontendResourceUtils.buildParentResourcesRequirements(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourceType as any,\n contextIdentifiers,\n currentRegistry,\n );\n const resourceContext = frontendResourceUtils.createFrontendResourceOperationContextFromOperation({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourceType: resourceType as any,\n operation: readOperation,\n contextResourceIdentifiers: contextIdentifiers,\n parentResourcesRequirements,\n });\n\n handleOpenChangeRef.current(false);\n navigateToResourceRef.current(\n resourceContext,\n NavigationUtils.createAppLevelInitiator(ApplicationLevelComponentType.COMMAND_MENU),\n );\n }, [buildOmniboxScopeIdentifiers]);\n\n // Stable key over the configured resource set — the fetch effect re-arms only\n // when the app changes which resources are searchable, not per render.\n const searchResourcesKey = useMemo(\n () => JSON.stringify(searchResources ?? []),\n [searchResources],\n );\n\n const shouldRunOmnibox = isOmnibox && !!searchResources && searchResources.length > 0;\n\n useEffect(() => {\n if (omniboxTimeoutRef.current) {\n clearTimeout(omniboxTimeoutRef.current);\n omniboxTimeoutRef.current = null;\n }\n\n // Below threshold, closed, or omnibox disabled → no query-driven results.\n if (!isOpen || !shouldRunOmnibox || searchQuery.trim().length < OMNIBOX_MIN_SEARCH_CHARS) {\n setSearchResultGroups([]);\n setIsSearching(false);\n return;\n }\n\n let cancelled = false;\n const query = searchQuery.trim();\n setIsSearching(true);\n\n const runSearch = async (): Promise<void> => {\n const currentRegistry = registryRef.current;\n const resources = searchResourcesRef.current ?? [];\n\n const groups = await Promise.all(resources.map(async (entry): Promise<CommandMenuSearchResultGroup | null> => {\n const resourceConfig = currentRegistry.resourceConfigurations[entry.resourceType];\n if (!resourceConfig) {\n omniboxLogger.warn('[CommandMenu] Omnibox searchResource not in registry — skipped', { resourceType: entry.resourceType });\n return null;\n }\n\n let operationPath: string;\n try {\n operationPath = FrontendResourceUtils.buildForeignKeySearchOperationPath(entry.resourceType, currentRegistry);\n } catch {\n omniboxLogger.warn('[CommandMenu] Omnibox resource has no searchable SEARCH/LIST operation — skipped', { resourceType: entry.resourceType });\n return null;\n }\n\n const searchParams = FrontendResourceUtils.buildForeignKeySearchParams(\n query,\n entry.maxResults ?? OMNIBOX_DEFAULT_MAX_RESULTS,\n { resourceType: entry.resourceType, registry: currentRegistry },\n );\n\n let result: unknown;\n try {\n result = await doOperationRef.current(operationPath, {\n contextualParameters: buildOmniboxScopeIdentifiers(resourceConfig.resourcePrimaryScope),\n queryParameters: searchParams.queryParameters,\n // The reference data mode: SUMMARY when a result's name is a virtual field (#3071), else RAW.\n dataMode: searchParams.dataMode,\n });\n } catch (err) {\n omniboxLogger.error('[CommandMenu] Omnibox search failed', { resourceType: entry.resourceType, ...extractErrorInfo(err), error: err });\n return null;\n }\n\n let items: Record<string, unknown>[] = [];\n if (Array.isArray(result)) {\n items = result as Record<string, unknown>[];\n } else if (result && typeof result === 'object') {\n const resultObj = result as { data?: Record<string, unknown>[]; items?: Record<string, unknown>[] };\n items = resultObj.data ?? resultObj.items ?? [];\n }\n if (items.length === 0) return null;\n\n const fieldIdentifier = FrontendResourceUtils.getResourceFieldIdentifierForType(entry.resourceType, currentRegistry);\n const category = entry.category ?? entry.resourceType;\n // Default to the richer SUMMARY view (the resource's summary card);\n // apps opt out to a one-line LABEL per resource. `ID` collapses to LABEL.\n const displayMode = entry.resultDisplay === ForeignKeyDisplayMode.LABEL\n || entry.resultDisplay === ForeignKeyDisplayMode.ID\n ? ForeignKeyDisplayMode.LABEL\n : ForeignKeyDisplayMode.SUMMARY;\n // The raw query is always carried as a keyword so cmdk's client-side\n // filter never drops a legitimate server hit (matches may be on a field\n // absent from the label, e.g. `description`). We also fold in the\n // LOCALIZED \"search\" verb synonyms so typing a translated synonym keeps\n // the group visible, plus any app-specific literal supplements.\n const baseKeywords = [\n query,\n ...resolveKeywordSynonyms(tComponentRef.current, 'keywordsSearch'),\n ...(entry.searchKeywords ?? []),\n ];\n\n const resultItems: CommandMenuSearchResultItem[] = items.flatMap((item) => {\n const id = FrontendResourceUtils.getResourceObjectId(item, fieldIdentifier);\n if (!id) return [];\n const label = FrontendResourceUtils.computeFrontendResourceLabel({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourceType: entry.resourceType as any,\n registry: currentRegistry,\n currentObject: item,\n t: tRef.current,\n formatDate: formatDateRef.current,\n formatDateTime: formatDateTimeRef.current,\n }) ?? id;\n return [{\n id: `omnibox:${entry.resourceType}:${id}`,\n resourceType: entry.resourceType,\n record: item,\n label,\n keywords: baseKeywords,\n onExecute: () => navigateToRecord(entry.resourceType, id),\n }];\n });\n\n if (resultItems.length === 0) return null;\n return {\n category,\n label: resolveSearchGroupLabel(tRef.current, tComponentRef.current, entry),\n displayMode,\n items: resultItems,\n };\n }));\n\n if (cancelled) return;\n setSearchResultGroups(groups.filter((group): group is CommandMenuSearchResultGroup => group !== null));\n setIsSearching(false);\n };\n\n omniboxTimeoutRef.current = setTimeout(() => {\n void runSearch();\n }, OMNIBOX_SEARCH_DEBOUNCE_MS);\n\n return () => {\n cancelled = true;\n if (omniboxTimeoutRef.current) {\n clearTimeout(omniboxTimeoutRef.current);\n omniboxTimeoutRef.current = null;\n }\n };\n }, [isOpen, searchQuery, shouldRunOmnibox, searchResourcesKey, buildOmniboxScopeIdentifiers, navigateToRecord]);\n\n // ===================================================================\n // Unified, ordered palette group list (records + commands, one axis)\n // ===================================================================\n //\n // A single ordering model: every renderable group (live record group +\n // static command-category group) is assigned ONE numeric `order` weight and\n // the merged list is sorted by it. Record groups take the low band (default\n // above commands, so live matches surface first while searching); the app\n // overrides a record group's slot via `CommandMenuSearchResource.order`.\n // Command categories keep their pre-existing relative sequence\n // (`categoryOrder`) inside the high band. The recent group is pinned\n // separately and is not part of this list.\n const recordOrderByCategory = useMemo(() => {\n const map = new Map<string, number>();\n (searchResources ?? []).forEach((entry, index) => {\n const category = entry.category ?? entry.resourceType;\n map.set(category, entry.order ?? RECORD_GROUP_ORDER_BASE + index);\n });\n return map;\n }, [searchResources]);\n\n /*\n * A record group's heading, worded at RENDER (#3122). The group is built when the search answers, but its words may\n * land later: a group with no declared category is headed by its resource's title, whose bundle `t` requests on the\n * first miss. Wording it here, from the current `t`, shows the word as soon as it arrives instead of keeping the key\n * the first search saw.\n */\n const searchEntryByCategory = useMemo(() => {\n const map = new Map<string, CommandMenuSearchResource>();\n for (const entry of searchResources ?? []) map.set(entry.category ?? entry.resourceType, entry);\n return map;\n }, [searchResources]);\n const labelledSearchResultGroups = useMemo((): CommandMenuSearchResultGroup[] => searchResultGroups.map((group) => {\n const entry = searchEntryByCategory.get(group.category);\n return entry ? { ...group, label: resolveSearchGroupLabel(t, tComponent, entry) } : group;\n }), [searchResultGroups, searchEntryByCategory, t, tComponent]);\n\n const orderedGroups = useMemo((): CommandMenuPaletteGroup[] => {\n const entries: CommandMenuPaletteGroup[] = [];\n labelledSearchResultGroups.forEach((group, index) => {\n entries.push({\n kind: CommandMenuPaletteGroupKind.RECORDS,\n order: recordOrderByCategory.get(group.category) ?? RECORD_GROUP_ORDER_BASE + index,\n group,\n });\n });\n groupedItems.forEach((group, index) => {\n entries.push({\n kind: CommandMenuPaletteGroupKind.COMMANDS,\n order: COMMAND_GROUP_ORDER_BASE + index,\n group,\n });\n });\n // Stable sort by the single order axis (index tiebreak preserves the\n // per-source sequence when two groups share a weight).\n return entries\n .map((entry, index) => ({ entry, index }))\n .sort((a, b) => a.entry.order - b.entry.order || a.index - b.index)\n .map(({ entry }) => entry);\n }, [labelledSearchResultGroups, groupedItems, recordOrderByCategory]);\n\n return {\n isOpen,\n handleOpenChange,\n searchQuery,\n setSearchQuery,\n commandItems,\n groupedItems,\n recentItems,\n searchResultGroups: labelledSearchResultGroups,\n orderedGroups,\n isSearching,\n isNavigationLoading: !resolutionCtx,\n showRecent,\n showShortcuts,\n openShortcut,\n authoredDialogWidth,\n };\n}\n\n/**\n * The context identifiers of ONE record opened from an omnibox result (#3548, the #2746 invariant).\n *\n * The omnibox SEARCHES within the viewer's whole working scope — the tenancy and a list selected in a quick-switcher —\n * and that is right for a search. The record it finds is not known to belong to the selected list: carried into the\n * record's context, the selection became a parent of its chain, so a todo of list B found while list A was selected was\n * navigated to and read under A, and refused. A record is opened in ITS scope instead, by the rule every other surface\n * that opens a record by id applies (`scopeReferencedRecord`, #2741): the tenancy when its READ is reachable from there,\n * else the working scope it was found in, which is then the only place a parent can come from.\n */\nexport function buildOmniboxRecordContextIdentifiers(params: {\n scopeIdentifiers: Record<string, string>;\n resourceType: string;\n recordId: string;\n registry: FrontendResourcesRegistry;\n}): Record<string, string> {\n return {\n ...scopeReferencedRecord({\n hostIdentifiers: params.scopeIdentifiers,\n hostContextualParameters: {},\n targetResourceType: params.resourceType,\n targetId: params.recordId,\n registry: params.registry,\n }).identifiers,\n [params.resourceType]: params.recordId,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useCommandMenuBehavior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;;;;;;;GASG;AACH,MAAM,UAAU,oCAAoC,CAAC,MAKpD;IACC,OAAO;QACL,GAAG,qBAAqB,CAAC;YACvB,eAAe,EAAE,MAAM,CAAC,gBAAgB;YACxC,wBAAwB,EAAE,EAAE;YAC5B,kBAAkB,EAAE,MAAM,CAAC,YAAY;YACvC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC,WAAW;QACd,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,QAAQ;KACvC,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { CommandMenuEngineCategory, FrontendComponentType, LabellingTypes, isCommandMenuEngineCategory } from '@wildo-ai/presets-components-models';\nimport { CoreResourceOperation } from '@wildo-ai/saas-models';\nimport { ForeignKeyDisplayMode } from '@wildo-ai/zod-decorators';\n\nimport {\n ApplicationLevelComponentType,\n HotkeyGroup,\n HotkeyScope,\n} from '~wildo-frontend-lib/core/config/app-level-components.frontend.schemas';\nimport { CommandMenuDisplayPolicy } from '~wildo-frontend-lib/core/config/app-level-components.frontend.schemas';\nimport { CommandBarPolicy } from '~wildo-frontend-lib/core/config/app-configuration-frontend.schemas';\nimport type { CommandMenuCommand, CommandMenuSearchResource } from '~wildo-frontend-lib/core/config/launcher-items.frontend.schemas';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { ScopeUtilsService } from '~wildo-frontend-lib/core/scope/scope.utils.frontend.service';\nimport { frontendResourceUtils, FrontendResourceUtils } from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport { scopeReferencedRecord } from '~wildo-frontend-lib/core/resources/referenced-record-scope.frontend.utils';\nimport type { FrontendResourcesRegistry } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport {\n pickPreferredOperationForCoreSemantic,\n resolveEffectiveCoreOperationFromOperation,\n type ResourceOperationSemanticsLike,\n} from '~wildo-frontend-lib/core/resources/operation-semantics.frontend.utils';\nimport { extractErrorInfo } from '~wildo-frontend-lib/core/errors/errors.frontend.schemas';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport {\n FrontendEvents,\n type FrontendEvent_HotkeyCommandMenuOpen,\n} from '~wildo-frontend-lib/core/events/events.frontend.schemas';\nimport { useEventBus } from '~wildo-frontend-lib/core/events/useEventBus';\nimport {\n filterCommandMenuCommandsByRuntimeAvailability,\n useLauncherRuntimeAvailabilityContext,\n} from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport { NavigationUtils } from '~wildo-frontend-lib/core/navigation/navigation.utils';\nimport { resolveCommandMenuCommands, type ResolvedCommandMenuItem } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { ApplicationContext } from '~wildo-frontend-lib/core/runtime/ApplicationContext.shared';\nimport { withEngineClientsCommand, withEngineDecisionInboxCommand } from '~wildo-frontend-lib/components/navigation/app-level/engine-launcher-entries';\nimport { useLauncherResolutionContext } from '~wildo-frontend-lib/core/navigation/useLauncherResolutionContext';\nimport { useNavigationController } from '~wildo-frontend-lib/core/navigation/useNavigationController';\nimport { useUI } from '~wildo-frontend-lib/core/ui/useUI';\nimport { useHotkeyRegistry } from '~wildo-frontend-lib/core/hotkey/useHotkey';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\n\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport type {\n CommandMenuBehavior,\n CommandMenuItem,\n CommandMenuGroup,\n CommandMenuSearchResultItem,\n CommandMenuSearchResultGroup,\n CommandMenuPaletteGroup,\n} from '~wildo-frontend-lib/core/app-shell/app-shell.schemas';\nimport { CommandMenuPaletteGroupKind } from '~wildo-frontend-lib/core/app-shell/app-shell.schemas';\nimport { rankByCommandScore } from '~wildo-frontend-lib/core/search/command-score';\n\nconst DEFAULT_CATEGORY_ORDER: readonly string[] = [CommandMenuEngineCategory.NAVIGATION, CommandMenuEngineCategory.ACTIONS];\n\n/**\n * Order weights for the SINGLE palette ordering axis. Record groups occupy the\n * low band (0..), static command-category groups the high band (1000..), so\n * live record matches surface ABOVE static commands by default while searching.\n * An app overrides per record group via `CommandMenuSearchResource.order`.\n */\nconst RECORD_GROUP_ORDER_BASE = 0;\nconst COMMAND_GROUP_ORDER_BASE = 1000;\n\n/** Omnibox record-search tuning — mirrors `useResourceSearch` (FK picker). */\nconst OMNIBOX_SEARCH_DEBOUNCE_MS = 300;\nconst OMNIBOX_MIN_SEARCH_CHARS = 2;\nconst OMNIBOX_DEFAULT_MAX_RESULTS = 5;\n\nconst omniboxLogger: LoggerFrontendService = LoggerFrontendService.getLogger();\n\n/**\n * Maps a command's core operation semantic to the command-menu component label\n * key holding that operation's LOCALIZED search synonyms (a comma-separated\n * list). `_MANY` variants share their base action's synonyms. Operations\n * without a meaningful synonym set (COUNT) are omitted — they contribute no\n * extra keywords and the command's localized label still matches.\n */\nconst OPERATION_KEYWORD_LABEL_KEY: Partial<Record<CoreResourceOperation, string>> = {\n [CoreResourceOperation.CREATE]: 'keywordsCreate',\n [CoreResourceOperation.CREATE_MANY]: 'keywordsCreate',\n [CoreResourceOperation.LIST]: 'keywordsList',\n [CoreResourceOperation.SEARCH]: 'keywordsSearch',\n [CoreResourceOperation.READ]: 'keywordsRead',\n [CoreResourceOperation.UPDATE]: 'keywordsUpdate',\n [CoreResourceOperation.UPDATE_MANY]: 'keywordsUpdate',\n [CoreResourceOperation.DELETE]: 'keywordsDelete',\n [CoreResourceOperation.DELETE_MANY]: 'keywordsDelete',\n};\n\ntype TComponentFn = (component: FrontendComponentType, key: string, params?: Record<string, string | number>) => string;\n\n/**\n * Resolve a command-menu component keyword label into its list of localized\n * synonyms. The label is authored (and translated) as a comma-separated string;\n * we split it into individual match terms. Fails OPEN to `[]` when the key is\n * not yet generated (`tComponent` returns the raw key path) so a missing\n * translation never injects the literal key path as a bogus keyword.\n */\nfunction resolveKeywordSynonyms(tComponent: TComponentFn, key: string): string[] {\n const componentType = FrontendComponentType.APPLICATION_LEVEL_COMMAND_MENU;\n const base = `components.${componentType}.${key}`;\n const resolved = tComponent(componentType, key);\n if (!resolved || resolved === base) return [];\n return resolved.split(',').map(term => term.trim()).filter(Boolean);\n}\n\n/** Localized verb synonyms for a resource-operation command's core semantic. */\nfunction resolveOperationKeywords(\n tComponent: TComponentFn,\n operation: ResourceOperationSemanticsLike | undefined,\n): string[] {\n if (!operation) return [];\n const coreOperation = resolveEffectiveCoreOperationFromOperation(operation);\n const key = coreOperation ? OPERATION_KEYWORD_LABEL_KEY[coreOperation] : undefined;\n return key ? resolveKeywordSynonyms(tComponent, key) : [];\n}\n\n/**\n * The category heading a person reads, from the label tree and nowhere else.\n *\n * This was `resolved === baseKey ? humanizeCategory(category) : resolved` — the exact shape\n * `.claude/rules/display-text-comes-from-i18n.md` names as forbidden, and the reason it is forbidden\n * is visible here: the formatter ran ONLY when the label was missing, which is precisely the case\n * somebody needs to notice. The palette read as finished in every locale, so the keys were never\n * authored and a French user was shown English produced by code — invisible to a translator, because\n * it was never in the tree at all.\n *\n * `tComponent` already answers with the KEY when it cannot resolve one, so returning its answer\n * unchanged IS the missing-looks-missing behaviour. A category with no label now shows its key,\n * which is what makes somebody author it.\n *\n * Whose words, by whose category (#3122). The engine's own categories ({@link CommandMenuEngineCategory}) are worded\n * on the command menu component. Any other category is the APPLICATION's ref, worded under\n * `command_categories.<category>.label`, which the labelling pipeline plans from the application's commands and\n * record searches. Reading an application's ref from the engine component's unit (as this did) left every\n * application-defined heading showing its key, since nothing could ever plan it there.\n */\nfunction resolveCategoryLabel(\n t: (key: string) => string,\n tComponent: (component: FrontendComponentType, key: string, params?: Record<string, string | number>) => string,\n category: string,\n): string {\n return isCommandMenuEngineCategory(category)\n ? tComponent(FrontendComponentType.APPLICATION_LEVEL_COMMAND_MENU, category)\n : t(`${LabellingTypes.COMMAND_CATEGORIES}.${category}.label`);\n}\n\n/**\n * The heading of a record-search group (#3122): its declared category's words, or, when the entry names none, the\n * resource's own title, since the group IS the resource's records.\n */\nexport function resolveSearchGroupLabel(\n t: (key: string) => string,\n tComponent: (component: FrontendComponentType, key: string, params?: Record<string, string | number>) => string,\n entry: { readonly resourceType: string; readonly category?: string },\n): string {\n return entry.category !== undefined\n ? resolveCategoryLabel(t, tComponent, entry.category)\n : t(`${LabellingTypes.RESOURCES}.${entry.resourceType}.header.title`);\n}\n\nfunction isCommandMenuConfigObject(\n config: unknown,\n): config is {\n policy?: CommandBarPolicy;\n showRecent?: boolean;\n maxRecentItems?: number;\n showShortcuts?: boolean;\n openShortcut?: string;\n defaultCategory?: string;\n categoryOrder?: string[];\n commands?: CommandMenuCommand[];\n searchResources?: CommandMenuSearchResource[];\n dialogWidth?: string;\n} {\n return typeof config === 'object' && config !== null && !Array.isArray(config);\n}\n\n/**\n * Behavior hook for CommandMenu — manages open state (controlled or\n * uncontrolled), search, recent commands, hotkey subscription, and\n * navigation items mapped to command menu entries.\n */\nexport function useCommandMenuBehavior(\n externalIsOpen?: boolean,\n onOpenChange?: (open: boolean) => void,\n options: { listenForHotkeys?: boolean } = {},\n): CommandMenuBehavior {\n const resolutionCtx = useLauncherResolutionContext();\n const { navigate, navigateToResource } = useNavigationController();\n const { registry, doOperation } = useResourceRegistry();\n const appScope = useAppScopeSafe();\n const { appComponentsConfiguration, suppressedEngineNavigationEntries } = useUI();\n const { on, emit } = useEventBus();\n const { register } = useHotkeyRegistry();\n const { t, tComponent, formatDate, formatDateTime } = useI18n({\n component: FrontendComponentType.APPLICATION_LEVEL_COMMAND_MENU,\n });\n\n const commandMenuConfig = appComponentsConfiguration?.[ApplicationLevelComponentType.COMMAND_MENU];\n const commandMenuObj = isCommandMenuConfigObject(commandMenuConfig) ? commandMenuConfig : undefined;\n const openShortcut = commandMenuObj?.openShortcut;\n const showRecent = commandMenuObj?.showRecent !== false;\n const maxRecentItems = commandMenuObj?.maxRecentItems ?? 5;\n const showShortcuts = commandMenuObj?.showShortcuts !== false;\n const defaultCategory = commandMenuObj?.defaultCategory ?? CommandMenuEngineCategory.NAVIGATION;\n const categoryOrder = commandMenuObj?.categoryOrder ?? DEFAULT_CATEGORY_ORDER;\n const isOmnibox = commandMenuObj?.policy === CommandBarPolicy.OMNIBOX;\n const searchResources = commandMenuObj?.searchResources;\n // The application's authored width only; the preset owns the default (#1828).\n const authoredDialogWidth = commandMenuObj?.dialogWidth;\n const runtimeAvailabilityContext = useLauncherRuntimeAvailabilityContext();\n // The engine's own command (#2527): the decision inbox, beside the application's, gated like its sidebar twin. Read\n // optionally: the command menu needs no application otherwise, and without one it simply offers no inbox.\n const decisionInboxOffer = useContext(ApplicationContext)?.appConfig?.decisionInbox;\n const configCommands = useMemo(() => (\n filterCommandMenuCommandsByRuntimeAvailability(\n withEngineClientsCommand(withEngineDecisionInboxCommand(commandMenuObj?.commands, decisionInboxOffer), suppressedEngineNavigationEntries),\n runtimeAvailabilityContext,\n )\n ), [commandMenuObj?.commands, decisionInboxOffer, suppressedEngineNavigationEntries, runtimeAvailabilityContext]);\n\n const [internalIsOpen, setInternalIsOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [recentCommandIds, setRecentCommandIds] = useState<string[]>([]);\n\n const isControlled = externalIsOpen !== undefined && onOpenChange !== undefined;\n const isOpen = isControlled ? externalIsOpen : internalIsOpen;\n const isOpenRef = useRef(isOpen);\n isOpenRef.current = isOpen;\n const listenForHotkeys = options.listenForHotkeys !== false;\n\n const handleOpenChange = useCallback((open: boolean) => {\n if (isControlled && onOpenChange) {\n onOpenChange(open);\n } else {\n setInternalIsOpen(open);\n }\n if (!open) {\n setSearchQuery('');\n }\n }, [isControlled, onOpenChange]);\n\n useEffect(() => {\n if (!listenForHotkeys) return;\n const unsubscribe = on(FrontendEvents.HOTKEY_COMMAND_MENU_OPEN, () => {\n handleOpenChange(!isOpenRef.current);\n });\n return unsubscribe;\n }, [on, handleOpenChange, listenForHotkeys]);\n\n useEffect(() => {\n if (!listenForHotkeys) return;\n if (!openShortcut || commandMenuConfig === false) return;\n return register({\n id: 'app-command-menu-open-shortcut',\n shortcut: openShortcut,\n description: t('engine.hotkeys.commandMenuOpen'),\n scope: HotkeyScope.GLOBAL,\n group: HotkeyGroup.NAVIGATION,\n launcher: ApplicationLevelComponentType.COMMAND_MENU,\n preventDefault: true,\n handler: () => {\n emit(FrontendEvents.HOTKEY_COMMAND_MENU_OPEN, {} as FrontendEvent_HotkeyCommandMenuOpen);\n },\n });\n }, [openShortcut, commandMenuConfig, register, emit, t, listenForHotkeys]);\n\n const resolvedCommands = useMemo((): ResolvedCommandMenuItem[] => {\n if (!configCommands || !resolutionCtx) return [];\n return resolveCommandMenuCommands(configCommands, resolutionCtx);\n }, [configCommands, resolutionCtx]);\n\n const commandItems = useMemo((): CommandMenuItem[] => {\n return resolvedCommands\n .filter(cmd => {\n const dp = cmd.displayPolicy;\n if (dp === undefined || dp === CommandMenuDisplayPolicy.ALWAYS) return true;\n if (dp === CommandMenuDisplayPolicy.NEVER) return false;\n if (dp === CommandMenuDisplayPolicy.RECENT) return true;\n if (dp === CommandMenuDisplayPolicy.CONTEXTUAL) {\n if (envLoader.isDevelopment()) {\n console.warn(`[CommandMenu] CONTEXTUAL displayPolicy requires a contextual source and is excluded from the global app-level menu for \"${cmd.id}\"`);\n }\n return false;\n }\n if (envLoader.isDevelopment()) {\n console.warn(`[CommandMenu] Unknown displayPolicy \"${dp}\" for command \"${cmd.id}\" — treating as ALWAYS`);\n }\n return true;\n })\n .map(cmd => ({\n id: cmd.id,\n label: cmd.label,\n shortcut: cmd.shortcut ?? '',\n iconReference: cmd.iconReference,\n category: cmd.category ?? defaultCategory,\n // Localized operation-verb synonyms (translated) + any app-specific\n // literal supplements. The command's localized `label` covers the noun.\n keywords: [\n ...resolveOperationKeywords(tComponent, cmd.operation),\n ...(cmd.searchKeywords ?? []),\n ],\n displayPolicy: cmd.displayPolicy,\n onExecute: () => {\n handleOpenChange(false);\n setRecentCommandIds(prev => {\n const next = [cmd.id, ...prev.filter(id => id !== cmd.id)];\n return next.slice(0, maxRecentItems);\n });\n if (cmd.urlPath) {\n NavigationUtils.dispatchNavigationForResolvedTarget(navigate, cmd, ApplicationLevelComponentType.COMMAND_MENU);\n }\n },\n }));\n }, [resolvedCommands, handleOpenChange, navigate, maxRecentItems, defaultCategory, tComponent]);\n\n const groupedItems = useMemo((): CommandMenuGroup[] => {\n const categoryMap = new Map<string, CommandMenuItem[]>();\n\n for (const item of commandItems) {\n if (item.displayPolicy === CommandMenuDisplayPolicy.RECENT) continue;\n const category = item.category;\n const existing = categoryMap.get(category) ?? [];\n existing.push(item);\n categoryMap.set(category, existing);\n }\n\n for (const items of categoryMap.values()) {\n items.sort((a, b) => a.label.localeCompare(b.label));\n }\n\n const ordered: CommandMenuGroup[] = [];\n for (const cat of categoryOrder) {\n const items = categoryMap.get(cat);\n if (items) {\n ordered.push({ category: cat, label: resolveCategoryLabel(t, tComponent, cat), items });\n categoryMap.delete(cat);\n }\n }\n for (const [cat, items] of categoryMap.entries()) {\n ordered.push({ category: cat, label: resolveCategoryLabel(t, tComponent, cat), items });\n }\n\n return ordered;\n }, [commandItems, categoryOrder, t, tComponent]);\n\n const recentCommands = useMemo(() => {\n if (recentCommandIds.length === 0) return [];\n const itemById = new Map(commandItems.map(item => [item.id, item]));\n return recentCommandIds.map(id => itemById.get(id)).filter(Boolean) as CommandMenuItem[];\n }, [commandItems, recentCommandIds]);\n\n /*\n * Text search is this hook's (#1828), so every renderer shows the same matches: a command matches `searchQuery` by\n * `commandScore` over `\"<id> <label>\"` and its keywords, the scorer and value the palette's `cmdk` used when it filtered\n * by itself, and the matches come best first. The preset now renders these lists as they are (`shouldFilter={false}`).\n */\n const recentItems = useMemo(\n () => rankByCommandScore(recentCommands, searchQuery, commandSearchValueOf, (item) => item.keywords),\n [recentCommands, searchQuery],\n );\n\n // ===================================================================\n // Omnibox record-search layer (policy: OMNIBOX)\n // ===================================================================\n //\n // A live, debounced query against each configured resource's addressable\n // SEARCH operation (falling back to LIST). This is the ONLY query-driven data\n // path in the command menu — static commands remain a synchronous, config-only\n // source. Scope + navigation reuse the proven `SidebarResourceBrowser`\n // precedent: the current org/user/app scope is projected into\n // `contextualParameters` (and `ScopedResourceRegistryProvider` additionally\n // injects the field-identifier-keyed org id onto every `doOperation`), and a\n // selection navigates to the record's addressable READ view.\n\n const [searchResultGroups, setSearchResultGroups] = useState<CommandMenuSearchResultGroup[]>([]);\n const [isSearching, setIsSearching] = useState(false);\n\n // Read mutable dependencies through refs so the debounced fetch effect only\n // re-fires on a genuine (isOpen, query, policy, resource-set) change — never\n // on incidental identity churn of the registry / scope / navigation handles\n // (see the react-effect-identity-churn discipline).\n const doOperationRef = useRef(doOperation);\n doOperationRef.current = doOperation;\n const registryRef = useRef(registry);\n registryRef.current = registry;\n const appScopeRef = useRef(appScope);\n appScopeRef.current = appScope;\n const navigateToResourceRef = useRef(navigateToResource);\n navigateToResourceRef.current = navigateToResource;\n const handleOpenChangeRef = useRef(handleOpenChange);\n handleOpenChangeRef.current = handleOpenChange;\n const tRef = useRef(t);\n tRef.current = t;\n const formatDateRef = useRef(formatDate);\n formatDateRef.current = formatDate;\n const formatDateTimeRef = useRef(formatDateTime);\n formatDateTimeRef.current = formatDateTime;\n const tComponentRef = useRef(tComponent);\n tComponentRef.current = tComponent;\n const searchResourcesRef = useRef(searchResources);\n searchResourcesRef.current = searchResources;\n const omniboxTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n /**\n * Project the current primary scope (user/org/app/anon) into the resource's\n * scope-filtered context identifiers — the same shape `SidebarResourceBrowser`\n * passes to `doOperation`. Keyed by resource type; the scoped provider maps\n * the org id to its field identifier (`organizationId`) on the wire.\n */\n const buildOmniboxScopeIdentifiers = useCallback((resourcePrimaryScope: unknown): Record<string, string> => {\n const scope = appScopeRef.current;\n const primaryScopeInitiatorIds = ScopeUtilsService.buildInitiatorIds({\n userId: scope?.currentUserId,\n organizationId: scope?.currentOrganizationId,\n applicationId: scope?.currentApplicationId,\n anonymousUserId: scope?.currentAnonymousUserId,\n });\n return {\n ...ScopeUtilsService.primaryScopeToContextIdentifiers(\n primaryScopeInitiatorIds,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourcePrimaryScope as any,\n ),\n ...(scope?.buildContextResourceIdentifiers() ?? {}),\n };\n }, []);\n\n /** Navigate to a matched record's addressable READ view, then close the menu. */\n const navigateToRecord = useCallback((resourceType: string, recordId: string): void => {\n const currentRegistry = registryRef.current;\n const resourceConfig = currentRegistry.resourceConfigurations[resourceType];\n if (!resourceConfig) return;\n\n const readOperation = pickPreferredOperationForCoreSemantic(\n resourceConfig.operations ?? [],\n CoreResourceOperation.READ,\n );\n if (!readOperation) {\n omniboxLogger.warn('[CommandMenu] Omnibox result has no addressable READ operation', { resourceType, recordId });\n return;\n }\n\n const contextIdentifiers = buildOmniboxRecordContextIdentifiers({\n scopeIdentifiers: buildOmniboxScopeIdentifiers(resourceConfig.resourcePrimaryScope),\n resourceType,\n recordId,\n registry: currentRegistry,\n });\n const parentResourcesRequirements = frontendResourceUtils.buildParentResourcesRequirements(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourceType as any,\n contextIdentifiers,\n currentRegistry,\n );\n const resourceContext = frontendResourceUtils.createFrontendResourceOperationContextFromOperation({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourceType: resourceType as any,\n operation: readOperation,\n contextResourceIdentifiers: contextIdentifiers,\n parentResourcesRequirements,\n });\n\n handleOpenChangeRef.current(false);\n navigateToResourceRef.current(\n resourceContext,\n NavigationUtils.createAppLevelInitiator(ApplicationLevelComponentType.COMMAND_MENU),\n );\n }, [buildOmniboxScopeIdentifiers]);\n\n // Stable key over the configured resource set — the fetch effect re-arms only\n // when the app changes which resources are searchable, not per render.\n const searchResourcesKey = useMemo(\n () => JSON.stringify(searchResources ?? []),\n [searchResources],\n );\n\n const shouldRunOmnibox = isOmnibox && !!searchResources && searchResources.length > 0;\n\n useEffect(() => {\n if (omniboxTimeoutRef.current) {\n clearTimeout(omniboxTimeoutRef.current);\n omniboxTimeoutRef.current = null;\n }\n\n // Below threshold, closed, or omnibox disabled → no query-driven results.\n if (!isOpen || !shouldRunOmnibox || searchQuery.trim().length < OMNIBOX_MIN_SEARCH_CHARS) {\n setSearchResultGroups([]);\n setIsSearching(false);\n return;\n }\n\n let cancelled = false;\n const query = searchQuery.trim();\n setIsSearching(true);\n\n const runSearch = async (): Promise<void> => {\n const currentRegistry = registryRef.current;\n const resources = searchResourcesRef.current ?? [];\n\n const groups = await Promise.all(resources.map(async (entry): Promise<CommandMenuSearchResultGroup | null> => {\n const resourceConfig = currentRegistry.resourceConfigurations[entry.resourceType];\n if (!resourceConfig) {\n omniboxLogger.warn('[CommandMenu] Omnibox searchResource not in registry — skipped', { resourceType: entry.resourceType });\n return null;\n }\n\n let operationPath: string;\n try {\n operationPath = FrontendResourceUtils.buildForeignKeySearchOperationPath(entry.resourceType, currentRegistry);\n } catch {\n omniboxLogger.warn('[CommandMenu] Omnibox resource has no searchable SEARCH/LIST operation — skipped', { resourceType: entry.resourceType });\n return null;\n }\n\n const searchParams = FrontendResourceUtils.buildForeignKeySearchParams(\n query,\n entry.maxResults ?? OMNIBOX_DEFAULT_MAX_RESULTS,\n { resourceType: entry.resourceType, registry: currentRegistry },\n );\n\n let result: unknown;\n try {\n result = await doOperationRef.current(operationPath, {\n contextualParameters: buildOmniboxScopeIdentifiers(resourceConfig.resourcePrimaryScope),\n queryParameters: searchParams.queryParameters,\n // The reference data mode: SUMMARY when a result's name is a virtual field (#3071), else RAW.\n dataMode: searchParams.dataMode,\n });\n } catch (err) {\n omniboxLogger.error('[CommandMenu] Omnibox search failed', { resourceType: entry.resourceType, ...extractErrorInfo(err), error: err });\n return null;\n }\n\n let items: Record<string, unknown>[] = [];\n if (Array.isArray(result)) {\n items = result as Record<string, unknown>[];\n } else if (result && typeof result === 'object') {\n const resultObj = result as { data?: Record<string, unknown>[]; items?: Record<string, unknown>[] };\n items = resultObj.data ?? resultObj.items ?? [];\n }\n if (items.length === 0) return null;\n\n const fieldIdentifier = FrontendResourceUtils.getResourceFieldIdentifierForType(entry.resourceType, currentRegistry);\n const category = entry.category ?? entry.resourceType;\n // Default to the richer SUMMARY view (the resource's summary card);\n // apps opt out to a one-line LABEL per resource. `ID` collapses to LABEL.\n const displayMode = entry.resultDisplay === ForeignKeyDisplayMode.LABEL\n || entry.resultDisplay === ForeignKeyDisplayMode.ID\n ? ForeignKeyDisplayMode.LABEL\n : ForeignKeyDisplayMode.SUMMARY;\n // The raw query is always carried as a keyword so the client-side match\n // never drops a legitimate server hit (matches may be on a field\n // absent from the label, e.g. `description`). We also fold in the\n // LOCALIZED \"search\" verb synonyms so typing a translated synonym keeps\n // the group visible, plus any app-specific literal supplements.\n const baseKeywords = [\n query,\n ...resolveKeywordSynonyms(tComponentRef.current, 'keywordsSearch'),\n ...(entry.searchKeywords ?? []),\n ];\n\n const resultItems: CommandMenuSearchResultItem[] = items.flatMap((item) => {\n const id = FrontendResourceUtils.getResourceObjectId(item, fieldIdentifier);\n if (!id) return [];\n const label = FrontendResourceUtils.computeFrontendResourceLabel({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resourceType: entry.resourceType as any,\n registry: currentRegistry,\n currentObject: item,\n t: tRef.current,\n formatDate: formatDateRef.current,\n formatDateTime: formatDateTimeRef.current,\n }) ?? id;\n return [{\n id: `omnibox:${entry.resourceType}:${id}`,\n resourceType: entry.resourceType,\n record: item,\n label,\n keywords: baseKeywords,\n onExecute: () => navigateToRecord(entry.resourceType, id),\n }];\n });\n\n if (resultItems.length === 0) return null;\n return {\n category,\n label: resolveSearchGroupLabel(tRef.current, tComponentRef.current, entry),\n displayMode,\n items: resultItems,\n };\n }));\n\n if (cancelled) return;\n setSearchResultGroups(groups.filter((group): group is CommandMenuSearchResultGroup => group !== null));\n setIsSearching(false);\n };\n\n omniboxTimeoutRef.current = setTimeout(() => {\n void runSearch();\n }, OMNIBOX_SEARCH_DEBOUNCE_MS);\n\n return () => {\n cancelled = true;\n if (omniboxTimeoutRef.current) {\n clearTimeout(omniboxTimeoutRef.current);\n omniboxTimeoutRef.current = null;\n }\n };\n }, [isOpen, searchQuery, shouldRunOmnibox, searchResourcesKey, buildOmniboxScopeIdentifiers, navigateToRecord]);\n\n // ===================================================================\n // Unified, ordered palette group list (records + commands, one axis)\n // ===================================================================\n //\n // A single ordering model: every renderable group (live record group +\n // static command-category group) is assigned ONE numeric `order` weight and\n // the merged list is sorted by it. Record groups take the low band (default\n // above commands, so live matches surface first while searching); the app\n // overrides a record group's slot via `CommandMenuSearchResource.order`.\n // Command categories keep their pre-existing relative sequence\n // (`categoryOrder`) inside the high band. The recent group is pinned\n // separately and is not part of this list.\n const recordOrderByCategory = useMemo(() => {\n const map = new Map<string, number>();\n (searchResources ?? []).forEach((entry, index) => {\n const category = entry.category ?? entry.resourceType;\n map.set(category, entry.order ?? RECORD_GROUP_ORDER_BASE + index);\n });\n return map;\n }, [searchResources]);\n\n /*\n * A record group's heading, worded at RENDER (#3122). The group is built when the search answers, but its words may\n * land later: a group with no declared category is headed by its resource's title, whose bundle `t` requests on the\n * first miss. Wording it here, from the current `t`, shows the word as soon as it arrives instead of keeping the key\n * the first search saw.\n */\n const searchEntryByCategory = useMemo(() => {\n const map = new Map<string, CommandMenuSearchResource>();\n for (const entry of searchResources ?? []) map.set(entry.category ?? entry.resourceType, entry);\n return map;\n }, [searchResources]);\n const labelledSearchResultGroups = useMemo((): CommandMenuSearchResultGroup[] => searchResultGroups.map((group) => {\n const entry = searchEntryByCategory.get(group.category);\n return entry ? { ...group, label: resolveSearchGroupLabel(t, tComponent, entry) } : group;\n }), [searchResultGroups, searchEntryByCategory, t, tComponent]);\n\n const orderedGroups = useMemo(\n (): CommandMenuPaletteGroup[] => paletteGroupsFor({ searchResultGroups: labelledSearchResultGroups, commandGroups: groupedItems, recordOrderByCategory, searchQuery }),\n [labelledSearchResultGroups, groupedItems, recordOrderByCategory, searchQuery],\n );\n\n return {\n isOpen,\n handleOpenChange,\n searchQuery,\n setSearchQuery,\n commandItems,\n groupedItems,\n recentItems,\n searchResultGroups: labelledSearchResultGroups,\n orderedGroups,\n isSearching,\n isNavigationLoading: !resolutionCtx,\n showRecent,\n showShortcuts,\n openShortcut,\n authoredDialogWidth,\n };\n}\n\n/** A command's value for the search: its id and label, as the palette's `cmdk` items were valued. */\nconst commandSearchValueOf = <T extends { id: string; label: string }>(item: T): string => `${item.id} ${item.label}`;\n\n/**\n * The palette's groups, in render order, holding what matches `searchQuery` (#1828): the one place the command menu's text\n * search decides what a renderer shows, so the hook and a renderer that is not the DOM agree.\n *\n * - Record groups are the server's answer, ranked by `commandScore`, the scorer the palette's `cmdk` ranked them with. A\n * result carries the query it was found for among its keywords, so a hit on a field absent from the label still matches\n * that query. While a newer query is typed the previous answer is still held and may match nothing: a group left empty\n * is left out, as `cmdk` hid it (review F2).\n * - Command groups hold only the commands matching the query, best first; a group matching nothing is left out.\n * - The groups keep their declared order (record groups by `recordOrderByCategory`, else first; then the command\n * categories), where `cmdk` also moved a group ahead when its best item scored higher: the order weights are the\n * authority over which group comes first.\n *\n * An empty `searchQuery` returns every group as it is.\n */\nexport function paletteGroupsFor(input: {\n readonly searchResultGroups: readonly CommandMenuSearchResultGroup[];\n readonly commandGroups: readonly CommandMenuGroup[];\n readonly recordOrderByCategory: ReadonlyMap<string, number>;\n readonly searchQuery: string;\n}): CommandMenuPaletteGroup[] {\n const { searchQuery } = input;\n const entries: CommandMenuPaletteGroup[] = [];\n input.searchResultGroups.forEach((group, index) => {\n const items = rankByCommandScore(group.items, searchQuery, commandSearchValueOf, (item) => item.keywords);\n if (items.length === 0) return;\n entries.push({\n kind: CommandMenuPaletteGroupKind.RECORDS,\n order: input.recordOrderByCategory.get(group.category) ?? RECORD_GROUP_ORDER_BASE + index,\n group: searchQuery ? { ...group, items } : group,\n });\n });\n input.commandGroups.forEach((group, index) => {\n const items = rankByCommandScore(group.items, searchQuery, commandSearchValueOf, (item) => item.keywords);\n if (items.length === 0) return;\n entries.push({\n kind: CommandMenuPaletteGroupKind.COMMANDS,\n order: COMMAND_GROUP_ORDER_BASE + index,\n group: searchQuery ? { ...group, items } : group,\n });\n });\n // Stable sort by the single order axis (index tiebreak preserves the per-source sequence when two groups share a weight).\n return entries\n .map((entry, index) => ({ entry, index }))\n .sort((a, b) => a.entry.order - b.entry.order || a.index - b.index)\n .map(({ entry }) => entry);\n}\n\n/**\n * The context identifiers of ONE record opened from an omnibox result (#3548, the #2746 invariant).\n *\n * The omnibox SEARCHES within the viewer's whole working scope — the tenancy and a list selected in a quick-switcher —\n * and that is right for a search. The record it finds is not known to belong to the selected list: carried into the\n * record's context, the selection became a parent of its chain, so a todo of list B found while list A was selected was\n * navigated to and read under A, and refused. A record is opened in ITS scope instead, by the rule every other surface\n * that opens a record by id applies (`scopeReferencedRecord`, #2741): the tenancy when its READ is reachable from there,\n * else the working scope it was found in, which is then the only place a parent can come from.\n */\nexport function buildOmniboxRecordContextIdentifiers(params: {\n scopeIdentifiers: Record<string, string>;\n resourceType: string;\n recordId: string;\n registry: FrontendResourcesRegistry;\n}): Record<string, string> {\n return {\n ...scopeReferencedRecord({\n hostIdentifiers: params.scopeIdentifiers,\n hostContextualParameters: {},\n targetResourceType: params.resourceType,\n targetId: params.recordId,\n registry: params.registry,\n }).identifiers,\n [params.resourceType]: params.recordId,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuBarBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useMenuBarBehavior.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMenuBarBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useMenuBarBehavior.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAoB,KAAK,eAAe,EAA+C,MAAM,sDAAsD,CAAC;AAc3J,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,eAAe,CAwI3F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
2
|
import { ApplicationLevelComponentType } from '../../../core/config/app-level-components.frontend.schemas.js';
|
|
3
3
|
import { ViewportBreakpoint } from '@wildo-ai/zod-decorators';
|
|
4
4
|
import { HorizontalPlacement } from '@wildo-ai/presets-components-models';
|
|
@@ -10,8 +10,12 @@ import { useLauncherResolutionContext } from '../../../core/navigation/useLaunch
|
|
|
10
10
|
import { useNavigationController } from '../../../core/navigation/useNavigationController.js';
|
|
11
11
|
import { useUI } from '../../../core/ui/useUI.js';
|
|
12
12
|
import { useNavigationBehaviors } from './useNavigationBehaviors.js';
|
|
13
|
+
import { useSidebarMobileDrawerMode } from './useSidebarBehavior.js';
|
|
14
|
+
import { useEventBus } from '../../../core/events/useEventBus.js';
|
|
15
|
+
import { FrontendEvents } from '../../../core/events/events.frontend.schemas.js';
|
|
13
16
|
import { mapApplicationLevelToFrontendComponentType } from '../../../core/app-shell/app-shell.utils.js';
|
|
14
17
|
import { resolveHostedComponents } from '../../../core/app-shell/hosted-components.utils.js';
|
|
18
|
+
import { MenuBarEntryKind } from '../../../core/app-shell/app-shell.schemas.js';
|
|
15
19
|
function isMenubarConfigObject(config) {
|
|
16
20
|
return typeof config === 'object' && config !== null && !Array.isArray(config);
|
|
17
21
|
}
|
|
@@ -90,6 +94,34 @@ export function useMenuBarBehavior(options = {}) {
|
|
|
90
94
|
},
|
|
91
95
|
}));
|
|
92
96
|
}, [configItems, resolutionCtx, navigate, isItemActiveByRoute, isHomeActive, homeCompositeViewRef]);
|
|
97
|
+
/*
|
|
98
|
+
* The bar's entries (#1828): an ungrouped item stands alone, and a group stands where its FIRST item is, holding all of
|
|
99
|
+
* its items in declaration order. The preset used to derive this while rendering, so another renderer had to repeat it.
|
|
100
|
+
*/
|
|
101
|
+
const entries = useMemo(() => {
|
|
102
|
+
const byGroup = new Map();
|
|
103
|
+
const ordered = [];
|
|
104
|
+
for (const item of items) {
|
|
105
|
+
if (!item.group) {
|
|
106
|
+
ordered.push({ kind: MenuBarEntryKind.ITEM, item });
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const members = byGroup.get(item.group);
|
|
110
|
+
if (members) {
|
|
111
|
+
members.push(item);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const created = [item];
|
|
115
|
+
byGroup.set(item.group, created);
|
|
116
|
+
ordered.push({ kind: MenuBarEntryKind.GROUP, group: item.group, items: created });
|
|
117
|
+
}
|
|
118
|
+
return ordered;
|
|
119
|
+
}, [items]);
|
|
120
|
+
// While the sidebar is an overlay drawer nothing of it renders inline, so the bar carries its opening affordance. The
|
|
121
|
+
// drawer's state stays the sidebar behavior's own: this only speaks the existing toggle event.
|
|
122
|
+
const isSidebarDrawerMode = useSidebarMobileDrawerMode();
|
|
123
|
+
const { emit } = useEventBus();
|
|
124
|
+
const toggleSidebarDrawer = useCallback(() => emit(FrontendEvents.HOTKEY_SIDEBAR_TOGGLE, {}), [emit]);
|
|
93
125
|
const menubarConfig = useMemo(() => {
|
|
94
126
|
const menubarMode = mode
|
|
95
127
|
|| (isMenubarConfigObject(config) ? config.displayPolicy ?? 'FIXED' : typeof config === 'string' ? config : 'FIXED');
|
|
@@ -107,6 +139,8 @@ export function useMenuBarBehavior(options = {}) {
|
|
|
107
139
|
isHomeActive,
|
|
108
140
|
handleHomeClick,
|
|
109
141
|
items,
|
|
142
|
+
entries,
|
|
143
|
+
...(isSidebarDrawerMode ? { toggleSidebarDrawer } : {}),
|
|
110
144
|
menubarConfig,
|
|
111
145
|
mapToFrontendComponentType: mapApplicationLevelToFrontendComponentType,
|
|
112
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuBarBehavior.js","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useMenuBarBehavior.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,6BAA6B,EAAE,MAAM,uEAAuE,CAAC;AAKtH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EACL,uCAAuC,EACvC,qCAAqC,GACtC,MAAM,mEAAmE,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kEAAkE,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAC;AACtG,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,0CAA0C,EAAE,MAAM,oDAAoD,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AAGrG,SAAS,qBAAqB,CAC5B,MAAe;IAQf,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACjF,CAAC;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAqC,EAAE;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,EAAE,QAAQ,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B,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzF,SAAS,EAAE,GAAG,EAAE;gBACd,eAAe,CAAC,mCAAmC,CACjD,QAAQ,EACR,IAAI,EACJ,6BAA6B,CAAC,OAAO,CACtC,CAAC;YACJ,CAAC;SACF,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAEpG,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,MAAM,WAAW,GAAG,IAAI;eACnB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvH,MAAM,SAAS,GAAG,WAAW,KAAK,SAAS,CAAC;QAC5C,MAAM,QAAQ,GAAG,iBAAiB,KAAK,kBAAkB,CAAC,MAAM,CAAC;QAEjE,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,SAAS;YACT,gBAAgB,EAAE,QAAQ,IAAI,SAAS;SACxC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEtC,OAAO;QACL,mBAAmB;QACnB,WAAW;QACX,YAAY;QACZ,eAAe;QACf,KAAK;QACL,aAAa;QACb,0BAA0B,EAAE,0CAA0C;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport { ApplicationLevelComponentType } from '~wildo-frontend-lib/core/config/app-level-components.frontend.schemas';\nimport type {\n MenubarHostedComponent,\n MenubarLauncherItem,\n} from '~wildo-frontend-lib/core/config/launcher-items.frontend.schemas';\nimport { ViewportBreakpoint } from '@wildo-ai/zod-decorators';\nimport { HorizontalPlacement } from '@wildo-ai/presets-components-models';\nimport type { BrandAssetTheme } from '@wildo-ai/saas-models';\nimport { useBrandIdentity } from '~wildo-frontend-lib/core/branding/useBrandIdentity';\nimport {\n filterMenubarItemsByRuntimeAvailability,\n useLauncherRuntimeAvailabilityContext,\n} from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport { resolveMenubarContent } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { NavigationUtils } from '~wildo-frontend-lib/core/navigation/navigation.utils';\nimport { useLauncherResolutionContext } from '~wildo-frontend-lib/core/navigation/useLauncherResolutionContext';\nimport { useNavigationController } from '~wildo-frontend-lib/core/navigation/useNavigationController';\nimport { useUI } from '~wildo-frontend-lib/core/ui/useUI';\nimport { useNavigationBehaviors } from './useNavigationBehaviors';\n\nimport { mapApplicationLevelToFrontendComponentType } from '~wildo-frontend-lib/core/app-shell/app-shell.utils';\nimport { resolveHostedComponents } from '~wildo-frontend-lib/core/app-shell/hosted-components.utils';\nimport type { MenuBarBehavior } from '~wildo-frontend-lib/core/app-shell/app-shell.schemas';\n\nfunction isMenubarConfigObject(\n config: unknown,\n): config is {\n displayPolicy?: string;\n hostedComponents?: MenubarHostedComponent[];\n items?: MenubarLauncherItem[];\n brandHeader?: boolean;\n brandMarkTheme?: BrandAssetTheme;\n} {\n return typeof config === 'object' && config !== null && !Array.isArray(config);\n}\n\nexport interface UseMenuBarBehaviorOptions {\n mode?: 'FIXED' | 'OVERLAY';\n}\n\n/**\n * Behavior hook for the MenuBar.\n *\n * Hosted components still follow the container inversion model via\n * `hostedComponents`, while declarative `items` are filtered by\n * `runtimeAvailability`, resolved through the launcher pipeline, then exposed\n * with executable callbacks for the preset layer to render.\n *\n * Each item also carries `isActive`, elected the way the sidebar elects its own\n * (`useNavigationBehaviors().isNavigationItemActive` narrowed by\n * `getMostSpecificActiveRoute`): the item whose route is the most specific match\n * of the current pathname, and no other. Until 2026-09-22 the resolved `urlPath`\n * was dropped here, so the preset had nothing to compare against the route and a\n * menubar could not say which destination was current — invisible while every\n * application declared `items: []`, and the first thing a menubar-only shell\n * (the application-creation workbench, #1454) needed.\n *\n * Dynamic component registry resolution remains in the preset layer.\n */\nexport function useMenuBarBehavior(options: UseMenuBarBehaviorOptions = {}): MenuBarBehavior {\n const { mode } = options;\n const { UIConfig, appComponentsConfiguration, navigationLayout, homeDefinition } = useUI();\n const resolutionCtx = useLauncherResolutionContext();\n const { navigate } = useNavigationController();\n const runtimeAvailabilityContext = useLauncherRuntimeAvailabilityContext();\n const { isNavigationItemActive: isItemActiveByRoute, isHomeActive, handleHomeClick } = useNavigationBehaviors();\n const homeCompositeViewRef = homeDefinition?.compositeViewReference;\n\n\n const config = appComponentsConfiguration?.[ApplicationLevelComponentType.MENUBAR];\n const currentBreakpoint = UIConfig?.currentBreakpoint;\n\n /*\n * Read unconditionally (rules of hooks), EXPOSED only when the config opted in — the sidebar's\n * own discipline, so a preset cannot render a mark on a surface that never asked for one.\n */\n const brandMarkTheme = isMenubarConfigObject(config) ? config.brandMarkTheme : undefined;\n const brandIdentity = useBrandIdentity({ theme: brandMarkTheme });\n const brandHeader = isMenubarConfigObject(config) && config.brandHeader === true ? brandIdentity : undefined;\n\n const containerComponents = useMemo(() => {\n if (!isMenubarConfigObject(config)) return [];\n return resolveHostedComponents(\n ApplicationLevelComponentType.MENUBAR,\n config.hostedComponents,\n appComponentsConfiguration as Record<string, unknown> | undefined,\n currentBreakpoint,\n HorizontalPlacement.START,\n navigationLayout,\n );\n // `navigationLayout` decides whether the shell may draw the back control (`backAffordanceOwner`),\n // so a layout change must re-resolve the hosted set. The sidebar's equivalent memo already lists it.\n }, [appComponentsConfiguration, config, currentBreakpoint, navigationLayout]);\n\n const configItems = useMemo(() => (\n isMenubarConfigObject(config)\n ? filterMenubarItemsByRuntimeAvailability(config.items, runtimeAvailabilityContext)\n : undefined\n ), [config, runtimeAvailabilityContext]);\n\n const items = useMemo((): MenuBarBehavior['items'] => {\n if (!resolutionCtx || !configItems?.length) {\n return [];\n }\n\n const resolved = resolveMenubarContent(undefined, configItems, resolutionCtx);\n\n /*\n * ONE active item. `isActiveRoute` marks a parent route active on a child URL too, so a bar\n * listing both would highlight both; the most specific route wins, exactly as in the sidebar.\n */\n const activeUrlPath = NavigationUtils.getMostSpecificActiveRoute(\n resolved.items.map(item => item.urlPath),\n isItemActiveByRoute,\n );\n /*\n * HOME renders a composite IN PLACE at `/` when `homeDefinition.compositeViewReference` names\n * one, and the item pointing at that same composite carries `/composite/<ref>` — a different\n * path for the same surface. On the home route that item is the current destination, and no\n * route comparison can see it; the home definition can.\n */\n const isHomeItem = (item: { viewRef?: string }): boolean =>\n isHomeActive && homeCompositeViewRef !== undefined && item.viewRef === homeCompositeViewRef;\n\n return resolved.items.map(item => ({\n id: item.id,\n label: item.label,\n iconReference: item.iconReference,\n group: item.group,\n isActive: (activeUrlPath !== undefined && item.urlPath === activeUrlPath) || isHomeItem(item),\n ...(item.notificationBadgeRef ? { notificationBadgeRef: item.notificationBadgeRef } : {}),\n onExecute: () => {\n NavigationUtils.dispatchNavigationForResolvedTarget(\n navigate,\n item,\n ApplicationLevelComponentType.MENUBAR,\n );\n },\n }));\n }, [configItems, resolutionCtx, navigate, isItemActiveByRoute, isHomeActive, homeCompositeViewRef]);\n\n const menubarConfig = useMemo(() => {\n const menubarMode = mode\n || (isMenubarConfigObject(config) ? config.displayPolicy ?? 'FIXED' : typeof config === 'string' ? config : 'FIXED');\n const isOverlay = menubarMode === 'OVERLAY';\n const isMobile = currentBreakpoint === ViewportBreakpoint.MOBILE;\n\n return {\n mode: menubarMode,\n isOverlay,\n showMobileLayout: isMobile && isOverlay,\n };\n }, [config, mode, currentBreakpoint]);\n\n return {\n containerComponents,\n brandHeader,\n isHomeActive,\n handleHomeClick,\n items,\n menubarConfig,\n mapToFrontendComponentType: mapApplicationLevelToFrontendComponentType,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useMenuBarBehavior.js","sourceRoot":"","sources":["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elComponentType } from '~wildo-frontend-lib/core/config/app-level-components.frontend.schemas';\nimport type {\n MenubarHostedComponent,\n MenubarLauncherItem,\n} from '~wildo-frontend-lib/core/config/launcher-items.frontend.schemas';\nimport { ViewportBreakpoint } from '@wildo-ai/zod-decorators';\nimport { HorizontalPlacement } from '@wildo-ai/presets-components-models';\nimport type { BrandAssetTheme } from '@wildo-ai/saas-models';\nimport { useBrandIdentity } from '~wildo-frontend-lib/core/branding/useBrandIdentity';\nimport {\n filterMenubarItemsByRuntimeAvailability,\n useLauncherRuntimeAvailabilityContext,\n} from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport { resolveMenubarContent } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { NavigationUtils } from '~wildo-frontend-lib/core/navigation/navigation.utils';\nimport { useLauncherResolutionContext } from '~wildo-frontend-lib/core/navigation/useLauncherResolutionContext';\nimport { useNavigationController } from '~wildo-frontend-lib/core/navigation/useNavigationController';\nimport { useUI } from '~wildo-frontend-lib/core/ui/useUI';\nimport { useNavigationBehaviors } from './useNavigationBehaviors';\nimport { useSidebarMobileDrawerMode } from './useSidebarBehavior';\nimport { useEventBus } from '~wildo-frontend-lib/core/events/useEventBus';\nimport { FrontendEvents } from '~wildo-frontend-lib/core/events/events.frontend.schemas';\n\nimport { mapApplicationLevelToFrontendComponentType } from '~wildo-frontend-lib/core/app-shell/app-shell.utils';\nimport { resolveHostedComponents } from '~wildo-frontend-lib/core/app-shell/hosted-components.utils';\nimport { MenuBarEntryKind, type MenuBarBehavior, type MenuBarBehaviorItem, type MenuBarEntry } from '~wildo-frontend-lib/core/app-shell/app-shell.schemas';\n\nfunction isMenubarConfigObject(\n config: unknown,\n): config is {\n displayPolicy?: string;\n hostedComponents?: MenubarHostedComponent[];\n items?: MenubarLauncherItem[];\n brandHeader?: boolean;\n brandMarkTheme?: BrandAssetTheme;\n} {\n return typeof config === 'object' && config !== null && !Array.isArray(config);\n}\n\nexport interface UseMenuBarBehaviorOptions {\n mode?: 'FIXED' | 'OVERLAY';\n}\n\n/**\n * Behavior hook for the MenuBar.\n *\n * Hosted components still follow the container inversion model via\n * `hostedComponents`, while declarative `items` are filtered by\n * `runtimeAvailability`, resolved through the launcher pipeline, then exposed\n * with executable callbacks for the preset layer to render.\n *\n * Each item also carries `isActive`, elected the way the sidebar elects its own\n * (`useNavigationBehaviors().isNavigationItemActive` narrowed by\n * `getMostSpecificActiveRoute`): the item whose route is the most specific match\n * of the current pathname, and no other. Until 2026-09-22 the resolved `urlPath`\n * was dropped here, so the preset had nothing to compare against the route and a\n * menubar could not say which destination was current — invisible while every\n * application declared `items: []`, and the first thing a menubar-only shell\n * (the application-creation workbench, #1454) needed.\n *\n * Dynamic component registry resolution remains in the preset layer.\n */\nexport function useMenuBarBehavior(options: UseMenuBarBehaviorOptions = {}): MenuBarBehavior {\n const { mode } = options;\n const { UIConfig, appComponentsConfiguration, navigationLayout, homeDefinition } = useUI();\n const resolutionCtx = useLauncherResolutionContext();\n const { navigate } = useNavigationController();\n const runtimeAvailabilityContext = useLauncherRuntimeAvailabilityContext();\n const { isNavigationItemActive: isItemActiveByRoute, isHomeActive, handleHomeClick } = useNavigationBehaviors();\n const homeCompositeViewRef = homeDefinition?.compositeViewReference;\n\n\n const config = appComponentsConfiguration?.[ApplicationLevelComponentType.MENUBAR];\n const currentBreakpoint = UIConfig?.currentBreakpoint;\n\n /*\n * Read unconditionally (rules of hooks), EXPOSED only when the config opted in — the sidebar's\n * own discipline, so a preset cannot render a mark on a surface that never asked for one.\n */\n const brandMarkTheme = isMenubarConfigObject(config) ? config.brandMarkTheme : undefined;\n const brandIdentity = useBrandIdentity({ theme: brandMarkTheme });\n const brandHeader = isMenubarConfigObject(config) && config.brandHeader === true ? brandIdentity : undefined;\n\n const containerComponents = useMemo(() => {\n if (!isMenubarConfigObject(config)) return [];\n return resolveHostedComponents(\n ApplicationLevelComponentType.MENUBAR,\n config.hostedComponents,\n appComponentsConfiguration as Record<string, unknown> | undefined,\n currentBreakpoint,\n HorizontalPlacement.START,\n navigationLayout,\n );\n // `navigationLayout` decides whether the shell may draw the back control (`backAffordanceOwner`),\n // so a layout change must re-resolve the hosted set. The sidebar's equivalent memo already lists it.\n }, [appComponentsConfiguration, config, currentBreakpoint, navigationLayout]);\n\n const configItems = useMemo(() => (\n isMenubarConfigObject(config)\n ? filterMenubarItemsByRuntimeAvailability(config.items, runtimeAvailabilityContext)\n : undefined\n ), [config, runtimeAvailabilityContext]);\n\n const items = useMemo((): MenuBarBehavior['items'] => {\n if (!resolutionCtx || !configItems?.length) {\n return [];\n }\n\n const resolved = resolveMenubarContent(undefined, configItems, resolutionCtx);\n\n /*\n * ONE active item. `isActiveRoute` marks a parent route active on a child URL too, so a bar\n * listing both would highlight both; the most specific route wins, exactly as in the sidebar.\n */\n const activeUrlPath = NavigationUtils.getMostSpecificActiveRoute(\n resolved.items.map(item => item.urlPath),\n isItemActiveByRoute,\n );\n /*\n * HOME renders a composite IN PLACE at `/` when `homeDefinition.compositeViewReference` names\n * one, and the item pointing at that same composite carries `/composite/<ref>` — a different\n * path for the same surface. On the home route that item is the current destination, and no\n * route comparison can see it; the home definition can.\n */\n const isHomeItem = (item: { viewRef?: string }): boolean =>\n isHomeActive && homeCompositeViewRef !== undefined && item.viewRef === homeCompositeViewRef;\n\n return resolved.items.map(item => ({\n id: item.id,\n label: item.label,\n iconReference: item.iconReference,\n group: item.group,\n isActive: (activeUrlPath !== undefined && item.urlPath === activeUrlPath) || isHomeItem(item),\n ...(item.notificationBadgeRef ? { notificationBadgeRef: item.notificationBadgeRef } : {}),\n onExecute: () => {\n NavigationUtils.dispatchNavigationForResolvedTarget(\n navigate,\n item,\n ApplicationLevelComponentType.MENUBAR,\n );\n },\n }));\n }, [configItems, resolutionCtx, navigate, isItemActiveByRoute, isHomeActive, homeCompositeViewRef]);\n\n /*\n * The bar's entries (#1828): an ungrouped item stands alone, and a group stands where its FIRST item is, holding all of\n * its items in declaration order. The preset used to derive this while rendering, so another renderer had to repeat it.\n */\n const entries = useMemo((): MenuBarEntry[] => {\n const byGroup = new Map<string, MenuBarBehaviorItem[]>();\n const ordered: MenuBarEntry[] = [];\n for (const item of items) {\n if (!item.group) {\n ordered.push({ kind: MenuBarEntryKind.ITEM, item });\n continue;\n }\n const members = byGroup.get(item.group);\n if (members) {\n members.push(item);\n continue;\n }\n const created = [item];\n byGroup.set(item.group, created);\n ordered.push({ kind: MenuBarEntryKind.GROUP, group: item.group, items: created });\n }\n return ordered;\n }, [items]);\n\n // While the sidebar is an overlay drawer nothing of it renders inline, so the bar carries its opening affordance. The\n // drawer's state stays the sidebar behavior's own: this only speaks the existing toggle event.\n const isSidebarDrawerMode = useSidebarMobileDrawerMode();\n const { emit } = useEventBus();\n const toggleSidebarDrawer = useCallback(() => emit(FrontendEvents.HOTKEY_SIDEBAR_TOGGLE, {}), [emit]);\n\n const menubarConfig = useMemo(() => {\n const menubarMode = mode\n || (isMenubarConfigObject(config) ? config.displayPolicy ?? 'FIXED' : typeof config === 'string' ? config : 'FIXED');\n const isOverlay = menubarMode === 'OVERLAY';\n const isMobile = currentBreakpoint === ViewportBreakpoint.MOBILE;\n\n return {\n mode: menubarMode,\n isOverlay,\n showMobileLayout: isMobile && isOverlay,\n };\n }, [config, mode, currentBreakpoint]);\n\n return {\n containerComponents,\n brandHeader,\n isHomeActive,\n handleHomeClick,\n items,\n entries,\n ...(isSidebarDrawerMode ? { toggleSidebarDrawer } : {}),\n menubarConfig,\n mapToFrontendComponentType: mapApplicationLevelToFrontendComponentType,\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApplicationLevelComponentType } from '../../../core/config/app-level-components.frontend.schemas';
|
|
2
2
|
import { HorizontalPlacement, VerticalPlacement } from '@wildo-ai/presets-components-models';
|
|
3
|
-
import type
|
|
3
|
+
import { type MenuUserOrgBehavior } from '../../../core/app-shell/app-shell.schemas';
|
|
4
4
|
/**
|
|
5
5
|
* Behavior hook for MenuUserOrg — manages user/org data, dropdown config
|
|
6
6
|
* resolution, popup alignment computation, and navigation handlers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuUserOrgBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useMenuUserOrgBehavior.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uEAAuE,CAAC;AACtH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAuB7F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useMenuUserOrgBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/components/navigation/app-level/useMenuUserOrgBehavior.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uEAAuE,CAAC;AACtH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAuB7F,OAAO,EAAiC,KAAK,mBAAmB,EAAkC,MAAM,sDAAsD,CAAC;AAsD/J;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,CAAC,EAAE,6BAA6B,EAC7C,kBAAkB,CAAC,EAAE,mBAAmB,GAAG,iBAAiB,GAC3D,mBAAmB,CA0PrB"}
|