Phase 6: Visual Creator Tools for HoloScript+ - Trait Editor and Real-Time Preview Dashboard
npm install @holoscript/creator-toolsbash
Install
npm install @holoscript/creator-tools
Import React components
import { TraitEditor, PreviewDashboard, Phase6CompleteDemo } from '@holoscript/creator-tools'
Use complete demo
`
---
๐ฆ What's Included
$3
- TraitAnnotationEditor (500+ LOC) - Visual editing backend
- RealtimePreviewEngine (600+ LOC) - Multi-device preview engine
$3
- TraitEditor (600+ LOC) - Visual trait editor UI
- PreviewDashboard (800+ LOC) - Real-time metrics dashboard
- Phase6CompleteDemo (300+ LOC) - Complete integrated application
$3
- PHASE_6_UI_COMPONENTS_GUIDE.md - Complete integration guide
- API Reference - Full TypeScript definitions
- Examples - Real-world usage patterns
Total: 1,700+ LOC of production-ready code
---
๐ฏ Features
$3
โ
Visual Property Controls
- ๐๏ธ Sliders for numeric values
- ๐จ Color pickers for colors
- ๐ Dropdowns for enums
- โ Checkboxes for booleans
- ๐ Text inputs for strings
โ
Professional Presets
- Gold (shiny metallic)
- Steel (industrial)
- Studio (optimized)
- High-Performance (minimal)
โ
Developer Friendly
- Live HoloScript+ code generation
- Undo/Redo (50-item history)
- Import/Export configuration
- Full validation system
- Event subscription
$3
โ
Multi-Device Support
- ๐ฑ iPhone 15 Pro
- ๐ฑ iPad Pro 12.9
- ๐ฅฝ Meta Quest 3
- ๐ฅฝ Apple Vision Pro
- ๐ฅฝ HoloLens 2
- ๐ป RTX 4090
โ
Performance Metrics
- ๐ FPS (60+ FPS target)
- ๐ง GPU Memory (% of budget)
- ๐ฏ Draw Calls
- ๐ Vertices Rendered
- โก Shader Compile Time
โ
Intelligence
- ๐ก AI-powered recommendations
- ๐ Cross-device comparison
- ๐ Performance history (300 samples)
- โ ๏ธ Warnings & error detection
- ๐ฏ Optimization suggestions
$3
โ
Three View Modes
- โ๏ธ Editor-only view
- ๐๏ธ Preview-only view
- โ๏ธ Split view (side-by-side)
โ
Live Workflow
- Real-time property editing
- Instant code generation
- Live device preview
- Performance monitoring
- Smart recommendations
---
๐ Usage
$3
`typescript
import React from 'react'
import { TraitEditor } from '@holoscript/creator-tools'
export function MyCreator() {
const [code, setCode] = React.useState('')
const config = {
type: 'material' as const,
properties: {
metallic: {
name: 'metallic',
value: 0.8,
type: 'number' as const,
min: 0,
max: 1,
step: 0.01,
description: 'Metallic intensity',
category: 'pbr'
}
},
isDirty: false
}
return (
initialConfig={config}
onCodeChange={setCode}
theme="light"
/>
)
}
`
$3
`typescript
import React from 'react'
import { PreviewDashboard } from '@holoscript/creator-tools'
export function MyPreview() {
return (
traitCode="@material { type: pbr, metallic: 0.8 }"
autoRefresh={true}
refreshInterval={1000}
/>
)
}
`
$3
`typescript
import React from 'react'
import { Phase6CompleteDemo } from '@holoscript/creator-tools'
export default function App() {
return
}
`
---
๐๏ธ Architecture
$3
`
Phase6CompleteDemo
โโโ TraitEditor
โ โโโ PropertiesPanel
โ โ โโโ PropertyControl ร N
โ โโโ CodePanel
โ โโโ PreviewPanel
โ
โโโ PreviewDashboard
โโโ DeviceOverviewCard ร 6
โโโ DetailedMetricsPanel
โโโ RecommendationsPanel
โโโ PerformanceComparisonTable
โโโ MetricsHistoryChart
โโโ WarningsErrorsPanel
`
$3
`
User edits property
โ
TraitEditor receives change
โ
Backend editor validates
โ
Code generated in real-time
โ
onCodeChange() callback fires
โ
Preview engine updates
โ
All 6 devices render preview
โ
Metrics calculated
โ
PreviewDashboard displays results
`
---
๐ Performance
$3
- Initial render: <500ms
- Property update: <100ms
- Preview update: 200-500ms
- Metrics update: 60 FPS
$3
- Idle state: ~12 MB
- With preview engine: ~35 MB
- Full history (300 samples): ~50 MB
$3
- TraitEditor: ~45 KB (gzipped)
- PreviewDashboard: ~52 KB (gzipped)
- Combined with backends: ~175 KB (gzipped)
---
๐จ Styling
All components use inline styles with a professional design system:
Colors:
- Primary: #2196f3 (blue)
- Success: #4caf50 (green)
- Warning: #ff9800 (orange)
- Error: #f44336 (red)
- Background: #ffffff (white)
- Surface: #f5f5f5 (light gray)
Typography:
- Font: system-ui, -apple-system, sans-serif
- Monospace: monospace (for code)
Spacing:
- Base unit: 0.5rem (8px)
- Standard gaps: 1rem (16px)
- Section spacing: 1.5rem (24px)
Borders & Shadows:
- Border color: #e0e0e0
- Border radius: 4-8px
- Box shadows: subtle 0-2px effects
---
๐ง API Reference
$3
`typescript
interface TraitEditorProps {
initialConfig: EditableTraitConfig
onCodeChange?: (code: string) => void
onMetricsUpdate?: (metrics: Map) => void
theme?: 'light' | 'dark'
previewDevices?: ('mobile' | 'vr' | 'desktop')[]
}
`
$3
`typescript
interface PreviewDashboardProps {
traitCode: string
onMetricsUpdate?: (metrics: Map) => void
onRecommendation?: (recommendation: string) => void
autoRefresh?: boolean
refreshInterval?: number
}
`
$3
`typescript
class TraitAnnotationEditor {
generateCode(): string
updateProperty(name: string, value: unknown): { success: boolean; error?: string }
applyPreset(name: string): void
undo(): void
redo(): void
exportConfig(): string
importConfig(json: string): void
on(event: string, callback: Function): void
off(event: string, callback: Function): void
}
`
$3
`typescript
class RealtimePreviewEngine {
registerDevice(device: PreviewDevice): void
updatePreview(traitCode: string): Promise
startMonitoring(interval?: number): void
stopMonitoring(): void
getRecommendations(): string[]
compareMetrics(): ComparisonResult[]
exportResults(): string
on(event: string, callback: Function): void
}
`
---
๐ Examples
$3
`typescript
const materialConfig: EditableTraitConfig = {
type: 'material',
properties: {
type: {
name: 'type',
value: 'pbr',
type: 'enum',
options: ['pbr', 'standard', 'unlit'],
description: 'Material type',
category: 'core'
},
metallic: {
name: 'metallic',
value: 0.8,
type: 'number',
min: 0,
max: 1,
description: 'Metallic intensity',
category: 'pbr'
},
roughness: {
name: 'roughness',
value: 0.2,
type: 'number',
min: 0,
max: 1,
description: 'Surface roughness',
category: 'pbr'
},
baseColor: {
name: 'baseColor',
value: '#ffffff',
type: 'color',
description: 'Primary color',
category: 'appearance'
}
},
isDirty: false
}
// Generated code:
// @material { type: pbr, metallic: 0.8, roughness: 0.2, baseColor: #ffffff }
`
$3
`typescript
const lightingConfig: EditableTraitConfig = {
type: 'lighting',
properties: {
intensity: {
name: 'intensity',
value: 1.0,
type: 'number',
min: 0,
max: 5,
description: 'Light intensity',
category: 'intensity'
},
color: {
name: 'color',
value: '#ffffff',
type: 'color',
description: 'Light color',
category: 'appearance'
},
castShadows: {
name: 'castShadows',
value: true,
type: 'boolean',
description: 'Enable shadow casting',
category: 'rendering'
}
},
isDirty: false
}
`
$3
`typescript
function PerformanceMonitor() {
const [metrics, setMetrics] = React.useState`
---
๐งช Testing
`bash
Run all tests
npm run test
Run with UI
npm run test:ui
Type checking
npm run type-check
Linting
npm run lint
Format code
npm run format
`
---
๐ Supported Trait Types
$3
`
@material {
type: 'pbr' | 'standard' | 'unlit' | 'transparent'
metallic: 0-1
roughness: 0-1
baseColor: hex color
emissive: hex color
aoIntensity: 0-1
}
`
$3
`
@lighting {
type: 'directional' | 'point' | 'spot'
intensity: 0-5
color: hex color
castShadows: boolean
shadowResolution: 512 | 1024 | 2048 | 4096
}
`
$3
`
@rendering {
quality: 'low' | 'medium' | 'high' | 'ultra'
targetFps: 30 | 60 | 90 | 120
useComputeShaders: boolean
enableRayTracing: boolean
}
`
---
๐ Browser Support
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
All modern browsers with ES2020+ support and React 18+
---
๐ฆ Installation Options
$3
`bash
npm install @holoscript/creator-tools
`
$3
`bash
yarn add @holoscript/creator-tools
`
$3
`bash
pnpm add @holoscript/creator-tools
``