feat(dashboard): implement smart widget scaling and improved auto-layout

- Add resetWidgetSizesToDefault() to reset all widgets to default sizes before auto-arrange/reset
- Implement continuous expansion algorithm that fills available space up to maxAutoSize limits
- Add visible height detection to prevent widgets expanding beyond viewport (no forced scroll)
- Update all widget defaultSize and maxAutoSize for optimal 1x1 compact layouts
  - Info widgets (calendar, weather, temp, clock): 1x1 default, 1x2 max
  - Location: 2x2 max (was 3x3)
  - Characters: 3x5 max, moved to 'scene' category (eliminates Social tab)
  - User Info: 2x1 max (prevents expansion)
  - User Mood: 1x1 default and max (compact top-right placement)
  - User Attributes: 3x5 max (fills bottom space)
  - User Stats: 3x3 max
- Fix CSS scaling for 1x1 widgets
  - Replace viewport-based units with fixed rem values
  - Reduce icon/graphic sizes to fit with visible text
  - Add explicit gaps and padding for consistent spacing
  - Set line-height: 1 to prevent text overflow
- Reorganize default layout
  - Status tab: User Info (2x1) + Mood (1x1 top right) + Stats + Attributes
  - Scene tab: Info widgets (1x1) + Location + Characters (all on one tab)
  - Inventory tab: Full inventory widget

Auto-arrange and reset now properly size widgets to defaults and expand to fill
available space without exceeding visible area.
This commit is contained in:
Lucas 'Paperboy' Rose-Winters
2025-10-23 22:08:04 +11:00
parent f61e6390fb
commit 3dd7b017a6
10 changed files with 146 additions and 74 deletions
+13 -13
View File
@@ -192,9 +192,9 @@ export function registerCalendarWidget(registry, dependencies) {
icon: '📅',
description: 'Date, weekday, month, and year display',
category: 'scene',
minSize: { w: 1, h: 2 },
defaultSize: { w: 1, h: 2 },
maxAutoSize: { w: 2, h: 3 }, // Max size for auto-arrange expansion
minSize: { w: 1, h: 1 },
defaultSize: { w: 1, h: 1 },
maxAutoSize: { w: 1, h: 2 }, // Max size for auto-arrange expansion
requiresSchema: false,
render(container, config = {}) {
@@ -280,9 +280,9 @@ export function registerWeatherWidget(registry, dependencies) {
name: 'Weather',
icon: '🌤️',
description: 'Weather emoji and forecast',
minSize: { w: 1, h: 2 },
defaultSize: { w: 1, h: 2 },
maxAutoSize: { w: 2, h: 3 }, // Max size for auto-arrange expansion
minSize: { w: 1, h: 1 },
defaultSize: { w: 1, h: 1 },
maxAutoSize: { w: 1, h: 2 }, // Max size for auto-arrange expansion
requiresSchema: false,
render(container, config = {}) {
@@ -314,9 +314,9 @@ export function registerTemperatureWidget(registry, dependencies) {
name: 'Temperature',
icon: '🌡️',
description: 'Temperature display with thermometer',
minSize: { w: 1, h: 2 },
defaultSize: { w: 1, h: 2 },
maxAutoSize: { w: 2, h: 3 }, // Max size for auto-arrange expansion
minSize: { w: 1, h: 1 },
defaultSize: { w: 1, h: 1 },
maxAutoSize: { w: 1, h: 2 }, // Max size for auto-arrange expansion
requiresSchema: false,
render(container, config = {}) {
@@ -355,9 +355,9 @@ export function registerClockWidget(registry, dependencies) {
name: 'Clock',
icon: '🕐',
description: 'Analog clock with time display',
minSize: { w: 1, h: 2 },
defaultSize: { w: 1, h: 2 },
maxAutoSize: { w: 2, h: 3 }, // Max size for auto-arrange expansion
minSize: { w: 1, h: 1 },
defaultSize: { w: 1, h: 1 },
maxAutoSize: { w: 1, h: 2 }, // Max size for auto-arrange expansion
requiresSchema: false,
render(container, config = {}) {
@@ -407,7 +407,7 @@ export function registerLocationWidget(registry, dependencies) {
description: 'Map with location display',
minSize: { w: 1, h: 2 },
defaultSize: { w: 2, h: 2 },
maxAutoSize: { w: 3, h: 3 }, // Max size for auto-arrange expansion
maxAutoSize: { w: 2, h: 2 }, // Max size for auto-arrange expansion
requiresSchema: false,
render(container, config = {}) {
@@ -235,10 +235,10 @@ export function registerPresentCharactersWidget(registry, dependencies) {
name: 'Present Characters',
icon: '👥',
description: 'Character cards with avatars, traits, and relationships',
category: 'social',
category: 'scene',
minSize: { w: 2, h: 2 },
defaultSize: { w: 2, h: 3 },
maxAutoSize: { w: 3, h: 6 }, // Max size for auto-arrange expansion (can expand significantly)
maxAutoSize: { w: 3, h: 5 }, // Max size for auto-arrange expansion
requiresSchema: false,
render(container, config = {}) {
@@ -33,6 +33,7 @@ export function registerUserAttributesWidget(registry, dependencies) {
category: 'user',
minSize: { w: 2, h: 2 },
defaultSize: { w: 2, h: 2 },
maxAutoSize: { w: 3, h: 5 }, // Max size for auto-arrange expansion
requiresSchema: false,
/**
@@ -37,6 +37,7 @@ export function registerUserInfoWidget(registry, dependencies) {
category: 'user',
minSize: { w: 1, h: 1 },
defaultSize: { w: 2, h: 1 },
maxAutoSize: { w: 2, h: 1 }, // Max size for auto-arrange expansion
requiresSchema: false,
/**
@@ -29,7 +29,8 @@ export function registerUserMoodWidget(registry, dependencies) {
description: 'Mood emoji and active conditions',
category: 'user',
minSize: { w: 1, h: 1 },
defaultSize: { w: 2, h: 1 },
defaultSize: { w: 1, h: 1 },
maxAutoSize: { w: 1, h: 1 }, // Max size for auto-arrange expansion - stays compact in top right
requiresSchema: false,
/**
@@ -34,6 +34,7 @@ export function registerUserStatsWidget(registry, dependencies) {
category: 'user',
minSize: { w: 1, h: 2 },
defaultSize: { w: 2, h: 2 },
maxAutoSize: { w: 3, h: 3 }, // Max size for auto-arrange expansion
requiresSchema: false,
/**