component DeviceFrame { outputs { change(payload: { device: string; orientation: string; sourceEvent: Event }) rotate(payload: { device: string; orientation: string; sourceEvent: Event }) } props { size: string = "default" color: string = "primary" title: string = "Device Frame" description: string = "" items: unknown[] = [] variant: string = "default" device: string = "phone" orientation: string = "portrait" src: string = "" srcdoc: string = "" frameTitle: string = "Device preview" showToolbar: boolean = true allow: string = "" class: string = "" } state currentOrientation = orientation functions { client function setDevice(nextDevice, sourceEvent) { output.change({ device: nextDevice, orientation: currentOrientation, sourceEvent: sourceEvent }) } client function rotateFrame(sourceEvent) { currentOrientation = currentOrientation === "portrait" ? "landscape" : "portrait"; output.rotate({ device: device, orientation: currentOrientation, sourceEvent: sourceEvent }); output.change({ device: device, orientation: currentOrientation, sourceEvent: sourceEvent }) } } view {
{#if title}{title}{/if}{#if description}

{description}

{/if}
{#if showToolbar}{/if}
{#if src || srcdoc}{:else}
{/if}
} }