const EDITOR_STYLES = ` :host { display: none; position: fixed; inset: 0; z-index: 40; align-items: center; justify-content: center; padding: 1rem; background: rgba(4, 6, 12, 0.72); font-family: system-ui, sans-serif; color: var(--text, #e8ecf7); } :host([open]) { display: flex; } .dialog { width: min(100%, 460px); max-height: min(92vh, 720px); overflow: auto; background: #12151f; border: 1px solid #2a3044; border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); } .head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.9rem 1rem; border-bottom: 1px solid #2a3044; position: sticky; top: 0; background: #12151f; z-index: 1; } .head h2 { margin: 0; font-size: 1.05rem; } .body { padding: 0.85rem 1rem 1rem; } label { display: flex; justify-content: space-between; align-items: center; margin: 0.75rem 0 0.35rem; font-size: 0.8rem; color: #8b93a8; } select, input[type="text"], input[type="number"], button { width: 100%; background: #1a1f2e; color: inherit; border: 1px solid #2a3044; border-radius: 6px; padding: 0.45rem 0.6rem; font-size: 0.9rem; } button { cursor: pointer; background: #243049; } button:hover { border-color: #5b8cff; } button.primary { background: #2a3f6e; border-color: #5b8cff; } button.danger { background: #3a1f28; border-color: #7a3545; } .check { display: flex; align-items: center; gap: 0.5rem; margin: 0.85rem 0 0.35rem; font-size: 0.85rem; color: #e8ecf7; } .check input { width: auto; } .steps { display: grid; gap: 0.5rem; margin-top: 0.5rem; } .step { display: grid; grid-template-columns: 1fr 4.5rem auto; gap: 0.35rem; align-items: center; } .step input[type="number"] { text-align: right; } .step .remove { width: auto; padding: 0.45rem 0.55rem; } .hint { margin: 0.35rem 0 0; font-size: 0.75rem; color: #8b93a8; } .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 1rem; } .actions-wide { display: grid; gap: 0.5rem; margin-top: 0.5rem; } .empty { margin: 0.5rem 0 0; font-size: 0.8rem; color: #8b93a8; } `; /** * Modal editor: create/edit a timed sequence of presets. * Events: * - portal-sequence-editor-save { draft, id|null } * - portal-sequence-editor-delete { id, name } * - portal-sequence-editor-close */ export class PortalSequenceEditor extends HTMLElement { constructor() { super(); /** @type {import('../api.js').Preset[]} */ this._presets = []; /** @type {string | null} */ this._editId = null; this._name = ""; this._loop = true; /** @type {import('../api.js').SequenceStep[]} */ this._steps = []; } connectedCallback() { if (this.shadowRoot) return; const root = this.attachShadow({ mode: "open" }); root.innerHTML = `
Each step plays a preset for a number of seconds.
Add at least one step.