import { html, css, cssManager } from '@design.estate/dees-element'; import '@design.estate/dees-wcctools/demotools'; import type { DeesProgressbar } from './dees-progressbar.js'; export const demoFunc = () => { const terminalSnapshots = [ ['Resolving workspace packages'], ['Resolving workspace packages', 'Downloading ui-assets.tar.gz'], ['Resolving workspace packages', 'Downloading ui-assets.tar.gz', 'Verifying checksum'], ['Resolving workspace packages', 'Downloading ui-assets.tar.gz', 'Verifying checksum', 'Extracting release bundle'], ['Resolving workspace packages', 'Downloading ui-assets.tar.gz', 'Verifying checksum', 'Extracting release bundle', 'Restarting application'], ]; const getUploadStatus = (percentage: number): string => { if (percentage >= 100) { return 'Upload complete. Finalizing package manifest...'; } if (percentage >= 82) { return 'Verifying checksums before handoff...'; } if (percentage >= 55) { return 'Uploading thumbnails to edge cache...'; } if (percentage >= 25) { return 'Streaming source files to the remote worker...'; } return 'Preparing archive and dependency graph...'; }; return html` { const liveProgressbar = elementArg.querySelector('#live-progress') as DeesProgressbar | null; const terminalProgressbar = elementArg.querySelector('#terminal-progress') as DeesProgressbar | null; const demoElement = elementArg as HTMLElement & { __progressbarDemoIntervalId?: number; }; if (!liveProgressbar || !terminalProgressbar) { return; } if (demoElement.__progressbarDemoIntervalId) { window.clearInterval(demoElement.__progressbarDemoIntervalId); } let livePercentage = 12; let terminalSnapshotIndex = 0; const updateDemo = () => { liveProgressbar.percentage = livePercentage; liveProgressbar.statusText = getUploadStatus(livePercentage); terminalProgressbar.terminalLines = [...terminalSnapshots[terminalSnapshotIndex]]; terminalProgressbar.percentage = Math.min(100, (terminalSnapshotIndex + 1) * 20); terminalProgressbar.indeterminate = terminalSnapshotIndex < terminalSnapshots.length - 1; livePercentage = livePercentage >= 100 ? 12 : Math.min(100, livePercentage + 11); terminalSnapshotIndex = terminalSnapshotIndex >= terminalSnapshots.length - 1 ? 0 : terminalSnapshotIndex + 1; }; updateDemo(); demoElement.__progressbarDemoIntervalId = window.setInterval(updateDemo, 1400); }}>
dees-progressbar can now pair a classic progress bar with a fixed-height status area. Use simple status text for clear user-facing updates or switch to terminal-like lines when you want recent steps to stay visible without causing layout jumps.
Determinate

Percentage plus current task

Use a label, a percentage, and one short status line when the work is measurable.

Indeterminate

Spinner-style text indicator

When there is no trustworthy percentage yet, keep the bar moving and let the text explain what is happening.

Terminal Lines

Fixed-height terminal-style status output

The panel stays the same height while the latest step stays visible. This is useful for update flows, downloads, and staged background work.

Live Demo

Updating percentage and text together

A single component can express both how far the job is and which phase is currently active.

Compatibility

Legacy value and progress inputs

Existing usages can keep passing percentages directly or normalized progress values from 0 to 1.

`; };