@cratis/scene.react 4.37.0 → 4.39.0

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.
@@ -98,7 +98,7 @@ export function NavigationRegionView({ region, module, application = false, mode
98
98
 
99
99
  const sidebar = region === NavigationRegionKind.Sidebar;
100
100
  const placement = useMemo(() => ({ primaryScreen: navigation?.primaryScreen, outlets: navigation?.outlets ?? {} }), [navigation?.outlets, navigation?.primaryScreen]);
101
- const scope = application ? undefined : module ?? currentModuleOf(index, placement.primaryScreen);
101
+ const scope = application ? undefined : module ?? (model.moduleOf ? model.moduleOf(placement.primaryScreen) : currentModuleOf(index, placement.primaryScreen));
102
102
  const resolved: EffectiveNavigationRegion = useMemo(() => effectiveNavigation(index, model.navigation, scope, region), [index, model.navigation, scope, region]);
103
103
 
104
104
  const isActive = (item: EffectiveNavItem) => placement.primaryScreen !== undefined && navigationItemActive(item, { primaryScreen: placement.primaryScreen, outlets: placement.outlets }, screenFor, !sidebar);
@@ -21,6 +21,13 @@ export interface SceneNavigationModel {
21
21
  */
22
22
  screenFor?(item: EffectiveNavItem): string | undefined;
23
23
 
24
+ /**
25
+ * The module the screen on the page belongs to, which decides whose sidebar - the module's effective navigation - is shown.
26
+ * Defaults to the first segment of the screen's qualified id (`sales.orders` is in `sales`); a host whose screens are named
27
+ * otherwise tells it where they were declared. Undefined for a screen outside every module.
28
+ */
29
+ moduleOf?(screen: string | undefined): string | undefined;
30
+
24
31
  /**
25
32
  * Whether an item is shown. An item for which this answers false is hidden, not disabled - Stage plugs permissions
26
33
  * here. Applies to every level of a hierarchical region; hiding a parent hides its children.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/scene.react",
3
- "version": "4.37.0",
3
+ "version": "4.39.0",
4
4
  "description": "The React renderer implementing Scene.Engine's Renderer contract against real React/DOM.",
5
5
  "keywords": [
6
6
  "cratis",
@@ -51,12 +51,12 @@
51
51
  "build-storybook": "storybook build"
52
52
  },
53
53
  "dependencies": {
54
- "@cratis/scene.engine": "4.37.0",
55
- "@cratis/scene.model": "4.37.0"
54
+ "@cratis/scene.engine": "4.39.0",
55
+ "@cratis/scene.model": "4.39.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@cratis/scene.engine": "4.37.0",
59
- "@cratis/scene.model": "4.37.0",
58
+ "@cratis/scene.engine": "4.39.0",
59
+ "@cratis/scene.model": "4.39.0",
60
60
  "@storybook/addon-links": "^10.6.1",
61
61
  "@storybook/react": "^10.6.1",
62
62
  "@storybook/react-vite": "^10.6.1",