Refactors project structure and event rendering
Restructures the project for better maintainability and clarity. Adds a ManagerFactory for dependency injection and reorganizes files. Updates event rendering logic to correctly handle overlapping events using a stack link system. The EventRendererStrategy now correctly processes and renders event overlaps, ensuring proper display. Introduces processing tracking to avoid double rendering. Updates documentation to reflect the new structure and build process. Also implements changes to build output and event system for improved clarity. Fixes #123
This commit is contained in:
parent
72019a3d9a
commit
80ef35c42c
7 changed files with 109 additions and 296 deletions
34
CLAUDE.md
34
CLAUDE.md
|
|
@ -40,7 +40,7 @@ eventBus.on('calendar:view-changed', (event) => { /* handle */ });
|
|||
```
|
||||
|
||||
#### Manager Pattern
|
||||
Each manager is instantiated in `src/index.ts` and handles a specific domain:
|
||||
Each manager is instantiated via ManagerFactory in `src/index.ts` and handles a specific domain:
|
||||
- **CalendarManager**: Main coordinator, initializes other managers
|
||||
- **ViewManager**: Handles day/week/month view switching
|
||||
- **NavigationManager**: Prev/next/today navigation
|
||||
|
|
@ -48,14 +48,18 @@ Each manager is instantiated in `src/index.ts` and handles a specific domain:
|
|||
- **EventRenderer**: Visual rendering of events in the grid
|
||||
- **GridManager**: Creates and maintains the calendar grid structure
|
||||
- **ScrollManager**: Handles scroll position and time indicators
|
||||
- **DataManager**: Mock data loading and event data transformation
|
||||
- **DragDropManager**: Drag & drop functionality for events
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
src/
|
||||
├── constants/ # Enums and constants (EventTypes)
|
||||
├── constants/ # Enums and constants (CoreEvents)
|
||||
├── core/ # Core functionality (EventBus, CalendarConfig)
|
||||
├── factories/ # ManagerFactory for dependency injection
|
||||
├── interfaces/ # TypeScript interfaces
|
||||
├── managers/ # Manager classes (one per domain)
|
||||
├── renderers/ # Event rendering services
|
||||
├── strategies/ # View strategy pattern implementations
|
||||
├── types/ # TypeScript type definitions
|
||||
└── utils/ # Utility functions (DateUtils, PositionUtils)
|
||||
|
||||
|
|
@ -72,18 +76,36 @@ Modular CSS structure without external frameworks:
|
|||
- `calendar-events-css.css`: Event styling and colors
|
||||
- `calendar-layout-css.css`: Grid and layout
|
||||
- `calendar-popup-css.css`: Popup and modal styles
|
||||
- `calendar-month-css.css`: Month view specific styles
|
||||
|
||||
### Event Naming Convention
|
||||
Events follow the pattern `category:action`:
|
||||
### Event System
|
||||
The application uses CoreEvents enum for type-safe event handling. Events follow the pattern `category:action`:
|
||||
- `calendar:*` - General calendar events
|
||||
- `grid:*` - Grid-related events
|
||||
- `event:*` - Event data changes
|
||||
- `navigation:*` - Navigation actions
|
||||
- `view:*` - View changes
|
||||
|
||||
Core events are centralized in `src/constants/CoreEvents.ts` to maintain consistency across the application.
|
||||
|
||||
### Configuration System
|
||||
CalendarConfig singleton (`src/core/CalendarConfig.ts`) manages:
|
||||
- Grid settings (hour height, snap intervals, time boundaries)
|
||||
- View configurations (day/week/month settings)
|
||||
- Work week presets (standard, compressed, midweek, weekend, fullweek)
|
||||
- Resource-based calendar mode support
|
||||
|
||||
### TypeScript Configuration
|
||||
- Target: ES2020
|
||||
- Module: ESNext
|
||||
- Strict mode enabled
|
||||
- Source maps enabled
|
||||
- Output directory: `./js`
|
||||
- Output directory: `wwwroot/js`
|
||||
|
||||
### Build System
|
||||
Uses esbuild for fast TypeScript compilation:
|
||||
- Entry point: `src/index.ts`
|
||||
- Output: `wwwroot/js/calendar.js` (single bundled file)
|
||||
- Platform: Browser
|
||||
- Format: ESM
|
||||
- Source maps: Inline for development
|
||||
Loading…
Add table
Add a link
Reference in a new issue