/** * NextFloor's floating glass cards: they hang over a point of the plan (the viewer reports where that point is * on screen after every frame, see setLiveAnchors) and tell what is going on there. * * - "house": the energy balance – sun, house, battery, grid – with the share of the house running on its own power * - "car": a parked car's charge, range and charging, with buttons for lock, climate and charging; away it tells where * - "media": what a speaker or TV plays – cover, title, artist – with play/pause, skip and the volume * * Cards are rendered by Lit; their position is set directly on the element by the 3D view (no render per frame). */ import { css, html, nothing, svg, type TemplateResult } from "lit"; import type { EnergySummary } from "../energy.ts"; import { socColor, type CarInfo } from "./car.ts"; import type { MediaNow } from "./media.ts"; import { formatNumber, translate } from "../i18n.ts"; import type { HomeAssistant } from "../types.ts"; import { curvePath } from "./day-curves.ts"; import type { PrinterInfo } from "./printer.ts"; import type { HeatPumpInfo } from "./heat-pump.ts"; import type { PlanPoint } from "../viewer/live-energy.ts"; import type { RoomClimateCard } from "./room-climate-card.ts"; import { fromCelsius, tempUnit } from "../devices.ts"; import { trendButton } from "../components/trend-button.ts"; import { loggedEntities } from "../trend-data.ts"; import type { FurniturePowerCard } from "./furniture-power-card.ts"; import type { Furniture } from "../model.ts"; export interface HouseCard { kind: "house"; at: PlanPoint; summary: EnergySummary; autarky: number | null; /** Solar and consumption over the last 24 hours (quarter hours), when the history could be loaded. */ curves?: { solar: (number | null)[]; use: (number | null)[] }; /** Solar and consumption per day over the last seven days (kWh), from the long-term statistics. */ week?: { days: number[]; solar: (number | null)[]; use: (number | null)[] }; /** Gas and water meters: their icon, name and what they read now. */ meters?: { icon: string; label: string; value: string }[]; } export interface CarCard { kind: "car"; at: PlanPoint; spot: string; name: string; car: CarInfo; } export interface MediaCard { kind: "media"; at: PlanPoint; media: MediaNow; } export interface PrinterCard { kind: "printer"; at: PlanPoint; name: string; printer: PrinterInfo; } export interface HeatPumpCard { kind: "heatpump"; at: PlanPoint; name: string; pump: HeatPumpInfo; } export interface HydronicCard { kind: "hydronic"; item: Furniture; readOnly: boolean; at: PlanPoint } export type LiveCard = HouseCard | CarCard | MediaCard | PrinterCard | HeatPumpCard | RoomClimateCard | FurniturePowerCard | HydronicCard; /** A button on a card was pressed: the 3D view calls the service (with extra data such as the volume). */ export type LiveCardAction = (domain: string, service: string, entity: string, data?: Record) => void; function watts(hass: HomeAssistant | undefined, w: number): string { const a = Math.abs(w); return a >= 1000 ? `${formatNumber(hass, a / 1000, a >= 10000 ? 1 : 2)} kW` : `${Math.round(a)} W`; } /** A ring that fills with a share (0…1). */ function ring(share: number, color: string): TemplateResult { const r = 22; const c = 2 * Math.PI * r; return html``; } /** The house card's fold: a small corner button shrinks it to its ring and the sun's power, on desktop and phones. */ export interface LiveCardFold { folded: boolean; toggle: () => void; } function houseCard(hass: HomeAssistant | undefined, c: HouseCard, i: number, fold?: LiveCardFold): TemplateResult { const s = c.summary; const t = (k: Parameters[1]) => translate(hass, k); const own = c.autarky; const foldBtn = fold ? html`` : nothing; if (fold?.folded) { const sun = s.solar !== null ? `☀ ${watts(hass, s.solar)}` : s.consumption !== null ? `⌂ ${watts(hass, s.consumption)}` : null; return html`
${own !== null ? html`
${ring(own, own > 0.95 ? "#4ade80" : own > 0.6 ? "#facc15" : "#f87171")}
${Math.round(own * 100)}%
` : nothing} ${sun ? html`${sun}` : own === null ? html`⌂` : nothing} ${foldBtn}
`; } const rows: TemplateResult[] = []; if (s.solar !== null) rows.push(html`
☀ ${t("energy_solar")}${watts(hass, s.solar)}
`); if (s.consumption !== null) rows.push(html`
⌂ ${t("energy_consumption")}${watts(hass, s.consumption)}
`); if (s.rest !== undefined && s.rest !== null) rows.push(html`
⌂ ${t("energy_rest")}${watts(hass, s.rest)}
`); if (s.battery !== null || s.soc !== null) { const dir = s.battery === null || Math.abs(s.battery) < 15 ? "" : s.battery > 0 ? " ↓" : " ↑"; rows.push( html`
▮ ${t("energy_battery")}${dir}${s.soc !== null ? `${Math.round(s.soc)} %` : ""}${s.battery !== null && Math.abs(s.battery) >= 15 ? ` · ${watts(hass, s.battery)}` : ""}
`, ); } if (s.grid !== null) { const exporting = s.grid < -15; rows.push(html`
⇄ ${t(exporting ? "energy_grid_export" : "energy_grid_import")}${watts(hass, s.grid)}
`); } for (const m of c.meters ?? []) rows.push(html`
${m.icon} ${m.label}${m.value}
`); return html`
${foldBtn} ${own !== null ? html`
${ring(own, own > 0.95 ? "#4ade80" : own > 0.6 ? "#facc15" : "#f87171")}
${Math.round(own * 100)} %${t("live_autarky")}
` : nothing}
${rows}
${dayChart(hass, c.curves)} ${weekChart(hass, c.week)}
`; } /** The last seven days: a bar per day for solar (filled) and consumption (outlined), in kWh. */ function weekChart(hass: HomeAssistant | undefined, week: HouseCard["week"]): TemplateResult | typeof nothing { if (!week) return nothing; const values = [...week.solar, ...week.use].filter((v): v is number => v !== null && v > 0); if (!values.length) return nothing; const top = Math.max(...values) * 1.1 || 1; const [w, h] = [150, 30]; const slot = w / 7; const bar = (v: number | null, x: number, cls: string) => (v === null || v <= 0 ? nothing : svg``); const total = (list: (number | null)[]) => list.reduce((a, b) => a + (b ?? 0), 0); return html`
7 ${translate(hass, "live_days")}
`; } /** The day at a glance: solar as a filled curve, consumption as a line, over the last 24 hours. */ function dayChart(hass: HomeAssistant | undefined, curves: HouseCard["curves"]): TemplateResult | typeof nothing { if (!curves) return nothing; const values = [...curves.solar, ...curves.use].filter((v): v is number => v !== null); if (values.length < 4) return nothing; const top = Math.max(...values) * 1.08 || 1; const [w, h] = [150, 34]; const solar = curvePath(curves.solar, w, h, top); const use = curvePath(curves.use, w, h, top); return html`
24 h
`; } function carCard(hass: HomeAssistant | undefined, c: CarCard, i: number, act: LiveCardAction): TemplateResult { const car = c.car; const t = (k: Parameters[1], v?: Record) => translate(hass, k, v); const color = socColor(car.soc); const status = !car.home ? `${t("live_car_away")}${car.where ? ` · ${car.where}` : ""}${car.distance !== null ? ` · ${formatNumber(hass, car.distance, car.distance < 10 ? 1 : 0)} km` : ""}` : car.charging ? `⚡ ${t("live_car_charging")}${car.chargingW ? ` · ${watts(hass, car.chargingW)}` : ""}` : car.plugged ? `🔌 ${t("live_car_plugged")}` : ""; const e = car.entities; const button = (on: boolean | null, label: string, icon: string, run: () => void) => html``; return html`
${ring((car.soc ?? 0) / 100, color)}
${car.soc !== null ? `${Math.round(car.soc)} %` : "–"}${car.range !== null ? `${Math.round(car.range)} ${car.rangeUnit}` : ""}
${c.name}
${status ? html`
${status}
` : nothing} ${car.inside !== null ? html`
🌡 ${formatNumber(hass, car.inside, 1)} °C
` : nothing} ${car.departure ? html`
⏰ ${t("live_car_departure", { time: car.departure })}
` : nothing} ${car.open.length ? html`
⚠ ${t("live_car_open", { parts: car.open.join(", ") })}
` : nothing}
${e.lock ? button(car.locked, t(car.locked ? "live_car_unlock" : "live_car_lock"), car.locked ? "🔒" : "🔓", () => { if (car.locked && !confirm(t("live_car_unlock_confirm", { name: c.name }))) return; act("lock", car.locked ? "unlock" : "lock", e.lock!); }) : nothing} ${e.climate ? button(car.climateOn, t("live_car_climate"), "❄", () => act(e.climate!.split(".")[0], car.climateOn ? "turn_off" : "turn_on", e.climate!)) : nothing} ${e.charge && car.home ? button(car.charging, t("live_car_charge"), "⚡", () => act(e.charge!.split(".")[0], "toggle", e.charge!)) : nothing}
`; } function mediaCard(hass: HomeAssistant | undefined, c: MediaCard, i: number, act: LiveCardAction): TemplateResult { const m = c.media; const t = (k: Parameters[1]) => translate(hass, k); const color = `rgb(${m.color.join(",")})`; const btn = (label: string, icon: string, service: string) => html``; // compact (cover and title); a tap opens the controls return html`
(ev.currentTarget as HTMLElement).classList.toggle("live-open")}> ${m.picture ? html`` : html`
♪
`}
${m.title || m.name}
${m.artist || m.app || m.name}
${btn(t("live_media_prev"), "⏮", "media_previous_track")} ${btn(t("live_media_playpause"), "⏯", "media_play_pause")} ${btn(t("live_media_next"), "⏭", "media_next_track")} ${m.volume !== null ? html` ev.stopPropagation()} @change=${(ev: Event) => act("media_player", "volume_set", m.entity, { volume_level: Number((ev.target as HTMLInputElement).value) / 100 })} />` : nothing}
`; } /** * Keeps the cards from covering each other: after they were placed for a frame, a card that overlaps one placed * before it (lower on screen first) moves up above it. Its thread to the anchor stretches. */ export function unstackLhCards(root: ParentNode): void { const cards = [...root.querySelectorAll(".live-card")].filter((el) => el.style.visibility !== "hidden"); const placed: { x0: number; x1: number; y0: number; y1: number }[] = []; // a card near the edge slides back into the view (on a phone it was cut off); its thread still points home const width = cards[0]?.parentElement?.clientWidth ?? 0; const height = cards[0]?.parentElement?.clientHeight ?? 0; const items = cards .map((el) => { const [anchor, w] = [Number(el.dataset.x), el.offsetWidth]; const x = !width ? anchor : width > w + 16 ? Math.min(Math.max(anchor, w / 2 + 8), width - w / 2 - 8) : width / 2; el.style.setProperty("--live-dx", `${Math.round(anchor - x)}px`); return { el, x, y: Number(el.dataset.y), w, h: el.offsetHeight }; }) .sort((a, b) => b.y - a.y); for (const it of items) { let bottom = it.y; // Multi-reading equipment cards use nearby free columns before stacking out of view. if ((it.el.classList.contains("live-card-hydronic") || it.el.classList.contains("live-card-charging")) && width > it.w + 16 && height > it.h + 16) { const xs = [it.x, it.w / 2 + 8, width - it.w / 2 - 8, ...placed.flatMap((p) => [p.x0 - it.w / 2 - 8, p.x1 + it.w / 2 + 8])] .filter((x) => x >= it.w / 2 + 8 && x <= width - it.w / 2 - 8).sort((a, b) => Math.abs(a - it.x) - Math.abs(b - it.x)); const ys = [Math.max(it.h + 8, Math.min(height - 8, bottom)), ...placed.flatMap((p) => [p.y0 - 8, p.y1 + it.h + 8])].filter((y) => y >= it.h + 8 && y <= height - 8); let position: { x: number; y: number } | undefined; for (const y of ys) { for (const x of xs) { if (!placed.some((p) => x - it.w / 2 < p.x1 + 6 && x + it.w / 2 > p.x0 - 6 && y - it.h < p.y1 + 6 && y > p.y0 - 6)) { position = { x, y }; break; } } if (position) break; } if (position) { it.x = position.x; bottom = position.y; } } for (let guard = 0; guard < 12; guard++) { const r = { x0: it.x - it.w / 2, x1: it.x + it.w / 2, y0: bottom - it.h, y1: bottom }; const hit = placed.find((p) => r.x0 < p.x1 + 6 && r.x1 > p.x0 - 6 && r.y0 < p.y1 + 6 && r.y1 > p.y0 - 6); if (!hit) break; bottom = hit.y0 - 8; } placed.push({ x0: it.x - it.w / 2, x1: it.x + it.w / 2, y0: bottom - it.h, y1: bottom }); const lift = it.y - bottom; it.el.style.setProperty("--live-dx", `${Math.round(Number(it.el.dataset.x) - it.x)}px`); it.el.style.transform = `translate(${Math.round(it.x)}px, ${Math.round(bottom)}px) translate(-50%, -100%)`; it.el.style.setProperty("--live-thread", `${Math.round(18 + lift)}px`); } } /** A 3D printer's print: the model's picture, progress, when it is done, the layer, temperatures and the filaments. */ function printerCard(hass: HomeAssistant | undefined, c: PrinterCard, i: number): TemplateResult { const p = c.printer; const t = (k: Parameters[1], v?: Record) => translate(hass, k, v); const pct = p.progress ?? 0; const clock = (ms: number) => new Intl.DateTimeFormat(hass?.language ?? navigator.language, { hour: "2-digit", minute: "2-digit" }).format(new Date(ms)); const left = p.remaining !== null ? (p.remaining >= 60 ? `${Math.floor(p.remaining / 60)} h ${Math.round(p.remaining % 60)} min` : `${Math.round(p.remaining)} min`) : null; const temps = [p.nozzle !== null ? `${t("printer_nozzle")} ${Math.round(p.nozzle)}°` : null, p.bed !== null ? `${t("printer_bed")} ${Math.round(p.bed)}°` : null].filter(Boolean).join(" · "); return html`
${p.picture ? html`` : ring(pct / 100, p.printing ? "#38bdf8" : "#8aa0c8")}
${p.progress !== null ? `${Math.round(pct)} %` : "–"}${t(`printer_${p.printing ? "printing" : /finish|complete|fertig/.test(p.status) ? "done" : /pause/.test(p.status) ? "paused" : /error|fail/.test(p.status) ? "error" : "idle"}`)}
${c.name}
${p.job ? html`
${p.job}
` : nothing} ${p.printing && (p.endsAt || left) ? html`
⏱ ${[left, p.endsAt ? t("printer_done_at", { time: clock(p.endsAt) }) : null].filter(Boolean).join(" · ")}
` : nothing} ${p.layer !== null ? html`
▤ ${t("printer_layer")} ${p.layer}${p.layers ? ` / ${p.layers}` : ""}
` : nothing} ${temps ? html`
🌡 ${temps}
` : nothing} ${p.filaments.length ? html`
${p.filaments.map((f) => html``)}
` : nothing}
`; } /** A heat pump: what it does, flow and return, the outside, power and heat, and its COP as a ring (6 = full). */ function heatPumpCard(hass: HomeAssistant | undefined, c: HeatPumpCard, i: number): TemplateResult { const p = c.pump; const t = (k: Parameters[1]) => translate(hass, k); const deg = (v: number | null) => (v === null ? "–" : `${formatNumber(hass, v, 1)}°`); const icon = { heating: "🔥", water: "🚿", cooling: "❄", defrost: "🧊", idle: "⏸" }[p.mode]; return html`
${ring(Math.min(1, (p.cop ?? 0) / 6), (p.cop ?? 0) >= 3.5 ? "#4ade80" : (p.cop ?? 0) >= 2.5 ? "#facc15" : "#fb923c")}
${p.cop !== null ? formatNumber(hass, p.cop, 1) : icon}${p.cop !== null ? "COP" : ""}
${c.name}
${icon} ${t(`heatpump_${p.mode}`)}
${p.flow !== null || p.return !== null ? html`
${t("heatpump_flow_return")}${deg(p.flow)} → ${deg(p.return)}
` : nothing} ${p.heat !== null ? html`
${t("heatpump_heat")}${watts(hass, p.heat)}
` : nothing} ${p.power !== null ? html`
${t("heatpump_power")}${watts(hass, p.power)}
` : nothing} ${p.outside !== null ? html`
🌡 ${t("heatpump_outside")} ${deg(p.outside)}
` : nothing}
`; } function roomClimateCard(hass: HomeAssistant | undefined, c: RoomClimateCard, i: number): TemplateResult { const value = (n: number | null, digits: number, unit: string) => n === null ? "–" : `${formatNumber(hass, n, digits)} ${unit}`; const trends = Object.values(c.sources ?? {}).some((ids) => loggedEntities(hass, ids).length > 0); return html`
${c.showTemperature ? html`
🌡${value(c.temperature === null ? null : hass ? fromCelsius(hass, c.temperature) : c.temperature, 1, hass ? tempUnit(hass) : "°C")}${trendButton(hass, c.sources?.temperature ?? [], translate(hass, "climate_temperature"))}
` : nothing} ${c.showHumidity ? html`
💧${value(c.humidity, 0, "%")}${trendButton(hass, c.sources?.humidity ?? [], translate(hass, "climate_humidity"))}
` : nothing} ${c.showCo2 ? html`
☁${value(c.co2, 0, "ppm")}${trendButton(hass, c.sources?.co2 ?? [], translate(hass, "climate_co2"))}
` : nothing} ${c.showIlluminance ? html`
☀${value(c.illuminance, 0, "lx")}${trendButton(hass, c.sources?.illuminance ?? [], translate(hass, "climate_illuminance"))}
` : nothing}
`; } function furniturePowerCard(hass: HomeAssistant | undefined, c: FurniturePowerCard, i: number): TemplateResult { const power = c.power === null ? "–" : `${c.power < 0 ? "−" : ""}${watts(hass, c.power)}`; return html`
${c.name}
${c.powerEntity ? html`
${power}${trendButton(hass, [c.powerEntity], c.name)}
` : nothing} ${(c.readings ?? []).map((r) => html`
${r.label}${r.text}${trendButton(hass, [r.entity], r.label)}
`)}
`; } export function renderLhCards(hass: HomeAssistant | undefined, cards: readonly LiveCard[], act: LiveCardAction, fold?: LiveCardFold, climateOnly = false): TemplateResult | typeof nothing { if (!cards.length) return nothing; return html`
${cards.map((c, i) => (c.kind === "roomclimate" ? roomClimateCard(hass, c, i) : c.kind === "power" ? furniturePowerCard(hass, c, i) : c.kind === "hydronic" ? html`
` : climateOnly ? nothing : c.kind === "house" ? houseCard(hass, c, i, fold) : c.kind === "car" ? carCard(hass, c, i, act) : c.kind === "printer" ? printerCard(hass, c, i) : c.kind === "heatpump" ? heatPumpCard(hass, c, i) : mediaCard(hass, c, i, act)))}
`; } export const liveCardStyles = css` .live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; } .live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; } .live-card-power .live-row { align-items:center; gap:6px; } .live-card-power .live-row b { margin-left:auto; color:color-mix(in srgb,#ffca8a 80%,var(--nf-text)); font-variant-numeric:tabular-nums; } .live-card-power nf-trend-button { margin-left:0; } .live-card-power.live-card-charging { max-width:min(320px,calc(100vw - 24px)); } .live-card-power .live-charging-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) 18px; align-items:center; column-gap:6px; min-height:18px; } .live-charging-label { color:var(--nf-muted); font-size:10px; overflow:hidden; text-overflow:ellipsis; } .live-charging-row b { font-size:11px; overflow:hidden; text-overflow:ellipsis; } .live-charging-row nf-trend-button { grid-column:3; } .live-cards { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; container-type: size; } /* a phone: the cards keep to the screen, the house card leaves its week out */ @container (max-width: 480px) { .live-card { gap: 8px; padding: 8px 10px; font-size: 11.5px; } .live-card-house:not(.live-folded) { padding-right: 28px; } .live-card-house .live-week { display: none; } .live-rows { min-width: 0; } } .live-card { position: absolute; left: 0; top: 0; visibility: hidden; pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: calc(var(--nf-radius) + 4px); background: var(--nf-chrome); box-shadow: var(--nf-shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--nf-text); font-size: 12.5px; line-height: 1.35; white-space: nowrap; will-change: transform; } .live-card::after { /* a thin glowing thread down to the point the card belongs to */ content: ""; position: absolute; left: clamp(12px, calc(50% + var(--live-dx, 0px)), calc(100% - 12px)); bottom: calc(-1 * var(--live-thread, 18px)); width: 1px; height: var(--live-thread, 18px); background: linear-gradient(color-mix(in srgb, var(--nf-text) 45%, transparent), transparent); } .live-fold { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--nf-text) 10%, transparent); color: var(--nf-text); font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; opacity: 0.7; } .live-fold:hover, .live-fold:focus-visible { opacity: 1; background: color-mix(in srgb, var(--nf-text) 20%, transparent); } .live-card-house:not(.live-folded) { padding-right: 30px; } .live-folded { padding: 6px 30px 6px 8px; gap: 8px; } .live-folded .live-own, .live-folded .live-ring { width: 38px; height: 38px; } .live-folded .live-own-text b { font-size: 11px; } .live-rows { display: grid; gap: 2px; min-width: 150px; } .live-card-roomclimate { display: grid; gap: 4px; min-width: 96px; max-width: calc(100vw - 24px); box-sizing: border-box; } .live-card-roomclimate .live-row { display: grid; grid-template-columns: 14px minmax(0, 1fr); align-items: center; column-gap: 6px; min-height: 18px; } .live-climate-trends .live-row { grid-template-columns: 14px minmax(0, 1fr) 18px; } .live-card-roomclimate .live-row b { justify-self: end; white-space: nowrap; line-height: 18px; font-variant-numeric: tabular-nums; } .live-card-roomclimate nf-trend-button { grid-column: 3; margin-left: 0; } .live-climate-temperature b { color: color-mix(in srgb, #ffca8a 80%, var(--nf-text)); } .live-climate-humidity b { color: color-mix(in srgb, #7dd3fc 80%, var(--nf-text)); } .live-climate-co2 b { color: color-mix(in srgb, #c4b5fd 80%, var(--nf-text)); } .live-climate-illuminance b { color: color-mix(in srgb, #fde68a 80%, var(--nf-text)); } .live-row { display: flex; justify-content: space-between; gap: 14px; } .live-day { position: relative; margin-top: 6px; } .live-day svg { display: block; width: 100%; height: 34px; } .live-day-solar { fill: rgba(250, 204, 21, 0.35); stroke: #facc15; stroke-width: 1; vector-effect: non-scaling-stroke; } .live-week svg { height: 30px; } .live-week-solar { fill: rgba(250, 204, 21, 0.6); } .live-week-use { fill: rgba(232, 238, 255, 0.18); stroke: #e8eeff; stroke-width: 1; vector-effect: non-scaling-stroke; } .live-day-use { fill: none; stroke: #e8eeff; stroke-width: 1.4; vector-effect: non-scaling-stroke; } .live-day span { position: absolute; right: 2px; top: 0; font-size: 9px; opacity: 0.6; } .live-row span { opacity: 0.8; } .live-solar b { color: color-mix(in srgb, #ffd166 72%, var(--nf-text)); } .live-battery b { color: color-mix(in srgb, #4ade80 72%, var(--nf-text)); } .live-import b { color: color-mix(in srgb, #f87193 72%, var(--nf-text)); } .live-export b { color: color-mix(in srgb, #38dcf5 72%, var(--nf-text)); } .live-house b { color: color-mix(in srgb, #b6c2ff 72%, var(--nf-text)); } .live-title { font-weight: 600; font-size: 13px; } .live-status { opacity: 0.85; } .live-print-pic { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; background: rgba(255, 255, 255, 0.06); } .live-filaments { display: flex; gap: 4px; margin-top: 2px; } .live-filaments i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); } .live-warn { color: #fbbf24; opacity: 1; } .live-actions { display: flex; gap: 6px; margin-top: 4px; } .live-btn { font: inherit; font-size: 14px; width: 32px; height: 28px; border-radius: 9px; border: none; background: var(--nf-fill); color: inherit; cursor: pointer; } .live-btn.live-on { background: color-mix(in srgb, var(--live-soc, #4ade80) 30%, transparent); border-color: var(--live-soc, #4ade80); } .live-card-car { border-color: color-mix(in srgb, var(--live-soc) 60%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--live-soc) 30%, transparent), inset 0 0 18px rgba(120, 200, 255, 0.06); } .live-card-car.live-charging { animation: live-charge 1.6s ease-in-out infinite; } @keyframes live-charge { 50% { box-shadow: 0 0 34px color-mix(in srgb, var(--live-soc) 55%, transparent), inset 0 0 18px rgba(120, 200, 255, 0.1); } } .live-card-car.live-away { opacity: 0.85; border-style: dashed; } /* phones: only the house and the car, the media cards would cover the rooms */ .nf-narrow .live-card-media { display: none; } .live-card-media { border-color: color-mix(in srgb, var(--live-soc) 55%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--live-soc) 28%, transparent), inset 0 0 18px rgba(120, 200, 255, 0.06); } .live-card-media .live-title { max-width: 190px; overflow: hidden; text-overflow: ellipsis; } .live-card-media { cursor: pointer; padding: 7px 12px 7px 7px; } .live-card-media .live-actions { display: none; } .live-card-media.live-open .live-actions { display: flex; } .live-card-media.live-open { z-index: 5; } .live-cover { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; box-shadow: 0 0 14px color-mix(in srgb, var(--live-soc) 40%, transparent); } .live-cover-none { display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--live-soc) 25%, transparent); } .live-volume { width: 80px; accent-color: var(--live-soc); } .live-own { position: relative; width: 54px; height: 54px; } .live-ring { width: 54px; height: 54px; } .live-ring-bg { fill: none; stroke: color-mix(in srgb, var(--nf-text) 10%, transparent); stroke-width: 5; } .live-ring-fg { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 0.6s ease; } .live-own-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; } .live-own-text b { font-size: 13px; } .live-own-text span { font-size: 8.5px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.04em; } `;