# relic-repo/crux architecture

> Architecture diagram of the GitHub repository relic-repo/crux, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/relic-repo/crux
- Repository: https://github.com/relic-repo/crux

## Overview

1. **What this repository is**
   - CRUX is a **Foundry VTT add-on module** for the **dnd5e** system.
   - Its core job is to replace part of the normal left-side play workflow with a **tabbed tray UI**: an **Actions** panel and an **Actor** panel, plus related token/combat tools.

2. **Top-level architectural boundary**
   - The module is structured around a clear separation between:
     - **Foundry/runtime access**
     - **system-specific dnd5e adaptation**
     - **UI presentation**
     - **interaction controllers**
     - **shared state/settings**
   - This makes the module portable across Foundry versions while keeping dnd5e-specific logic isolated.

3. **Entry point and bootstrap**
   - `scripts/index.js` is the module entry.
   - Startup behavior is coordinated through `scripts/hooks/CruxHooksManager.js`, which is the integration layer for Foundry lifecycle events.
   - The hooks layer likely wires up settings, UI injection, app registration, controller setup, and any Foundry event listeners.

4. **Runtime abstraction layer**
   - `scripts/runtime/CruxFoundryAccess.js` and `scripts/runtime/CruxFoundryPaths.js` isolate Foundry API/version concerns.
   - `scripts/runtime/dnd5e/CruxDnd5eAccess.js` and `scripts/runtime/dnd5e/CruxDnd5ePaths.js` do the same for dnd5e-specific data shapes and paths.
   - This is an important architectural seam: the rest of the module can depend on these wrappers instead of directly binding to Foundry or system internals.

5. **System adapter boundary**
   - `scripts/systems/CruxSystemRegistry.js` and `scripts/systems/dnd5e/CruxDnd5eSystemAdapter.js` define the system plug-in model.
   - For this repo, dnd5e is the active adapter, which supplies the logic for:
     - item/action grouping
     - actor summary data
     - basic action behavior
     - spell/resource indicators
     - optional compatibility with common automation flows
   - This is the main place where the module becomes “dnd5e-aware” rather than generic Foundry UI.

6. **Main UI surfaces**
   - The module exposes at least two primary UI surfaces implemented as Foundry apps:
     - `scripts/apps/CruxTrayAppV2.js` for the left-side tray
     - `scripts/apps/CruxMovementAppV2.js`, `CruxElevationAppV2.js`, `CruxEffectsAppV2.js` for specialized flyout/tool windows
   - `scripts/apps/CruxTrayAppV2.js` is the core shell that hosts the tabbed experience and orchestrates tray content.

7. **Tray composition and panel structure**
   - The tray is built from reusable panel and bubble systems:
     - `scripts/panels/CruxPanelRegistry.js`
     - `scripts/bubbles/CruxBubbleRegistry.js`
   - These registries suggest a composition model where small UI units are registered and assembled into larger tray sections.
   - The tray also has dedicated controllers for render/state behavior, indicating the UI is not purely template-driven.

8. **Interaction controllers**
   - Most user behavior is centralized in controllers:
     - `CruxActorInteractionController`
     - `CruxItemInteractionController`
     - `CruxCombatController`
     - `CruxFlyoutController`
     - `CruxTrayRenderController`
     - `CruxTrayStateController`
   - These controllers likely separate concerns such as:
     - clicking actions/items
     - handling combat and token actions
     - opening/closing flyouts
     - syncing tray state with Foundry selection and keybinds
     - rendering refresh logic
   - This is a key diagram boundary: **templates render UI, controllers manage behavior**.

9. **Shared state and settings**
   - `scripts/state/CruxStateManager.js` centralizes runtime UI state.
   - `scripts/settings/CruxSettings.js`, `CruxSettingDefinitions.js`, `CruxVisualPresets.js`, and `CruxThemeVariables.js` manage configurable behavior and appearance.
   - The architecture treats settings as a first-class subsystem because tray size, icon sizing, visibility, default expansion, font choices, and similar options materially affect how the tray is composed and rendered.

10. **Template and presentation layer**
   - Handlebars templates under `templates/` define the visual structure:
     - `templates/crux.hbs` is the main shell
     - `templates/flyouts/` contains focused tool windows
     - `templates/partials/` contains reusable sections for controls, actor data, items, and dnd5e-specific views
   - The `templates/partials/dnd5e/...` tree indicates the module is assembled from many small partials rather than one monolithic sheet.
   - `styles/crux.css` is the single main style sheet for tray and panel presentation.

11. **User interaction utilities**
   - `scripts/utils/` contains shared infrastructure for drag/drop, DOM manipulation, inline editing, template helpers, and tray resolution.
   - Notable helpers include:
     - drag-and-drop support
     - anchored flyouts
     - drop portals
     - inline editor injection
     - item form injection
   - These utilities support the tray’s interaction-heavy design and reduce duplication across controllers and apps.

12. **Key data flows**
   - The main data path is:
     - **Foundry event / keybinding / actor selection**
     - hooks and controllers interpret context
     - system adapter resolves dnd5e actor/item data
     - state/settings determine what sections are visible and how they behave
     - templates render the tray/panels
     - controllers handle clicks, rolls, item use, token tools, and updates back into Foundry
   - A second important flow is **actor/item activation**:
     - the tray triggers dnd5e item or action use
     - when needed, it falls back to chat-card style actions
     - this keeps compatibility with automation-oriented workflows.

13. **Compatibility and optional integrations**
   - The README shows the module targets **Foundry v13+** and is verified for **v14**, with **dnd5e 3.0+**.
   - Optional support exists for **Tidy 5e Sheets** and taskbar-style compatibility.
   - These integrations are not the core architecture, but they explain why the module has adapters, compatibility utilities, and section registries rather than hardcoded assumptions.

14. **Localized and distributable module packaging**
   - `module.json` is the Foundry manifest that defines distribution and module metadata.
   - `lang/en.json` and `lang/pt-BR.json` indicate built-in localization.
   - The repo also includes GitHub Actions, which suggests the module is packaged/released as a distributable Foundry module rather than an installed app service.

15. **How to draw the architecture**
   - The clean diagram should show:
     - **Foundry VTT** and **dnd5e** as external dependencies
     - a **bootstrap/hooks layer**
     - a **runtime/system adapter layer**
     - **state/settings**
     - **tray/apps/controllers**
     - **template/style presentation**
     - **utilities** as shared support across the UI
   - The most important boundary is between **generic module infrastructure** and **dnd5e-specific behavior**, with the adapter layer bridging them.

Main entry points: [`scripts/apps/CruxTrayAppV2.js`](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/apps/CruxTrayAppV2.js) (Tray app), [`scripts/hooks/CruxHooksManager.js`](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/hooks/CruxHooksManager.js) (Hooks), [`scripts/utils/CruxUtilityManager.js`](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxUtilityManager.js) (Utility manager), [`scripts/systems/dnd5e/CruxDnd5eSystemAdapter.js`](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/systems/dnd5e/CruxDnd5eSystemAdapter.js) (dnd5e adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["Bootstrap"]
  node_index["Entry point<br/>module entry<br/>[index.js]"]
  node_hooks["Hooks<br/>lifecycle integration"]
end

subgraph group_runtime["Runtime"]
  node_foundry(("Foundry VTT<br/>external runtime"))
  node_foundry_access["Foundry access<br/>runtime adapter"]
  node_foundry_paths["Foundry paths<br/>runtime paths"]
  node_dnd5e_access["dnd5e access<br/>system adapter<br/>[CruxDnd5eAccess.js]"]
  node_dnd5e_paths["dnd5e paths<br/>system paths<br/>[CruxDnd5ePaths.js]"]
end

subgraph group_systems["Systems"]
  node_dnd5e(("dnd5e<br/>external system"))
  node_registry["System registry<br/>adapter registry"]
  node_dnd5e_adapter["dnd5e adapter<br/>system adapter"]
end

subgraph group_state["State"]
  node_settings["Settings<br/>configuration<br/>[CruxSettings.js]"]
  node_defs["Setting defs<br/>settings schema"]
  node_presets["Visual presets<br/>theme presets"]
  node_theme["Theme vars<br/>style tokens"]
  node_state_mgr["State manager<br/>runtime state"]
end

subgraph group_ui["UI"]
  node_tray_app["Tray app<br/>foundry app<br/>[CruxTrayAppV2.js]"]
  node_flyouts["Flyout apps<br/>foundry apps"]
  node_tray_ctrl["Tray controller<br/>render control"]
  node_tray_state_ctrl["Tray state<br/>state control"]
  node_actor_ctrl["Actor control<br/>interaction controller"]
  node_item_ctrl["Item control<br/>interaction controller"]
  node_combat_ctrl["Combat control"]
  node_flyout_ctrl["Flyout control<br/>window control"]
  node_panel_registry["Panel registry<br/>panel composition"]
  node_bubble_registry["Bubble registry<br/>bubble composition"]
  node_workspace_api["Workspace API<br/>integration api"]
end

subgraph group_presentation["Presentation"]
end

subgraph group_support["Support"]
  node_util_mgr["Utility manager<br/>shared utilities"]
  node_compat["Compatibility<br/>compat layer"]
  node_dragdrop["Drag/drop utils<br/>ui utilities"]
  node_dom["DOM utils<br/>ui utilities<br/>[CruxDomUtils.js]"]
  node_template_utils["Template utils<br/>template helpers"]
  node_tray_resolver["Tray resolver<br/>layout helper"]
  node_anchored_flyout["Anchored flyout<br/>flyout helper"]
  node_inline_editor["Inline editor<br/>editor helper"]
end

node_index -->|"boots"| node_hooks
node_hooks -->|"loads"| node_settings
node_hooks -->|"selects"| node_registry
node_hooks -->|"registers"| node_tray_app
node_hooks -->|"initializes"| node_state_mgr
node_hooks -->|"wires"| node_flyout_ctrl
node_registry -->|"hosts"| node_dnd5e_adapter
node_dnd5e_adapter -->|"uses"| node_dnd5e_access
node_dnd5e_adapter -->|"uses"| node_dnd5e_paths
node_dnd5e_adapter -->|"feeds"| node_panel_registry
node_dnd5e_adapter -->|"feeds"| node_bubble_registry
node_tray_app -->|"renders"| node_tray_ctrl
node_tray_app -->|"binds"| node_tray_state_ctrl
node_tray_app -->|"assembles"| node_panel_registry
node_tray_app -->|"assembles"| node_bubble_registry
node_tray_app -->|"delegates"| node_actor_ctrl
node_tray_app -->|"delegates"| node_item_ctrl
node_tray_app -->|"delegates"| node_combat_ctrl
node_tray_app -->|"opens"| node_flyout_ctrl
node_tray_app -->|"exposes"| node_workspace_api
node_tray_ctrl -->|"reads"| node_state_mgr
node_tray_state_ctrl -->|"updates"| node_state_mgr
node_actor_ctrl -->|"uses"| node_dnd5e_adapter
node_item_ctrl -->|"uses"| node_dnd5e_adapter
node_combat_ctrl -->|"uses"| node_dnd5e_adapter
node_flyout_ctrl -->|"positions"| node_anchored_flyout
node_settings -->|"defines"| node_defs
node_settings -->|"applies"| node_presets
node_settings -->|"styles"| node_theme
node_util_mgr -->|"checks"| node_compat
node_util_mgr -->|"uses"| node_dragdrop
node_util_mgr -->|"uses"| node_dom
node_util_mgr -->|"uses"| node_template_utils
node_util_mgr -->|"uses"| node_tray_resolver
node_util_mgr -->|"uses"| node_inline_editor
node_tray_app -->|"depends on"| node_util_mgr
node_flyout_ctrl -->|"depends on"| node_util_mgr
node_hooks -->|"abstracts"| node_foundry_access
node_hooks -->|"abstracts"| node_foundry_paths
node_hooks -->|"abstracts"| node_dnd5e_access
node_hooks -->|"abstracts"| node_dnd5e_paths
node_foundry_access -->|"wraps"| node_foundry
node_dnd5e_access -->|"wraps"| node_dnd5e
node_panel_registry -->|"composes"| node_tray_app
node_bubble_registry -->|"composes"| node_tray_app

click node_index "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/index.js"
click node_hooks "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/hooks/CruxHooksManager.js"
click node_foundry_access "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/CruxFoundryAccess.js"
click node_foundry_paths "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/CruxFoundryPaths.js"
click node_dnd5e_access "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/dnd5e/CruxDnd5eAccess.js"
click node_dnd5e_paths "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/dnd5e/CruxDnd5ePaths.js"
click node_registry "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/systems/CruxSystemRegistry.js"
click node_dnd5e_adapter "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/systems/dnd5e/CruxDnd5eSystemAdapter.js"
click node_settings "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxSettings.js"
click node_defs "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxSettingDefinitions.js"
click node_presets "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxVisualPresets.js"
click node_theme "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxThemeVariables.js"
click node_state_mgr "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/state/CruxStateManager.js"
click node_tray_app "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/apps/CruxTrayAppV2.js"
click node_flyouts "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/apps/CruxMovementAppV2.js"
click node_tray_ctrl "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxTrayRenderController.js"
click node_tray_state_ctrl "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxTrayStateController.js"
click node_actor_ctrl "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxActorInteractionController.js"
click node_item_ctrl "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxItemInteractionController.js"
click node_combat_ctrl "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxCombatController.js"
click node_flyout_ctrl "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxFlyoutController.js"
click node_panel_registry "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/panels/CruxPanelRegistry.js"
click node_bubble_registry "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/bubbles/CruxBubbleRegistry.js"
click node_workspace_api "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/api/CruxWorkspaceApi.js"
click node_util_mgr "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxUtilityManager.js"
click node_compat "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxCompatibility.js"
click node_dragdrop "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxDragDropUtils.js"
click node_dom "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxDomUtils.js"
click node_template_utils "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxTemplatePartials.js"
click node_tray_resolver "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxTrayResolver.js"
click node_anchored_flyout "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxAnchoredFlyout.js"
click node_inline_editor "https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxInlineEditor.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_index,node_hooks,node_util_mgr,node_compat,node_dragdrop,node_dom,node_template_utils,node_tray_resolver,node_anchored_flyout,node_inline_editor toneBlue
class node_foundry,node_foundry_access,node_foundry_paths,node_dnd5e_access,node_dnd5e_paths toneAmber
class node_dnd5e,node_registry,node_dnd5e_adapter toneMint
class node_settings,node_defs,node_presets,node_theme,node_state_mgr toneRose
class node_tray_app,node_flyouts,node_tray_ctrl,node_tray_state_ctrl,node_actor_ctrl,node_item_ctrl,node_combat_ctrl,node_flyout_ctrl,node_panel_registry,node_bubble_registry,node_workspace_api toneIndigo
```

## Components

### Bootstrap

Module entry and Foundry lifecycle integration.

- [Entry point](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/index.js): module entry · Module bootstrap and export surface. · `scripts/index.js`
- [Hooks](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/hooks/CruxHooksManager.js): lifecycle integration · Wires Foundry events into module setup. · `scripts/hooks/CruxHooksManager.js`

### Runtime

Foundry and dnd5e abstraction layers.

- **Foundry VTT**: external runtime · Host application API and lifecycle.
- [Foundry access](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/CruxFoundryAccess.js): runtime adapter · Version-safe access to Foundry APIs. · `scripts/runtime/CruxFoundryAccess.js`
- [Foundry paths](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/CruxFoundryPaths.js): runtime paths · Centralized Foundry path resolution. · `scripts/runtime/CruxFoundryPaths.js`
- [dnd5e access](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/dnd5e/CruxDnd5eAccess.js): system adapter · Version-safe access to dnd5e data. · `scripts/runtime/dnd5e/CruxDnd5eAccess.js`
- [dnd5e paths](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/runtime/dnd5e/CruxDnd5ePaths.js): system paths · Centralized dnd5e path resolution. · `scripts/runtime/dnd5e/CruxDnd5ePaths.js`

### Systems

System registry and dnd5e adapter.

- **dnd5e**: external system · Target game system and data model.
- [System registry](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/systems/CruxSystemRegistry.js): adapter registry · Selects the active game-system adapter. · `scripts/systems/CruxSystemRegistry.js`
- [dnd5e adapter](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/systems/dnd5e/CruxDnd5eSystemAdapter.js): system adapter · Implements dnd5e-specific tray and actor behavior. · `scripts/systems/dnd5e/CruxDnd5eSystemAdapter.js`

### State

Shared settings and runtime UI state.

- [Settings](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxSettings.js): configuration · Module options and persisted preferences. · `scripts/settings/CruxSettings.js`
- [Setting defs](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxSettingDefinitions.js): settings schema · Defines configurable module options. · `scripts/settings/CruxSettingDefinitions.js`
- [Visual presets](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxVisualPresets.js): theme presets · Preset sizing and style choices. · `scripts/settings/CruxVisualPresets.js`
- [Theme vars](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/settings/CruxThemeVariables.js): style tokens · Theme variables used by the tray UI. · `scripts/settings/CruxThemeVariables.js`
- [State manager](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/state/CruxStateManager.js): runtime state · Central UI state for tray and panels. · `scripts/state/CruxStateManager.js`

### UI

Tray apps, flyouts, controllers, and composition registries.

- [Tray app](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/apps/CruxTrayAppV2.js): foundry app · Main tabbed tray shell and host. · `scripts/apps/CruxTrayAppV2.js`
- [Flyout apps](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/apps/CruxMovementAppV2.js): foundry apps · Specialized tool windows for movement, elevation, and effects. · `scripts/apps/CruxMovementAppV2.js`
- [Tray controller](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxTrayRenderController.js): render control · Coordinates tray render and refresh behavior. · `scripts/controllers/CruxTrayRenderController.js`
- [Tray state](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxTrayStateController.js): state control · Syncs tray state with selection and UI events. · `scripts/controllers/CruxTrayStateController.js`
- [Actor control](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxActorInteractionController.js): interaction controller · Handles actor clicks and actor-level actions. · `scripts/controllers/CruxActorInteractionController.js`
- [Item control](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxItemInteractionController.js): interaction controller · Handles item use, actions, and item interactions. · `scripts/controllers/CruxItemInteractionController.js`
- [Combat control](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxCombatController.js): combat controller · Coordinates combat and token-oriented actions. · `scripts/controllers/CruxCombatController.js`
- [Flyout control](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/controllers/CruxFlyoutController.js): window control · Opens and manages auxiliary flyout windows. · `scripts/controllers/CruxFlyoutController.js`
- [Panel registry](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/panels/CruxPanelRegistry.js): panel composition · Registers reusable tray panels. · `scripts/panels/CruxPanelRegistry.js`
- [Bubble registry](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/bubbles/CruxBubbleRegistry.js): bubble composition · Registers compact tray bubbles and controls. · `scripts/bubbles/CruxBubbleRegistry.js`
- [Workspace API](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/api/CruxWorkspaceApi.js): integration api · Workspace-oriented module API surface. · `scripts/api/CruxWorkspaceApi.js`

### Support

Shared utilities and compatibility helpers.

- [Utility manager](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxUtilityManager.js): shared utilities · Shared UI helpers and utility coordination. · `scripts/utils/CruxUtilityManager.js`
- [Compatibility](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxCompatibility.js): compat layer · Optional integration and behavior checks. · `scripts/utils/CruxCompatibility.js`
- [Drag/drop utils](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxDragDropUtils.js): ui utilities · Drag, targeting, and drop handling. · `scripts/utils/CruxDragDropUtils.js`
- [DOM utils](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxDomUtils.js): ui utilities · DOM manipulation helpers for tray rendering. · `scripts/utils/CruxDomUtils.js`
- [Template utils](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxTemplatePartials.js): template helpers · Partial registration and template support. · `scripts/utils/CruxTemplatePartials.js`
- [Tray resolver](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxTrayResolver.js): layout helper · Resolves tray placement and anchoring. · `scripts/utils/CruxTrayResolver.js`
- [Anchored flyout](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxAnchoredFlyout.js): flyout helper · Positions flyouts relative to tray context. · `scripts/utils/CruxAnchoredFlyout.js`
- [Inline editor](https://github.com/relic-repo/crux/blob/V2-Beta/scripts/utils/CruxInlineEditor.js): editor helper · Injects inline edit behavior into tray UI. · `scripts/utils/CruxInlineEditor.js`

## Connections

- Entry point → Hooks: boots · Starts module initialization through Foundry hooks.
- Hooks → Settings: loads · Registers and applies module settings.
- Hooks → System registry: selects · Chooses the active system adapter.
- Hooks → Tray app: registers · Injects the main tray app into Foundry.
- Hooks → State manager: initializes · Creates shared runtime state.
- Hooks → Flyout control: wires · Connects lifecycle events to flyout behavior.
- System registry → dnd5e adapter: hosts · Provides the active dnd5e implementation.
- dnd5e adapter → dnd5e access: uses · Reads system data through the adapter layer.
- dnd5e adapter → dnd5e paths: uses · Resolves dnd5e-specific paths.
- dnd5e adapter → Panel registry: feeds · Supplies tray section composition for the system.
- dnd5e adapter → Bubble registry: feeds · Supplies bubble composition for the system.
- Tray app → Tray controller: renders · Delegates refresh and render coordination.
- Tray app → Tray state: binds · Keeps tray state synchronized.
- Tray app → Panel registry: assembles · Builds the tabbed tray from reusable panels.
- Tray app → Bubble registry: assembles · Adds compact bubble controls.
- Tray app → Actor control: delegates · Routes actor interactions to controller logic.
- Tray app → Item control: delegates · Routes item interactions to controller logic.
- Tray app → Combat control: delegates · Routes combat and token actions.
- Tray app → Flyout control: opens · Launches auxiliary flyout windows.
- Tray app → Workspace API: exposes · Provides a workspace-facing API surface.
- Tray controller → State manager: reads · Uses shared state to drive rendering.
- Tray state → State manager: updates · Mutates tray and selection state.
- Actor control → dnd5e adapter: uses · Resolves actor-specific dnd5e behavior.
- Item control → dnd5e adapter: uses · Resolves item/action behavior.
- Combat control → dnd5e adapter: uses · Resolves combat-related actions.
- Flyout control → Anchored flyout: positions · Manages anchored tool windows.
- Settings → Setting defs: defines · Uses the setting schema.
- Settings → Visual presets: applies · Applies visual presets.
- Settings → Theme vars: styles · Feeds theme variables into presentation.
- Utility manager → Compatibility: checks · Handles optional compatibility behavior.
- Utility manager → Drag/drop utils: uses · Supports drag and drop interactions.
- Utility manager → DOM utils: uses · Supports DOM-level UI manipulation.
- Utility manager → Template utils: uses · Supports partial registration and template helpers.
- Utility manager → Tray resolver: uses · Resolves tray placement and sizing.
- Utility manager → Inline editor: uses · Enables inline editing affordances.
- Tray app → Utility manager: depends on · Shares common UI infrastructure.
- Flyout control → Utility manager: depends on · Reuses shared support utilities.
- Hooks → Foundry access: abstracts · Isolates Foundry API/version differences.
- Hooks → Foundry paths: abstracts · Centralizes Foundry path concerns.
- Hooks → dnd5e access: abstracts · Isolates dnd5e data-shape differences.
- Hooks → dnd5e paths: abstracts · Centralizes dnd5e path concerns.
- Foundry access → Foundry VTT: wraps · Bridges the module to the host runtime.
- dnd5e access → dnd5e: wraps · Bridges the module to the game system.
- Panel registry → Tray app: composes · Supplies the tray with structured sections.
- Bubble registry → Tray app: composes · Supplies bubble widgets for the tray.
