import { DeesElement, property, html, customElement, type TemplateResult, state } from '@design.estate/dees-element'; import { WccDashboard } from './wcc-dashboard.js'; import type { TTemplateFactory } from './wcctools.helpers.js'; export type TPropertyType = 'String' | 'Number' | 'Boolean' | 'Object' | 'Enum' | 'Array'; export type TEnvironment = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone'; export type TTheme = 'bright' | 'dark'; let environment: TEnvironment = 'native'; export const setEnvironment = (envArg) => { environment = envArg; }; @customElement('wcc-properties') export class WccProperties extends DeesElement { @property({ type: WccDashboard }) accessor dashboardRef: WccDashboard; @property() accessor selectedItem: TTemplateFactory | DeesElement; @property() accessor selectedViewport: TEnvironment = 'native'; @property() accessor selectedTheme: TTheme = 'dark'; @property() accessor warning: string = null; @property() accessor isFullscreen: boolean = false; @state() accessor propertyContent: TemplateResult[] = []; @state() accessor editingProperties: Array<{ id: string; name: string; value: any; element: HTMLElement; editorValue: string; editorError: string; }> = []; // Recording state properties @state() accessor recordingState: 'idle' | 'options' | 'recording' | 'preview' = 'idle'; @state() accessor recordingMode: 'viewport' | 'screen' = 'screen'; @state() accessor audioEnabled: boolean = false; @state() accessor selectedMicrophoneId: string = ''; @state() accessor availableMicrophones: MediaDeviceInfo[] = []; @state() accessor audioLevel: number = 0; @state() accessor recordingDuration: number = 0; @state() accessor recordedBlob: Blob | null = null; @state() accessor previewVideoUrl: string = ''; // Recording private members private mediaRecorder: MediaRecorder | null = null; private recordedChunks: Blob[] = []; private durationInterval: number | null = null; private audioContext: AudioContext | null = null; private audioAnalyser: AnalyserNode | null = null; private audioMonitoringInterval: number | null = null; private currentStream: MediaStream | null = null; public editorHeight: number = 300; public render(): TemplateResult { return html` ${this.editingProperties.length > 0 ? html`