WORLD VS PAGE CLARIFICATION
Ecosistema completo para organización y gestión de contenido con interfaces espaciales
🌍 World vs Page Clarification
Date: November 5, 2025
Status: ✅ Clarified and Documented
Purpose: Resolve confusion between World and Page concepts in EditorService
🚨 The Problem
There was critical confusion in EditorService and throughout the codebase:
Worldinterface (inpage.types.ts) IS ACTUALLY A PAGE- Has
widgets: Widget[]← Pages have widgets - Has
layout: CoreResponsivePageLayout← Pages have layouts - Has page-specific properties (
meta,permissions,status)
- Has
But conceptually: A
Worldshould be a container that holds multiple Pages
This confusion made it impossible to:
- Have a World contain multiple Pages
- Understand the actual hierarchy
- Write clear, maintainable code
✅ The Solution
1. Type Alias for Clarity
Created a Page type alias in page.types.ts:
/**
* Type alias for clarity: Page = World
*
* Use this type in EditorService and other page-focused code to make it clear
* that we're working with Pages, not WorldContainers.
*
* WorldContainer (the true "World") contains multiple Pages via pageIds.
*/
export type Page = World;
2. Updated EditorService
EditorService now uses Page type for clarity:
// Before (confusing)
readonly editorState = autoFlashState('editor-state', {
page: null as World | null, // World? But it's actually a Page!
// ...
});
// After (clear)
readonly editorState = autoFlashState('editor-state', {
page: null as Page | null, // ✅ Clear: We're working with a Page
// ...
});
3. Added Documentation
- Comments in
EditorServiceexplaining the distinction - Updated
Worldinterface comments explaining it's actually a Page - Type alias with clear documentation
🏗️ Correct Hierarchy
Universe
└─ Galaxy
└─ WorldContainer (the TRUE "World")
└─ Page (currently named "World" in page.types.ts)
└─ Widget[]
Key Differences
| Concept | Purpose | Contains | Has Layout? | Has Widgets? |
|---|---|---|---|---|
| WorldContainer | Group related Pages | pageIds: string[] |
❌ No | ❌ No |
| Page (current "World") | Individual content page | widgets: Widget[] |
✅ Yes | ✅ Yes |
📝 Usage Guidelines
In EditorService (and page-focused code):
// ✅ GOOD - Use Page type for clarity
import { Page } from '@libs-foundational/core-models';
setPage(page: Page | null) {
// Clear: We're setting a Page, not a WorldContainer
}
// ❌ AVOID - Using World directly is confusing
setPage(page: World | null) {
// Unclear: Is this a Page or a WorldContainer?
}
For WorldContainer operations:
// ✅ Use WorldContainer type from structure-management
import { WorldContainer } from '@structure-management';
const world: WorldContainer = {
id: 'world-1',
name: 'Breakfast Menu',
pageIds: ['page-1', 'page-2', 'page-3'], // References to Pages
// ...
};
🔄 Migration Path
Phase 1: Type Alias (✅ COMPLETE)
- ✅ Created
Pagetype alias - ✅ Updated
EditorServiceto usePage - ✅ Added documentation
Phase 2: Gradual Migration (Future)
- Update other services to use
Pagetype where appropriate - Keep
Worldfor backward compatibility - Eventually consider renaming
World→Pageinpage.types.ts(breaking change)
Phase 3: Full Separation (Future)
- Complete WorldContainer implementation
- Separate Page storage from WorldContainer storage
- Update all references
📚 File Locations
- Page Type Alias:
libs/core-models/src/lib/types/page.types.ts(line 109) - WorldContainer:
libs/structure-management/src/lib/models/world-container.types.ts - EditorService:
libs/editor-ui/src/lib/services/editor.service.ts
🎯 Summary
Worldinterface = Actually a Page (has widgets, layout)Pagetype alias = Clarity (use in EditorService)WorldContainer= True World (holds multiple Pages)
When editing pages: Use Page type
When managing Worlds: Use WorldContainer type
For backward compatibility: World still works everywhere
✅ Benefits
- ✅ Clear distinction between Pages and WorldContainers
- ✅ EditorService now correctly reflects it works with Pages
- ✅ Type system enforces correct usage
- ✅ Documentation explains the confusion
- ✅ Backward compatible (World still works)
The confusion is resolved! Use Page type in EditorService and page-focused code for clarity. 🎉