2025-12-11 12:16:48 +00:00
# @design.estate/dees-wcctools
🛠️ **Web Component Catalogue Tools ** — The core dashboard and UI components for building interactive component catalogues
## Overview
This is the main module of `@design.estate/dees-wcctools` , providing the complete dashboard experience for developing, testing, and documenting web components.
## Installation
``` bash
pnpm add -D @design.estate/dees-wcctools
```
## Usage
2025-12-28 12:51:55 +00:00
### Sections-based Configuration (Recommended)
``` typescript
import { setupWccTools } from '@design.estate/dees-wcctools' ;
import * as elements from './elements/index.js' ;
import * as views from './views/index.js' ;
import * as pages from './pages/index.js' ;
setupWccTools ( {
sections : [
{
name : 'Pages' ,
type : 'pages' ,
items : pages ,
} ,
{
name : 'Views' ,
type : 'elements' ,
items : views ,
icon : 'web' ,
} ,
{
name : 'Elements' ,
type : 'elements' ,
items : elements ,
filter : ( name ) = > ! name . startsWith ( 'internal-' ) ,
sort : ( [ a ] , [ b ] ) = > a . localeCompare ( b ) ,
} ,
] ,
} ) ;
```
### Legacy Format (Still Supported)
2025-12-11 12:16:48 +00:00
``` typescript
import { setupWccTools } from '@design.estate/dees-wcctools' ;
import { MyButton } from './components/my-button.js' ;
setupWccTools ( {
'my-button' : MyButton ,
} ) ;
```
## Exports
### Main Entry Point
| Export | Description |
|--------|-------------|
| `setupWccTools` | Initialize the component catalogue dashboard |
2025-12-28 12:51:55 +00:00
| `IWccConfig` | TypeScript interface for sections configuration |
| `IWccSection` | TypeScript interface for individual section |
2025-12-11 12:16:48 +00:00
### Recording Components
| Export | Description |
|--------|-------------|
| `RecorderService` | Service class for screen/viewport recording |
| `WccRecordButton` | Record button UI component |
| `WccRecordingPanel` | Recording options and preview panel |
| `IRecorderEvents` | TypeScript interface for recorder callbacks |
| `IRecordingOptions` | TypeScript interface for recording options |
2025-12-28 12:51:55 +00:00
## Section Configuration
| Property | Type | Description |
|----------|------|-------------|
| `name` | `string` | Display name for the section header |
| `type` | `'elements' \| 'pages'` | Rendering behavior |
| `items` | `Record<string, any>` | Element classes or page factories |
| `filter` | `(name, item) => boolean` | Optional filter function |
| `sort` | `([a, itemA], [b, itemB]) => number` | Optional sort function |
| `icon` | `string` | Material Symbols icon name |
| `collapsed` | `boolean` | Start section collapsed (default: false) |
2025-12-11 12:16:48 +00:00
## Internal Components
The module includes these internal web components:
| Component | Description |
|-----------|-------------|
| `wcc-dashboard` | Main dashboard container with routing |
2025-12-28 12:51:55 +00:00
| `wcc-sidebar` | Navigation sidebar with collapsible sections |
| `wcc-frame` | Responsive viewport with size controls |
2025-12-11 12:16:48 +00:00
| `wcc-properties` | Property panel with live editing |
| `wcc-record-button` | Recording state indicator button |
| `wcc-recording-panel` | Recording workflow UI |
## RecorderService API
For programmatic recording control:
``` typescript
import { RecorderService , type IRecorderEvents } from '@design.estate/dees-wcctools' ;
const events : IRecorderEvents = {
onDurationUpdate : ( duration ) = > console . log ( ` Recording: ${ duration } s ` ) ,
onRecordingComplete : ( blob ) = > saveBlob ( blob ) ,
onAudioLevelUpdate : ( level ) = > updateMeter ( level ) ,
onError : ( error ) = > console . error ( error ) ,
onStreamEnded : ( ) = > console . log ( 'User stopped sharing' ) ,
} ;
const recorder = new RecorderService ( events ) ;
// Load available microphones
2025-12-28 12:51:55 +00:00
const mics = await recorder . loadMicrophones ( true ) ;
2025-12-11 12:16:48 +00:00
// Start audio level monitoring
await recorder . startAudioMonitoring ( mics [ 0 ] . deviceId ) ;
// Start recording
await recorder . startRecording ( {
2025-12-28 12:51:55 +00:00
mode : 'viewport' ,
2025-12-11 12:16:48 +00:00
audioDeviceId : mics [ 0 ] . deviceId ,
viewportElement : document.querySelector ( '.viewport' ) ,
} ) ;
// Stop recording
recorder . stopRecording ( ) ;
// Export trimmed video
const trimmedBlob = await recorder . exportTrimmedVideo ( videoElement , startTime , endTime ) ;
// Cleanup
recorder . dispose ( ) ;
```
## Architecture
```
ts_web/
├── index.ts # Main exports
2025-12-28 12:51:55 +00:00
├── wcctools.interfaces.ts # Type definitions
2025-12-11 12:16:48 +00:00
├── elements/
│ ├── wcc-dashboard.ts # Root dashboard component
│ ├── wcc-sidebar.ts # Navigation sidebar
2025-12-28 12:51:55 +00:00
│ ├── wcc-frame.ts # Responsive viewport
2025-12-11 12:16:48 +00:00
│ ├── wcc-properties.ts # Property editing panel
│ ├── wcc-record-button.ts # Recording button
│ ├── wcc-recording-panel.ts # Recording options/preview
│ └── wcctools.helpers.ts # Shared utilities
├── services/
│ └── recorder.service.ts # MediaRecorder abstraction
└── pages/
└── index.ts # Built-in pages
```
## Features
- 🎨 Interactive component preview
2025-12-28 12:51:55 +00:00
- 📂 Section-based sidebar with filtering & sorting
2025-12-11 12:16:48 +00:00
- 🔧 Real-time property editing with type detection
- 🌓 Theme switching (light/dark)
- 📱 Responsive viewport testing
- 🎬 Screen recording with trimming
- 🔗 URL-based deep linking