diff --git a/README.md b/README.md index 07e772c..57e30fb 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,9 @@ Designed and optimised for the Sonoff NSPanel Pro 120 in landscape mode, but wor ## Features -- **Beer emoji pictogram** — see how many glasses remain in your keg at a glance -- **Built-in beer catalog** — 45+ PerfectDraft beers with brand color palettes +- **Five layouts** — landscape, portrait, compact, hero, or single-vessel gauge; choose what fits your dashboard (defaults to landscape, so existing cards are unchanged) +- **Beer emoji pictogram** — see how many glasses remain in your keg at a glance, in a grid that shrinks to fit narrow cards +- **Built-in beer catalog** — 75+ PerfectDraft beers, 68 with real keg photos; brand-tinted fallback art for the rest so every beer looks intentional - **Glass size selector** — tap the emoji zone to choose between 250 mL, 330 mL, 500 mL, UK pint, or US pint - **Beer selector** — tap the label zone to pick your current beer from the catalog - **Freshness warnings** — escalating CSS-animated alerts as your keg approaches its 30-day expiry @@ -53,6 +54,9 @@ type: custom:perfectdraft-card device_id: "perfectdraft_pro" beer_name: "Leffe Blonde" glass_size: 330 +layout: landscape # landscape | portrait | compact | hero | vessel +# matrix_columns: auto # "auto" or a fixed number of emoji columns +# max_matrix_width: "480px" # cap + centre the emoji grid on wide cards # beer_entity: sensor.perfectdraft_pro_keg_name # future: auto beer detection # custom_beers: # - name: "My Homebrew IPA" @@ -71,6 +75,20 @@ glass_size: 330 Selections persist in your browser across page refreshes. +## Layouts + +Set `layout` (or pick it in the visual editor) to match where the card lives: + +| Layout | Best for | +|--------|----------| +| `landscape` (default) | Wall panels (NSPanel Pro), wide cards — label left, emoji grid right | +| `portrait` | Phones and tall/narrow columns — label on top, grid below | +| `compact` | Dense dashboards — a single row with a remaining-beer bar | +| `hero` | Showing off the beer — full-bleed keg photo with status overlaid | +| `vessel` | A calm single glass that fills to show how much is left | + +The emoji grid is width-tolerant: it shrinks to fit narrow cards instead of overflowing. Power users can force a column count with `matrix_columns` or cap/centre the grid with `max_matrix_width`. + ## Supported glass sizes | Size | Description | diff --git a/dist/kegs/anoesteke.png b/dist/kegs/anoesteke.png deleted file mode 100644 index d4024ed..0000000 Binary files a/dist/kegs/anoesteke.png and /dev/null differ diff --git a/dist/kegs/anoesteke.webp b/dist/kegs/anoesteke.webp new file mode 100644 index 0000000..5cc972a Binary files /dev/null and b/dist/kegs/anoesteke.webp differ diff --git a/dist/kegs/becks-gold.png b/dist/kegs/becks-gold.png deleted file mode 100644 index a2fb094..0000000 Binary files a/dist/kegs/becks-gold.png and /dev/null differ diff --git a/dist/kegs/becks-gold.webp b/dist/kegs/becks-gold.webp new file mode 100644 index 0000000..5d353cd Binary files /dev/null and b/dist/kegs/becks-gold.webp differ diff --git a/dist/kegs/becks.png b/dist/kegs/becks.png deleted file mode 100644 index cd4a5c1..0000000 Binary files a/dist/kegs/becks.png and /dev/null differ diff --git a/dist/kegs/becks.webp b/dist/kegs/becks.webp new file mode 100644 index 0000000..7adb172 Binary files /dev/null and b/dist/kegs/becks.webp differ diff --git a/dist/kegs/brewdog-elvis-juice.webp b/dist/kegs/brewdog-elvis-juice.webp new file mode 100644 index 0000000..0f12599 Binary files /dev/null and b/dist/kegs/brewdog-elvis-juice.webp differ diff --git a/dist/kegs/brewdog-punk-ipa.webp b/dist/kegs/brewdog-punk-ipa.webp new file mode 100644 index 0000000..9598639 Binary files /dev/null and b/dist/kegs/brewdog-punk-ipa.webp differ diff --git a/dist/kegs/bud-light.webp b/dist/kegs/bud-light.webp new file mode 100644 index 0000000..8477f0d Binary files /dev/null and b/dist/kegs/bud-light.webp differ diff --git a/dist/kegs/bud.png b/dist/kegs/bud.png deleted file mode 100644 index c051d1d..0000000 Binary files a/dist/kegs/bud.png and /dev/null differ diff --git a/dist/kegs/bud.webp b/dist/kegs/bud.webp new file mode 100644 index 0000000..c009610 Binary files /dev/null and b/dist/kegs/bud.webp differ diff --git a/dist/kegs/camden-eazy.png b/dist/kegs/camden-eazy.png deleted file mode 100644 index a2d8684..0000000 Binary files a/dist/kegs/camden-eazy.png and /dev/null differ diff --git a/dist/kegs/camden-eazy.webp b/dist/kegs/camden-eazy.webp new file mode 100644 index 0000000..488e995 Binary files /dev/null and b/dist/kegs/camden-eazy.webp differ diff --git a/dist/kegs/camden-hells.png b/dist/kegs/camden-hells.png deleted file mode 100644 index 5052cbd..0000000 Binary files a/dist/kegs/camden-hells.png and /dev/null differ diff --git a/dist/kegs/camden-hells.webp b/dist/kegs/camden-hells.webp new file mode 100644 index 0000000..29e54fe Binary files /dev/null and b/dist/kegs/camden-hells.webp differ diff --git a/dist/kegs/camden-ipa.png b/dist/kegs/camden-ipa.png deleted file mode 100644 index d4aa6bd..0000000 Binary files a/dist/kegs/camden-ipa.png and /dev/null differ diff --git a/dist/kegs/camden-ipa.webp b/dist/kegs/camden-ipa.webp new file mode 100644 index 0000000..62bfb3c Binary files /dev/null and b/dist/kegs/camden-ipa.webp differ diff --git a/dist/kegs/camden-pale.png b/dist/kegs/camden-pale.png deleted file mode 100644 index a31be50..0000000 Binary files a/dist/kegs/camden-pale.png and /dev/null differ diff --git a/dist/kegs/camden-pale.webp b/dist/kegs/camden-pale.webp new file mode 100644 index 0000000..e9516b7 Binary files /dev/null and b/dist/kegs/camden-pale.webp differ diff --git a/dist/kegs/castelain-chti.webp b/dist/kegs/castelain-chti.webp new file mode 100644 index 0000000..65ca7f1 Binary files /dev/null and b/dist/kegs/castelain-chti.webp differ diff --git a/dist/kegs/castelain.png b/dist/kegs/castelain.png deleted file mode 100644 index d9b66f8..0000000 Binary files a/dist/kegs/castelain.png and /dev/null differ diff --git a/dist/kegs/castelain.webp b/dist/kegs/castelain.webp new file mode 100644 index 0000000..e89216b Binary files /dev/null and b/dist/kegs/castelain.webp differ diff --git a/dist/kegs/corona-cero.png b/dist/kegs/corona-cero.png deleted file mode 100644 index 9630d2d..0000000 Binary files a/dist/kegs/corona-cero.png and /dev/null differ diff --git a/dist/kegs/corona-cero.webp b/dist/kegs/corona-cero.webp new file mode 100644 index 0000000..0482198 Binary files /dev/null and b/dist/kegs/corona-cero.webp differ diff --git a/dist/kegs/corona.png b/dist/kegs/corona.png deleted file mode 100644 index 6f72c34..0000000 Binary files a/dist/kegs/corona.png and /dev/null differ diff --git a/dist/kegs/corona.webp b/dist/kegs/corona.webp new file mode 100644 index 0000000..2096b02 Binary files /dev/null and b/dist/kegs/corona.webp differ diff --git a/dist/kegs/diebels.webp b/dist/kegs/diebels.webp new file mode 100644 index 0000000..4c2e7f2 Binary files /dev/null and b/dist/kegs/diebels.webp differ diff --git a/dist/kegs/dupont.png b/dist/kegs/dupont.png deleted file mode 100644 index 40d6004..0000000 Binary files a/dist/kegs/dupont.png and /dev/null differ diff --git a/dist/kegs/dupont.webp b/dist/kegs/dupont.webp new file mode 100644 index 0000000..d03c0cc Binary files /dev/null and b/dist/kegs/dupont.webp differ diff --git a/dist/kegs/franziskaner-kellerbier.png b/dist/kegs/franziskaner-kellerbier.png deleted file mode 100644 index 678a8a1..0000000 Binary files a/dist/kegs/franziskaner-kellerbier.png and /dev/null differ diff --git a/dist/kegs/franziskaner-kellerbier.webp b/dist/kegs/franziskaner-kellerbier.webp new file mode 100644 index 0000000..b1d3d84 Binary files /dev/null and b/dist/kegs/franziskaner-kellerbier.webp differ diff --git a/dist/kegs/franziskaner-royal.png b/dist/kegs/franziskaner-royal.png deleted file mode 100644 index 1946255..0000000 Binary files a/dist/kegs/franziskaner-royal.png and /dev/null differ diff --git a/dist/kegs/franziskaner-royal.webp b/dist/kegs/franziskaner-royal.webp new file mode 100644 index 0000000..4af89e4 Binary files /dev/null and b/dist/kegs/franziskaner-royal.webp differ diff --git a/dist/kegs/franziskaner.png b/dist/kegs/franziskaner.png deleted file mode 100644 index 5d99dff..0000000 Binary files a/dist/kegs/franziskaner.png and /dev/null differ diff --git a/dist/kegs/franziskaner.webp b/dist/kegs/franziskaner.webp new file mode 100644 index 0000000..a99ff2d Binary files /dev/null and b/dist/kegs/franziskaner.webp differ diff --git a/dist/kegs/fruh-kolsch.png b/dist/kegs/fruh-kolsch.png deleted file mode 100644 index 8dba961..0000000 Binary files a/dist/kegs/fruh-kolsch.png and /dev/null differ diff --git a/dist/kegs/fruh-kolsch.webp b/dist/kegs/fruh-kolsch.webp new file mode 100644 index 0000000..c0a2c52 Binary files /dev/null and b/dist/kegs/fruh-kolsch.webp differ diff --git a/dist/kegs/fullers-london-pride.webp b/dist/kegs/fullers-london-pride.webp new file mode 100644 index 0000000..d40fbbc Binary files /dev/null and b/dist/kegs/fullers-london-pride.webp differ diff --git a/dist/kegs/goose-island-ipa.png b/dist/kegs/goose-island-ipa.png deleted file mode 100644 index eff2422..0000000 Binary files a/dist/kegs/goose-island-ipa.png and /dev/null differ diff --git a/dist/kegs/goose-island-ipa.webp b/dist/kegs/goose-island-ipa.webp new file mode 100644 index 0000000..93f20c4 Binary files /dev/null and b/dist/kegs/goose-island-ipa.webp differ diff --git a/dist/kegs/goose-midway.png b/dist/kegs/goose-midway.png deleted file mode 100644 index 96b156e..0000000 Binary files a/dist/kegs/goose-midway.png and /dev/null differ diff --git a/dist/kegs/goose-midway.webp b/dist/kegs/goose-midway.webp new file mode 100644 index 0000000..252c2cb Binary files /dev/null and b/dist/kegs/goose-midway.webp differ diff --git a/dist/kegs/haake-beck.webp b/dist/kegs/haake-beck.webp new file mode 100644 index 0000000..7ccfb92 Binary files /dev/null and b/dist/kegs/haake-beck.webp differ diff --git a/dist/kegs/hasseroder.png b/dist/kegs/hasseroder.png deleted file mode 100644 index 6c10214..0000000 Binary files a/dist/kegs/hasseroder.png and /dev/null differ diff --git a/dist/kegs/hasseroder.webp b/dist/kegs/hasseroder.webp new file mode 100644 index 0000000..5285c06 Binary files /dev/null and b/dist/kegs/hasseroder.webp differ diff --git a/dist/kegs/hertog-jan-grand.webp b/dist/kegs/hertog-jan-grand.webp new file mode 100644 index 0000000..56e1b24 Binary files /dev/null and b/dist/kegs/hertog-jan-grand.webp differ diff --git a/dist/kegs/hertog-jan.png b/dist/kegs/hertog-jan.png deleted file mode 100644 index e95f18c..0000000 Binary files a/dist/kegs/hertog-jan.png and /dev/null differ diff --git a/dist/kegs/hertog-jan.webp b/dist/kegs/hertog-jan.webp new file mode 100644 index 0000000..f038998 Binary files /dev/null and b/dist/kegs/hertog-jan.webp differ diff --git a/dist/kegs/hoegaarden-rosee.png b/dist/kegs/hoegaarden-rosee.png deleted file mode 100644 index f3bf440..0000000 Binary files a/dist/kegs/hoegaarden-rosee.png and /dev/null differ diff --git a/dist/kegs/hoegaarden-rosee.webp b/dist/kegs/hoegaarden-rosee.webp new file mode 100644 index 0000000..dd97d44 Binary files /dev/null and b/dist/kegs/hoegaarden-rosee.webp differ diff --git a/dist/kegs/hoegaarden.png b/dist/kegs/hoegaarden.png deleted file mode 100644 index b936351..0000000 Binary files a/dist/kegs/hoegaarden.png and /dev/null differ diff --git a/dist/kegs/hoegaarden.webp b/dist/kegs/hoegaarden.webp new file mode 100644 index 0000000..8a4f925 Binary files /dev/null and b/dist/kegs/hoegaarden.webp differ diff --git a/dist/kegs/jupiler.png b/dist/kegs/jupiler.png deleted file mode 100644 index f9ef494..0000000 Binary files a/dist/kegs/jupiler.png and /dev/null differ diff --git a/dist/kegs/jupiler.webp b/dist/kegs/jupiler.webp new file mode 100644 index 0000000..95818c0 Binary files /dev/null and b/dist/kegs/jupiler.webp differ diff --git a/dist/kegs/kwak-blonde.png b/dist/kegs/kwak-blonde.png deleted file mode 100644 index ce69ab8..0000000 Binary files a/dist/kegs/kwak-blonde.png and /dev/null differ diff --git a/dist/kegs/kwak-blonde.webp b/dist/kegs/kwak-blonde.webp new file mode 100644 index 0000000..5d9b15c Binary files /dev/null and b/dist/kegs/kwak-blonde.webp differ diff --git a/dist/kegs/kwak.png b/dist/kegs/kwak.png deleted file mode 100644 index 9753803..0000000 Binary files a/dist/kegs/kwak.png and /dev/null differ diff --git a/dist/kegs/kwak.webp b/dist/kegs/kwak.webp new file mode 100644 index 0000000..85f6a44 Binary files /dev/null and b/dist/kegs/kwak.webp differ diff --git a/dist/kegs/la-virgen.webp b/dist/kegs/la-virgen.webp new file mode 100644 index 0000000..751c42d Binary files /dev/null and b/dist/kegs/la-virgen.webp differ diff --git a/dist/kegs/leffe-0.png b/dist/kegs/leffe-0.png deleted file mode 100644 index 21850a1..0000000 Binary files a/dist/kegs/leffe-0.png and /dev/null differ diff --git a/dist/kegs/leffe-0.webp b/dist/kegs/leffe-0.webp new file mode 100644 index 0000000..b4bbb8a Binary files /dev/null and b/dist/kegs/leffe-0.webp differ diff --git a/dist/kegs/leffe-amber.webp b/dist/kegs/leffe-amber.webp new file mode 100644 index 0000000..ee8a448 Binary files /dev/null and b/dist/kegs/leffe-amber.webp differ diff --git a/dist/kegs/leffe-blanche.png b/dist/kegs/leffe-blanche.png deleted file mode 100644 index 6dc2cb6..0000000 Binary files a/dist/kegs/leffe-blanche.png and /dev/null differ diff --git a/dist/kegs/leffe-blanche.webp b/dist/kegs/leffe-blanche.webp new file mode 100644 index 0000000..eca4598 Binary files /dev/null and b/dist/kegs/leffe-blanche.webp differ diff --git a/dist/kegs/leffe-blonde.png b/dist/kegs/leffe-blonde.png deleted file mode 100644 index 0db5382..0000000 Binary files a/dist/kegs/leffe-blonde.png and /dev/null differ diff --git a/dist/kegs/leffe-blonde.webp b/dist/kegs/leffe-blonde.webp new file mode 100644 index 0000000..cfb17d4 Binary files /dev/null and b/dist/kegs/leffe-blonde.webp differ diff --git a/dist/kegs/leffe-brune.png b/dist/kegs/leffe-brune.png deleted file mode 100644 index 144dda7..0000000 Binary files a/dist/kegs/leffe-brune.png and /dev/null differ diff --git a/dist/kegs/leffe-brune.webp b/dist/kegs/leffe-brune.webp new file mode 100644 index 0000000..b389202 Binary files /dev/null and b/dist/kegs/leffe-brune.webp differ diff --git a/dist/kegs/leffe-dete.png b/dist/kegs/leffe-dete.png deleted file mode 100644 index 9f9a559..0000000 Binary files a/dist/kegs/leffe-dete.png and /dev/null differ diff --git a/dist/kegs/leffe-dete.webp b/dist/kegs/leffe-dete.webp new file mode 100644 index 0000000..026b977 Binary files /dev/null and b/dist/kegs/leffe-dete.webp differ diff --git a/dist/kegs/leffe-prestige.png b/dist/kegs/leffe-prestige.png deleted file mode 100644 index 1fc0d09..0000000 Binary files a/dist/kegs/leffe-prestige.png and /dev/null differ diff --git a/dist/kegs/leffe-prestige.webp b/dist/kegs/leffe-prestige.webp new file mode 100644 index 0000000..93dd0dc Binary files /dev/null and b/dist/kegs/leffe-prestige.webp differ diff --git a/dist/kegs/leffe-rituel.png b/dist/kegs/leffe-rituel.png deleted file mode 100644 index 946b3ad..0000000 Binary files a/dist/kegs/leffe-rituel.png and /dev/null differ diff --git a/dist/kegs/leffe-rituel.webp b/dist/kegs/leffe-rituel.webp new file mode 100644 index 0000000..a5d2e07 Binary files /dev/null and b/dist/kegs/leffe-rituel.webp differ diff --git a/dist/kegs/leffe-ruby.png b/dist/kegs/leffe-ruby.png deleted file mode 100644 index b37f1af..0000000 Binary files a/dist/kegs/leffe-ruby.png and /dev/null differ diff --git a/dist/kegs/leffe-ruby.webp b/dist/kegs/leffe-ruby.webp new file mode 100644 index 0000000..4050a06 Binary files /dev/null and b/dist/kegs/leffe-ruby.webp differ diff --git a/dist/kegs/lowenbrau.png b/dist/kegs/lowenbrau.png deleted file mode 100644 index 0b271dc..0000000 Binary files a/dist/kegs/lowenbrau.png and /dev/null differ diff --git a/dist/kegs/lowenbrau.webp b/dist/kegs/lowenbrau.webp new file mode 100644 index 0000000..d2c827a Binary files /dev/null and b/dist/kegs/lowenbrau.webp differ diff --git a/dist/kegs/meteor.png b/dist/kegs/meteor.png deleted file mode 100644 index 85704c4..0000000 Binary files a/dist/kegs/meteor.png and /dev/null differ diff --git a/dist/kegs/meteor.webp b/dist/kegs/meteor.webp new file mode 100644 index 0000000..16cc49c Binary files /dev/null and b/dist/kegs/meteor.webp differ diff --git a/dist/kegs/ninkasi.png b/dist/kegs/ninkasi.png deleted file mode 100644 index de30d4a..0000000 Binary files a/dist/kegs/ninkasi.png and /dev/null differ diff --git a/dist/kegs/ninkasi.webp b/dist/kegs/ninkasi.webp new file mode 100644 index 0000000..a6327b3 Binary files /dev/null and b/dist/kegs/ninkasi.webp differ diff --git a/dist/kegs/northern-monk.png b/dist/kegs/northern-monk.png deleted file mode 100644 index 1d8f80a..0000000 Binary files a/dist/kegs/northern-monk.png and /dev/null differ diff --git a/dist/kegs/northern-monk.webp b/dist/kegs/northern-monk.webp new file mode 100644 index 0000000..98d0a5c Binary files /dev/null and b/dist/kegs/northern-monk.webp differ diff --git a/dist/kegs/old-peculier.webp b/dist/kegs/old-peculier.webp new file mode 100644 index 0000000..6cd7c10 Binary files /dev/null and b/dist/kegs/old-peculier.webp differ diff --git a/dist/kegs/old-speckled-hen.png b/dist/kegs/old-speckled-hen.png deleted file mode 100644 index 8ae05bc..0000000 Binary files a/dist/kegs/old-speckled-hen.png and /dev/null differ diff --git a/dist/kegs/old-speckled-hen.webp b/dist/kegs/old-speckled-hen.webp new file mode 100644 index 0000000..718129b Binary files /dev/null and b/dist/kegs/old-speckled-hen.webp differ diff --git a/dist/kegs/peroni.webp b/dist/kegs/peroni.webp new file mode 100644 index 0000000..74eff99 Binary files /dev/null and b/dist/kegs/peroni.webp differ diff --git a/dist/kegs/rousse-mont-blanc.png b/dist/kegs/rousse-mont-blanc.png deleted file mode 100644 index 700644b..0000000 Binary files a/dist/kegs/rousse-mont-blanc.png and /dev/null differ diff --git a/dist/kegs/rousse-mont-blanc.webp b/dist/kegs/rousse-mont-blanc.webp new file mode 100644 index 0000000..a378af0 Binary files /dev/null and b/dist/kegs/rousse-mont-blanc.webp differ diff --git a/dist/kegs/saint-feuillien.png b/dist/kegs/saint-feuillien.png deleted file mode 100644 index 0db5a42..0000000 Binary files a/dist/kegs/saint-feuillien.png and /dev/null differ diff --git a/dist/kegs/saint-feuillien.webp b/dist/kegs/saint-feuillien.webp new file mode 100644 index 0000000..7af6876 Binary files /dev/null and b/dist/kegs/saint-feuillien.webp differ diff --git a/dist/kegs/samson.png b/dist/kegs/samson.png deleted file mode 100644 index 7d4292a..0000000 Binary files a/dist/kegs/samson.png and /dev/null differ diff --git a/dist/kegs/samson.webp b/dist/kegs/samson.webp new file mode 100644 index 0000000..a1a25e0 Binary files /dev/null and b/dist/kegs/samson.webp differ diff --git a/dist/kegs/san-miguel.png b/dist/kegs/san-miguel.png deleted file mode 100644 index ce6b29e..0000000 Binary files a/dist/kegs/san-miguel.png and /dev/null differ diff --git a/dist/kegs/san-miguel.webp b/dist/kegs/san-miguel.webp new file mode 100644 index 0000000..dc5bdf5 Binary files /dev/null and b/dist/kegs/san-miguel.webp differ diff --git a/dist/kegs/schneider.png b/dist/kegs/schneider.png deleted file mode 100644 index 6c6ca91..0000000 Binary files a/dist/kegs/schneider.png and /dev/null differ diff --git a/dist/kegs/schneider.webp b/dist/kegs/schneider.webp new file mode 100644 index 0000000..feac851 Binary files /dev/null and b/dist/kegs/schneider.webp differ diff --git a/dist/kegs/spaten.png b/dist/kegs/spaten.png deleted file mode 100644 index 82c66df..0000000 Binary files a/dist/kegs/spaten.png and /dev/null differ diff --git a/dist/kegs/spaten.webp b/dist/kegs/spaten.webp new file mode 100644 index 0000000..c17d21d Binary files /dev/null and b/dist/kegs/spaten.webp differ diff --git a/dist/kegs/st-austell.png b/dist/kegs/st-austell.png deleted file mode 100644 index d08852d..0000000 Binary files a/dist/kegs/st-austell.png and /dev/null differ diff --git a/dist/kegs/st-austell.webp b/dist/kegs/st-austell.webp new file mode 100644 index 0000000..a9f14fe Binary files /dev/null and b/dist/kegs/st-austell.webp differ diff --git a/dist/kegs/stella-artois-0.png b/dist/kegs/stella-artois-0.png deleted file mode 100644 index a935732..0000000 Binary files a/dist/kegs/stella-artois-0.png and /dev/null differ diff --git a/dist/kegs/stella-artois-0.webp b/dist/kegs/stella-artois-0.webp new file mode 100644 index 0000000..3c6d83b Binary files /dev/null and b/dist/kegs/stella-artois-0.webp differ diff --git a/dist/kegs/stella-artois-unfiltered.webp b/dist/kegs/stella-artois-unfiltered.webp new file mode 100644 index 0000000..e29fe44 Binary files /dev/null and b/dist/kegs/stella-artois-unfiltered.webp differ diff --git a/dist/kegs/stella-artois.png b/dist/kegs/stella-artois.png deleted file mode 100644 index 42692b6..0000000 Binary files a/dist/kegs/stella-artois.png and /dev/null differ diff --git a/dist/kegs/stella-artois.webp b/dist/kegs/stella-artois.webp new file mode 100644 index 0000000..502b26b Binary files /dev/null and b/dist/kegs/stella-artois.webp differ diff --git a/dist/kegs/tennents.webp b/dist/kegs/tennents.webp new file mode 100644 index 0000000..5396592 Binary files /dev/null and b/dist/kegs/tennents.webp differ diff --git a/dist/kegs/thornbridge-jaipur.webp b/dist/kegs/thornbridge-jaipur.webp new file mode 100644 index 0000000..5bca37d Binary files /dev/null and b/dist/kegs/thornbridge-jaipur.webp differ diff --git a/dist/kegs/tiny-rebel-clwb.webp b/dist/kegs/tiny-rebel-clwb.webp new file mode 100644 index 0000000..2546f6b Binary files /dev/null and b/dist/kegs/tiny-rebel-clwb.webp differ diff --git a/dist/kegs/tripel-karmeliet.png b/dist/kegs/tripel-karmeliet.png deleted file mode 100644 index 4d20411..0000000 Binary files a/dist/kegs/tripel-karmeliet.png and /dev/null differ diff --git a/dist/kegs/tripel-karmeliet.webp b/dist/kegs/tripel-karmeliet.webp new file mode 100644 index 0000000..8210562 Binary files /dev/null and b/dist/kegs/tripel-karmeliet.webp differ diff --git a/dist/kegs/trooper.png b/dist/kegs/trooper.png deleted file mode 100644 index a17dbe4..0000000 Binary files a/dist/kegs/trooper.png and /dev/null differ diff --git a/dist/kegs/trooper.webp b/dist/kegs/trooper.webp new file mode 100644 index 0000000..8835dfb Binary files /dev/null and b/dist/kegs/trooper.webp differ diff --git a/dist/kegs/victoria.png b/dist/kegs/victoria.png deleted file mode 100644 index 8b78c34..0000000 Binary files a/dist/kegs/victoria.png and /dev/null differ diff --git a/dist/kegs/victoria.webp b/dist/kegs/victoria.webp new file mode 100644 index 0000000..49690da Binary files /dev/null and b/dist/kegs/victoria.webp differ diff --git a/dist/kegs/vocation-hop-skip.png b/dist/kegs/vocation-hop-skip.png deleted file mode 100644 index a0aeb43..0000000 Binary files a/dist/kegs/vocation-hop-skip.png and /dev/null differ diff --git a/dist/kegs/vocation-hop-skip.webp b/dist/kegs/vocation-hop-skip.webp new file mode 100644 index 0000000..466577b Binary files /dev/null and b/dist/kegs/vocation-hop-skip.webp differ diff --git a/dist/kegs/vocation-life-death.png b/dist/kegs/vocation-life-death.png deleted file mode 100644 index a177293..0000000 Binary files a/dist/kegs/vocation-life-death.png and /dev/null differ diff --git a/dist/kegs/vocation-life-death.webp b/dist/kegs/vocation-life-death.webp new file mode 100644 index 0000000..7859041 Binary files /dev/null and b/dist/kegs/vocation-life-death.webp differ diff --git a/dist/perfectdraft-card.js b/dist/perfectdraft-card.js index 63cf624..3db956b 100644 --- a/dist/perfectdraft-card.js +++ b/dist/perfectdraft-card.js @@ -1,7 +1,7 @@ -function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}"function"==typeof SuppressedError&&SuppressedError;const t=globalThis,r=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),i=new WeakMap;let a=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(r&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(t,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const r=1===e.length?e[0]:t.reduce((t,r,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[s+1],e[0]);return new a(r,e,s)},n=r?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new a("string"==typeof e?e:e+"",void 0,s))(t)})(e):e,{is:l,defineProperty:c,getOwnPropertyDescriptor:d,getOwnPropertyNames:h,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,g=globalThis,y=g.trustedTypes,m=y?y.emptyScript:"",b=g.reactiveElementPolyfillSupport,f=(e,t)=>e,F={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},v=(e,t)=>!l(e,t),_={attribute:!0,type:String,converter:F,reflect:!1,useDefault:!1,hasChanged:v};Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let A=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(e,r,t);void 0!==s&&c(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){const{get:s,set:i}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const a=s?.call(this);i?.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const e=this.properties,t=[...h(e),...p(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(n(e))}else void 0!==e&&t.push(n(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,s)=>{if(r)e.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const r of s){const s=document.createElement("style"),i=t.litNonce;void 0!==i&&s.setAttribute("nonce",i),s.textContent=r.cssText,e.appendChild(s)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,r);if(void 0!==s&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:F).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(s):this.setAttribute(s,i),this._$Em=null}}_$AK(e,t){const r=this.constructor,s=r._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=r.getPropertyOptions(s),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:F;this._$Em=s;const a=i.fromAttribute(t,e.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(e,t,r,s=!1,i){if(void 0!==e){const a=this.constructor;if(!1===s&&(i=this[e]),r??=a.getPropertyOptions(e),!((r.hasChanged??v)(i,t)||r.useDefault&&r.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:s,wrapped:i},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,r]of e){const{wrapped:e}=r,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,r,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[f("elementProperties")]=new Map,A[f("finalized")]=new Map,b?.({ReactiveElement:A}),(g.reactiveElementVersions??=[]).push("2.1.2");const $=globalThis,w=e=>e,x=$.trustedTypes,E=x?x.createPolicy("lit-html",{createHTML:e=>e}):void 0,P="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,S="?"+C,B=`<${S}>`,k=document,D=()=>k.createComment(""),L=e=>null===e||"object"!=typeof e&&"function"!=typeof e,z=Array.isArray,I="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,O=/>/g,T=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,R=/"/g,N=/^(?:script|style|textarea|title)$/i,U=(e=>(t,...r)=>({_$litType$:e,strings:t,values:r}))(1),G=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),K=new WeakMap,V=k.createTreeWalker(k,129);function q(e,t){if(!z(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const J=(e,t)=>{const r=e.length-1,s=[];let i,a=2===t?"":3===t?"":"",o=H;for(let t=0;t"===l[0]?(o=i??H,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,n=l[1],o=void 0===l[3]?T:'"'===l[3]?R:j):o===R||o===j?o=T:o===M||o===O?o=H:(o=T,i=void 0);const h=o===T&&e[t+1].startsWith("/>")?" ":"";a+=o===H?r+B:c>=0?(s.push(n),r.slice(0,c)+P+r.slice(c)+C+h):r+C+(-2===c?t:h)}return[q(e,a+(e[r]||"")+(2===t?"":3===t?"":"")),s]};class Q{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let i=0,a=0;const o=e.length-1,n=this.parts,[l,c]=J(e,t);if(this.el=Q.createElement(l,r),V.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=V.nextNode())&&n.length0){s.textContent=x?x.emptyScript:"";for(let r=0;rz(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==W&&L(this._$AH)?this._$AA.nextSibling.data=e:this.T(k.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,s="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Q.createElement(q(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new Z(s,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=K.get(e.strings);return void 0===t&&K.set(e.strings,t=new Q(e)),t}k(e){z(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,s=0;for(const i of e)s===t.length?t.push(r=new X(this.O(D()),this.O(D()),this,this.options)):r=t[s],r._$AI(i),s++;s2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=W}_$AI(e,t=this,r,s){const i=this.strings;let a=!1;if(void 0===i)e=Y(this,e,t,0),a=!L(e)||e!==this._$AH&&e!==G,a&&(this._$AH=e);else{const s=e;let o,n;for(e=i[0],o=0;o{const s=r?.renderBefore??t;let i=s._$litPart$;if(void 0===i){const e=r?.renderBefore??null;s._$litPart$=i=new X(t.insertBefore(D(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return G}}ne._$litElement$=!0,ne.finalized=!0,oe.litElementHydrateSupport?.({LitElement:ne});const le=oe.litElementPolyfillSupport;le?.({LitElement:ne}),(oe.litElementVersions??=[]).push("4.2.2");const ce=e=>(t,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},de={attribute:!0,type:String,converter:F,reflect:!1,hasChanged:v},he=(e=de,t,r)=>{const{kind:s,metadata:i}=r;let a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),a.set(r.name,e),"accessor"===s){const{name:s}=r;return{set(r){const i=t.get.call(this);t.set.call(this,r),this.requestUpdate(s,i,e,!0,r)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=r;return function(r){const i=this[s];t.call(this,r),this.requestUpdate(s,i,e,!0,r)}}throw Error("Unsupported decorator location: "+s)};function pe(e){return(t,r)=>"object"==typeof r?he(e,t,r):((e,t,r)=>{const s=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),s?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function ue(e){return pe({...e,state:!0,attribute:!1})}const ge="perfectdraft",ye=[{value:250,label:"250 mL",description:"Small glass"},{value:330,label:"330 mL",description:"Bottle / standard"},{value:500,label:"500 mL",description:"Half litre"},{value:568,label:"568 mL",description:"Pint (UK)"},{value:473,label:"473 mL",description:"Pint (US)"}],me=330,be=14,fe=7,Fe=3,ve=0;function _e(e){return`kegs/${e}.png`}const Ae=[{slug:"leffe-blonde",name:"Leffe Blonde",brewery:"Abbaye de Leffe",style:"Belgian Blonde",abv:6.6,colors:{primary:"#C8922A",secondary:"#FFF6E0",text:"#1A0F00"},imagePath:_e("leffe-blonde")},{slug:"leffe-brune",name:"Leffe Brune",brewery:"Abbaye de Leffe",style:"Belgian Dubbel",abv:6.5,colors:{primary:"#4A2810",secondary:"#F5E6D0",text:"#FFFFFF"},imagePath:_e("leffe-brune")},{slug:"leffe-amber",name:"Leffe Ambrée",brewery:"Abbaye de Leffe",style:"Belgian Amber",abv:6.6,colors:{primary:"#B5651D",secondary:"#FFF0D6",text:"#1A0F00"}},{slug:"leffe-ruby",name:"Leffe Ruby",brewery:"Abbaye de Leffe",style:"Belgian Fruit Beer",abv:5,colors:{primary:"#8B1A4A",secondary:"#FFE6F0",text:"#FFFFFF"},imagePath:_e("leffe-ruby")},{slug:"leffe-blanche",name:"Leffe Blanche",brewery:"Abbaye de Leffe",style:"Belgian Witbier",abv:5,colors:{primary:"#E8DCC8",secondary:"#FFFDF5",text:"#2C2C2C"},imagePath:_e("leffe-blanche")},{slug:"leffe-winter",name:"Leffe Winter",brewery:"Abbaye de Leffe",style:"Belgian Winter Ale",abv:6.6,colors:{primary:"#1B3A5C",secondary:"#E0ECF8",text:"#FFFFFF"}},{slug:"leffe-noel",name:"Leffe Noël",brewery:"Abbaye de Leffe",style:"Belgian Winter Ale",abv:6.6,colors:{primary:"#1B3A5C",secondary:"#E0ECF8",text:"#FFFFFF"}},{slug:"leffe-dete",name:"Leffe d'Été",brewery:"Abbaye de Leffe",style:"Belgian Summer Ale",abv:5.2,colors:{primary:"#F5C242",secondary:"#FFFBE6",text:"#1A0F00"},imagePath:_e("leffe-dete")},{slug:"leffe-rituel",name:"Leffe Rituel 9°",brewery:"Abbaye de Leffe",style:"Belgian Strong Ale",abv:9,colors:{primary:"#2C1A00",secondary:"#F5E6D0",text:"#C8922A"},imagePath:_e("leffe-rituel")},{slug:"leffe-prestige",name:"Leffe Prestige 1240",brewery:"Abbaye de Leffe",style:"Belgian Strong Blonde",abv:8.5,colors:{primary:"#1A3366",secondary:"#E0E8F5",text:"#C8922A"},imagePath:_e("leffe-prestige")},{slug:"leffe-0",name:"Leffe Blonde 0.0%",brewery:"Abbaye de Leffe",style:"Non-Alcoholic Blonde",abv:0,colors:{primary:"#C8922A",secondary:"#FFF6E0",text:"#1A0F00"},imagePath:_e("leffe-0")},{slug:"hoegaarden",name:"Hoegaarden",brewery:"Brouwerij van Hoegaarden",style:"Belgian Witbier",abv:4.9,colors:{primary:"#F0E4C8",secondary:"#FFFDF2",text:"#2A4B1E"},imagePath:_e("hoegaarden")},{slug:"hoegaarden-rosee",name:"Hoegaarden Rosée",brewery:"Brouwerij van Hoegaarden",style:"Fruit Witbier",abv:3,colors:{primary:"#E87D9F",secondary:"#FFF0F5",text:"#4A0028"},imagePath:_e("hoegaarden-rosee")},{slug:"jupiler",name:"Jupiler",brewery:"AB InBev Belgium",style:"Belgian Pilsner",abv:5.2,colors:{primary:"#D4001A",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:_e("jupiler")},{slug:"kwak",name:"Pauwel Kwak",brewery:"Brouwerij Bosteels",style:"Belgian Strong Ale",abv:8.4,colors:{primary:"#B34700",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:_e("kwak")},{slug:"kwak-blonde",name:"Kwak Blonde",brewery:"Brouwerij Bosteels",style:"Belgian Blonde",abv:7.4,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#2C1A00"},imagePath:_e("kwak-blonde")},{slug:"tripel-karmeliet",name:"Tripel Karmeliet",brewery:"Brouwerij Bosteels",style:"Belgian Tripel",abv:8.4,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#2C1A00"},imagePath:_e("tripel-karmeliet")},{slug:"gulden-draak",name:"Gulden Draak",brewery:"Brouwerij Van Steenberge",style:"Belgian Strong Dark",abv:10.5,colors:{primary:"#1A1A2E",secondary:"#E8E0F0",text:"#C9A24D"}},{slug:"saint-feuillien",name:"Saint-Feuillien Blonde",brewery:"Brasserie St-Feuillien",style:"Belgian Blonde",abv:7.5,colors:{primary:"#C8922A",secondary:"#FFF6E0",text:"#1A0F00"},imagePath:_e("saint-feuillien")},{slug:"dupont",name:"Saison Dupont Dry Hop",brewery:"Brasserie Dupont",style:"Belgian Saison",abv:6.5,colors:{primary:"#8B6914",secondary:"#FFF8E0",text:"#1A0F00"},imagePath:_e("dupont")},{slug:"stella-artois",name:"Stella Artois",brewery:"Brouwerij Artois",style:"Belgian Lager",abv:5.2,colors:{primary:"#0E4C1E",secondary:"#F0F8E8",text:"#FFFFFF"},imagePath:_e("stella-artois")},{slug:"stella-artois-unfiltered",name:"Stella Artois Unfiltered",brewery:"Brouwerij Artois",style:"Unfiltered Lager",abv:5,colors:{primary:"#D4A547",secondary:"#FFFCE8",text:"#0E4C1E"}},{slug:"stella-artois-0",name:"Stella Artois 0.0%",brewery:"Brouwerij Artois",style:"Non-Alcoholic Lager",abv:0,colors:{primary:"#0E4C1E",secondary:"#F0F8E8",text:"#FFFFFF"},imagePath:_e("stella-artois-0")},{slug:"budweiser",name:"Budweiser",brewery:"Anheuser-Busch",style:"American Lager",abv:5,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"}},{slug:"bud",name:"Anheuser-Busch Bud",brewery:"Anheuser-Busch",style:"American Lager",abv:5,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:_e("bud")},{slug:"bud-light",name:"Bud Light",brewery:"Anheuser-Busch",style:"Light Lager",abv:3.5,colors:{primary:"#004B8D",secondary:"#E8F4FF",text:"#FFFFFF"}},{slug:"corona",name:"Corona Extra",brewery:"Grupo Modelo",style:"Mexican Lager",abv:4.5,colors:{primary:"#FDB913",secondary:"#FFFCE5",text:"#00205B"},imagePath:_e("corona")},{slug:"corona-cero",name:"Corona Cero",brewery:"Grupo Modelo",style:"Non-Alcoholic Lager",abv:0,colors:{primary:"#0073B1",secondary:"#E5F3FF",text:"#FFFFFF"},imagePath:_e("corona-cero")},{slug:"becks",name:"Beck's",brewery:"Brauerei Beck & Co",style:"German Pilsner",abv:4.8,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"},imagePath:_e("becks")},{slug:"becks-gold",name:"Beck's Gold",brewery:"Brauerei Beck & Co",style:"German Lager",abv:4.9,colors:{primary:"#D4A547",secondary:"#FFF8E0",text:"#006838"},imagePath:_e("becks-gold")},{slug:"peroni",name:"Peroni Nastro Azzurro",brewery:"Birra Peroni",style:"Italian Lager",abv:5.1,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"}},{slug:"hertog-jan",name:"Hertog Jan",brewery:"AB InBev Netherlands",style:"Dutch Pilsner",abv:5.1,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#D4A547"},imagePath:_e("hertog-jan")},{slug:"hertog-jan-grand",name:"Hertog Jan Grand Pilsener",brewery:"AB InBev Netherlands",style:"Dutch Pilsner",abv:5.1,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#D4A547"}},{slug:"tennents",name:"Tennent's Lager",brewery:"Wellpark Brewery",style:"Scottish Lager",abv:5,colors:{primary:"#D4001A",secondary:"#FFF0F0",text:"#FFFFFF"}},{slug:"la-virgen",name:"La Virgen Lager",brewery:"Cervezas La Virgen",style:"Spanish Lager",abv:5,colors:{primary:"#1E6B3A",secondary:"#E8F5E0",text:"#FFFFFF"}},{slug:"san-miguel",name:"San Miguel",brewery:"San Miguel",style:"Spanish Lager",abv:5.4,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:_e("san-miguel")},{slug:"victoria",name:"Victoria",brewery:"Victoria",style:"Spanish Lager",abv:4.8,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#D4A547"},imagePath:_e("victoria")},{slug:"samson",name:"Samson 11",brewery:"Samson",style:"Czech Lager",abv:4.7,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"},imagePath:_e("samson")},{slug:"franziskaner",name:"Franziskaner Weissbier",brewery:"Spaten-Franziskaner-Bräu",style:"Hefeweizen",abv:5,colors:{primary:"#2E5090",secondary:"#E8F0FF",text:"#F5C242"},imagePath:_e("franziskaner")},{slug:"franziskaner-royal",name:"Franziskaner Royal",brewery:"Spaten-Franziskaner-Bräu",style:"Weissbier",abv:6,colors:{primary:"#1A1A5C",secondary:"#E0E0F8",text:"#F5C242"},imagePath:_e("franziskaner-royal")},{slug:"franziskaner-kellerbier",name:"Franziskaner Kellerbier",brewery:"Spaten-Franziskaner-Bräu",style:"Kellerbier",abv:5.2,colors:{primary:"#6B4423",secondary:"#F5E6D0",text:"#F5C242"},imagePath:_e("franziskaner-kellerbier")},{slug:"spaten",name:"Spaten",brewery:"Spaten-Franziskaner-Bräu",style:"Munich Helles",abv:5.2,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#FFFFFF"},imagePath:_e("spaten")},{slug:"lowenbrau",name:"Löwenbräu",brewery:"Löwenbräu",style:"Munich Helles",abv:5.2,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"},imagePath:_e("lowenbrau")},{slug:"hasseroder",name:"Hasseröder Premium",brewery:"Hasseröder Brauerei",style:"German Pilsner",abv:4.9,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"},imagePath:_e("hasseroder")},{slug:"diebels",name:"Diebels Alt",brewery:"Brauerei Diebels",style:"Altbier",abv:4.9,colors:{primary:"#4A2810",secondary:"#F5E6D0",text:"#FFFFFF"}},{slug:"schneider",name:"Schneider Bayrisch Hell",brewery:"G. Schneider & Sohn",style:"Bavarian Helles",abv:5.2,colors:{primary:"#006838",secondary:"#E8F5E0",text:"#FFFFFF"},imagePath:_e("schneider")},{slug:"haake-beck",name:"Haake-Beck",brewery:"Brauerei Beck & Co",style:"German Pilsner",abv:4.9,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"}},{slug:"fruh-kolsch",name:"Früh Kölsch",brewery:"Cölner Hofbräu Früh",style:"Kölsch",abv:4.8,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:_e("fruh-kolsch")},{slug:"goose-island-ipa",name:"Goose Island IPA",brewery:"Goose Island",style:"India Pale Ale",abv:5.9,colors:{primary:"#D45500",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:_e("goose-island-ipa")},{slug:"goose-island-hazy",name:"Goose Island Hazy Beer Hug",brewery:"Goose Island",style:"Hazy IPA",abv:6.4,colors:{primary:"#F5A623",secondary:"#FFFAE5",text:"#2C1A00"}},{slug:"goose-midway",name:"Goose Midway Session IPA",brewery:"Goose Island",style:"Session IPA",abv:4.1,colors:{primary:"#D45500",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:_e("goose-midway")},{slug:"brewdog-punk-ipa",name:"BrewDog Punk IPA",brewery:"BrewDog",style:"India Pale Ale",abv:5.4,colors:{primary:"#00A3E0",secondary:"#E5F5FF",text:"#FFFFFF"}},{slug:"brewdog-elvis-juice",name:"BrewDog Elvis Juice",brewery:"BrewDog",style:"Grapefruit IPA",abv:6.5,colors:{primary:"#FF6B1A",secondary:"#FFF3E5",text:"#1A1A1A"}},{slug:"camden-hells",name:"Camden Hells",brewery:"Camden Town Brewery",style:"Helles Lager",abv:4.6,colors:{primary:"#000000",secondary:"#F5F0E0",text:"#F5C242"},imagePath:_e("camden-hells")},{slug:"camden-pale",name:"Camden Pale Ale",brewery:"Camden Town Brewery",style:"Pale Ale",abv:4,colors:{primary:"#E87D00",secondary:"#FFF5E5",text:"#000000"},imagePath:_e("camden-pale")},{slug:"camden-ipa",name:"Camden IPA",brewery:"Camden Town Brewery",style:"India Pale Ale",abv:5.8,colors:{primary:"#2E8B57",secondary:"#E5F5EC",text:"#FFFFFF"},imagePath:_e("camden-ipa")},{slug:"camden-eazy",name:"Camden Eazy",brewery:"Camden Town Brewery",style:"Session Pale",abv:4,colors:{primary:"#F5C242",secondary:"#FFFCE5",text:"#000000"},imagePath:_e("camden-eazy")},{slug:"tiny-rebel-clwb",name:"Tiny Rebel Clwb Tropicana",brewery:"Tiny Rebel",style:"Tropical IPA",abv:5.5,colors:{primary:"#FF3399",secondary:"#FFE5F2",text:"#1A1A1A"}},{slug:"vocation-life-death",name:"Vocation Life & Death",brewery:"Vocation Brewery",style:"India Pale Ale",abv:6.5,colors:{primary:"#1A1A1A",secondary:"#F0F0F0",text:"#D4001A"},imagePath:_e("vocation-life-death")},{slug:"vocation-hop-skip",name:"Vocation Hop, Skip & Juice",brewery:"Vocation Brewery",style:"Pale Ale",abv:5.7,colors:{primary:"#F5A623",secondary:"#FFFAE5",text:"#1A1A1A"},imagePath:_e("vocation-hop-skip")},{slug:"thornbridge-jaipur",name:"Thornbridge Jaipur",brewery:"Thornbridge Brewery",style:"India Pale Ale",abv:5.9,colors:{primary:"#8B4513",secondary:"#FFF5EB",text:"#FFFFFF"}},{slug:"ninkasi",name:"Ninkasi IPA",brewery:"Ninkasi Brasserie",style:"India Pale Ale",abv:5.4,colors:{primary:"#D45500",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:_e("ninkasi")},{slug:"fullers-london-pride",name:"Fuller's London Pride",brewery:"Fuller's",style:"English Bitter",abv:4.7,colors:{primary:"#7B241C",secondary:"#F5E6E0",text:"#FFFFFF"}},{slug:"hawkstone",name:"Hawkstone Lager",brewery:"Hawkstone Brewing",style:"English Lager",abv:4.8,colors:{primary:"#3D6B35",secondary:"#E8F0E0",text:"#F5E6C8"}},{slug:"old-peculier",name:"Theakston Old Peculier",brewery:"Theakston Brewery",style:"Old Ale",abv:5.6,colors:{primary:"#2C0A1E",secondary:"#F0E0E8",text:"#C8922A"}},{slug:"adnams",name:"Adnams Ghost Ship",brewery:"Adnams",style:"Pale Ale",abv:4.5,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"}},{slug:"old-speckled-hen",name:"Old Speckled Hen",brewery:"Greene King",style:"English Bitter",abv:5,colors:{primary:"#8B4513",secondary:"#FFF5EB",text:"#FFFFFF"},imagePath:_e("old-speckled-hen")},{slug:"northern-monk",name:"Northern Monk A Little Faith",brewery:"Northern Monk",style:"Session Pale",abv:4,colors:{primary:"#1A1A1A",secondary:"#F0F0F0",text:"#F5C242"},imagePath:_e("northern-monk")},{slug:"st-austell",name:"St Austell Proper Job IPA",brewery:"St Austell",style:"India Pale Ale",abv:5.5,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:_e("st-austell")},{slug:"trooper",name:"Trooper Original",brewery:"Robinsons",style:"English Bitter",abv:4.7,colors:{primary:"#1A1A1A",secondary:"#F0F0F0",text:"#C8102E"},imagePath:_e("trooper")},{slug:"castelain",name:"Castelain Grand Cru",brewery:"Brasserie Castelain",style:"Bière de Garde",abv:6.2,colors:{primary:"#8B6914",secondary:"#FFF8E0",text:"#FFFFFF"},imagePath:_e("castelain")},{slug:"castelain-chti",name:"Castelain Ch'ti Blonde",brewery:"Brasserie Castelain",style:"Bière de Garde",abv:6.4,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#1A0F00"}},{slug:"meteor",name:"Meteor White IPA",brewery:"Brasserie Meteor",style:"White IPA",abv:5.6,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"},imagePath:_e("meteor")},{slug:"anoesteke",name:"Anosteké Blonde",brewery:"Brasserie du Pays Flamand",style:"French Blonde",abv:8,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#1A0F00"},imagePath:_e("anoesteke")},{slug:"rousse-mont-blanc",name:"Rousse du Mont Blanc",brewery:"Brasserie du Mont Blanc",style:"French Amber",abv:6.5,colors:{primary:"#B5651D",secondary:"#FFF0D6",text:"#FFFFFF"},imagePath:_e("rousse-mont-blanc")},{slug:"custom",name:"Custom Beer",brewery:"Unknown",style:"Beer",abv:5,colors:{primary:"#555555",secondary:"#F0F0F0",text:"#FFFFFF"}}],$e=new Map,we=new Map;for(const e of Ae)$e.set(e.slug,e),we.set(e.name.toLowerCase(),e);function xe(){return Ae.filter(e=>"custom"!==e.slug)}function Ee(e,t){if(e){const i=(s=e,we.get(s.toLowerCase()));if(i)return i;const a=(r=e,$e.get(r));if(a)return a;if(t){const r=t.find(t=>t.name.toLowerCase()===e.toLowerCase());if(r)return{slug:r.name.toLowerCase().replace(/\s+/g,"-"),name:r.name,brewery:r.brewery??"Custom",style:r.style??"Beer",abv:r.abv??5,colors:{primary:r.color_primary??"#555555",secondary:r.color_secondary??"#F0F0F0",text:r.color_text??"#FFFFFF"},imagePath:r.image_url}}return{...$e.get("custom"),name:e,slug:e.toLowerCase().replace(/\s+/g,"-")}}var r,s;return xe()[0]}let Pe=class extends ne{constructor(){super(...arguments),this._devices=[]}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&this._discoverDevices()}_discoverDevices(){if(!this.hass)return;const e=this.hass.entities||{},t=this.hass.devices||{},r=new Map;for(const[s,i]of Object.entries(e)){if(i.platform!==ge)continue;const e=i.device_id;if(!e)continue;if(!r.has(e)){const s=t[e],i=s?.name_by_user||s?.name||e;r.set(e,{deviceId:e,name:i,entities:new Map})}const a=i.translation_key||i.original_name?.toLowerCase()?.replace(/\s+/g,"_")||s;r.get(e).entities.set(a,s)}this._devices=[...r.values()],1!==this._devices.length||this._config.device_id||this._updateConfig("device_id",this._devices[0].deviceId)}_updateConfig(e,t){this._config={...this._config,[e]:t};const r=new CustomEvent("config-changed",{detail:{config:this._config},bubbles:!0,composed:!0});this.dispatchEvent(r)}render(){if(!this.hass)return U`
Loading...
`;const e=xe();return U` +function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}"function"==typeof SuppressedError&&SuppressedError;const t=globalThis,r=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),i=new WeakMap;let a=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(r&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&i.set(t,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const r=1===e.length?e[0]:t.reduce((t,r,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[s+1],e[0]);return new a(r,e,s)},n=r?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new a("string"==typeof e?e:e+"",void 0,s))(t)})(e):e,{is:l,defineProperty:c,getOwnPropertyDescriptor:d,getOwnPropertyNames:h,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,g=globalThis,m=g.trustedTypes,y=m?m.emptyScript:"",f=g.reactiveElementPolyfillSupport,b=(e,t)=>e,v={toAttribute(e,t){switch(t){case Boolean:e=e?y:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},F=(e,t)=>!l(e,t),_={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:F};Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let x=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(e,r,t);void 0!==s&&c(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){const{get:s,set:i}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const a=s?.call(this);i?.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...h(e),...p(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(n(e))}else void 0!==e&&t.push(n(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,s)=>{if(r)e.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const r of s){const s=document.createElement("style"),i=t.litNonce;void 0!==i&&s.setAttribute("nonce",i),s.textContent=r.cssText,e.appendChild(s)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,r);if(void 0!==s&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:v).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(s):this.setAttribute(s,i),this._$Em=null}}_$AK(e,t){const r=this.constructor,s=r._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=r.getPropertyOptions(s),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:v;this._$Em=s;const a=i.fromAttribute(t,e.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(e,t,r,s=!1,i){if(void 0!==e){const a=this.constructor;if(!1===s&&(i=this[e]),r??=a.getPropertyOptions(e),!((r.hasChanged??F)(i,t)||r.useDefault&&r.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:s,wrapped:i},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,r]of e){const{wrapped:e}=r,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,r,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[b("elementProperties")]=new Map,x[b("finalized")]=new Map,f?.({ReactiveElement:x}),(g.reactiveElementVersions??=[]).push("2.1.2");const $=globalThis,w=e=>e,A=$.trustedTypes,E=A?A.createPolicy("lit-html",{createHTML:e=>e}):void 0,P="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+C,S=`<${k}>`,B=document,D=()=>B.createComment(""),z=e=>null===e||"object"!=typeof e&&"function"!=typeof e,L=Array.isArray,I="[ \t\n\f\r]",M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,H=/>/g,j=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),O=/'/g,R=/"/g,U=/^(?:script|style|textarea|title)$/i,G=(e=>(t,...r)=>({_$litType$:e,strings:t,values:r}))(1),N=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),W=new WeakMap,K=B.createTreeWalker(B,129);function Q(e,t){if(!L(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const q=(e,t)=>{const r=e.length-1,s=[];let i,a=2===t?"":3===t?"":"",o=M;for(let t=0;t"===l[0]?(o=i??M,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,n=l[1],o=void 0===l[3]?j:'"'===l[3]?R:O):o===R||o===O?o=j:o===T||o===H?o=M:(o=j,i=void 0);const h=o===j&&e[t+1].startsWith("/>")?" ":"";a+=o===M?r+S:c>=0?(s.push(n),r.slice(0,c)+P+r.slice(c)+C+h):r+C+(-2===c?t:h)}return[Q(e,a+(e[r]||"")+(2===t?"":3===t?"":"")),s]};class J{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let i=0,a=0;const o=e.length-1,n=this.parts,[l,c]=q(e,t);if(this.el=J.createElement(l,r),K.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=K.nextNode())&&n.length0){s.textContent=A?A.emptyScript:"";for(let r=0;rL(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==V&&z(this._$AH)?this._$AA.nextSibling.data=e:this.T(B.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,s="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=J.createElement(Q(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new Z(s,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=W.get(e.strings);return void 0===t&&W.set(e.strings,t=new J(e)),t}k(e){L(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,s=0;for(const i of e)s===t.length?t.push(r=new X(this.O(D()),this.O(D()),this,this.options)):r=t[s],r._$AI(i),s++;s2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=V}_$AI(e,t=this,r,s){const i=this.strings;let a=!1;if(void 0===i)e=Y(this,e,t,0),a=!z(e)||e!==this._$AH&&e!==N,a&&(this._$AH=e);else{const s=e;let o,n;for(e=i[0],o=0;o{const s=r?.renderBefore??t;let i=s._$litPart$;if(void 0===i){const e=r?.renderBefore??null;s._$litPart$=i=new X(t.insertBefore(D(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return N}}ne._$litElement$=!0,ne.finalized=!0,oe.litElementHydrateSupport?.({LitElement:ne});const le=oe.litElementPolyfillSupport;le?.({LitElement:ne}),(oe.litElementVersions??=[]).push("4.2.2");const ce=e=>(t,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},de={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:F},he=(e=de,t,r)=>{const{kind:s,metadata:i}=r;let a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),a.set(r.name,e),"accessor"===s){const{name:s}=r;return{set(r){const i=t.get.call(this);t.set.call(this,r),this.requestUpdate(s,i,e,!0,r)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=r;return function(r){const i=this[s];t.call(this,r),this.requestUpdate(s,i,e,!0,r)}}throw Error("Unsupported decorator location: "+s)};function pe(e){return(t,r)=>"object"==typeof r?he(e,t,r):((e,t,r)=>{const s=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),s?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function ue(e){return pe({...e,state:!0,attribute:!1})}const ge="perfectdraft",me=[{value:250,label:"250 mL",description:"Small glass"},{value:330,label:"330 mL",description:"Bottle / standard"},{value:500,label:"500 mL",description:"Half litre"},{value:568,label:"568 mL",description:"Pint (UK)"},{value:473,label:"473 mL",description:"Pint (US)"}],ye=330,fe=[{value:"landscape",label:"Landscape (default)"},{value:"portrait",label:"Portrait (stacked)"},{value:"compact",label:"Compact (single row)"},{value:"hero",label:"Hero (image-forward)"},{value:"vessel",label:"Vessel (single gauge)"}],be="landscape";const ve=14,Fe=7,_e=3,xe=0;function $e(e){return`kegs/${e}.webp`}const we={};const Ae=[{slug:"leffe-blonde",name:"Leffe Blonde",brewery:"Abbaye de Leffe",style:"Belgian Blonde",abv:6.6,colors:{primary:"#C8922A",secondary:"#FFF6E0",text:"#1A0F00"},imagePath:$e("leffe-blonde")},{slug:"leffe-brune",name:"Leffe Brune",brewery:"Abbaye de Leffe",style:"Belgian Dubbel",abv:6.5,colors:{primary:"#4A2810",secondary:"#F5E6D0",text:"#FFFFFF"},imagePath:$e("leffe-brune")},{slug:"leffe-amber",name:"Leffe Ambrée",brewery:"Abbaye de Leffe",style:"Belgian Amber",abv:6.6,colors:{primary:"#B5651D",secondary:"#FFF0D6",text:"#1A0F00"},imagePath:$e("leffe-amber")},{slug:"leffe-ruby",name:"Leffe Ruby",brewery:"Abbaye de Leffe",style:"Belgian Fruit Beer",abv:5,colors:{primary:"#8B1A4A",secondary:"#FFE6F0",text:"#FFFFFF"},imagePath:$e("leffe-ruby")},{slug:"leffe-blanche",name:"Leffe Blanche",brewery:"Abbaye de Leffe",style:"Belgian Witbier",abv:5,colors:{primary:"#E8DCC8",secondary:"#FFFDF5",text:"#2C2C2C"},imagePath:$e("leffe-blanche")},{slug:"leffe-winter",name:"Leffe Winter",brewery:"Abbaye de Leffe",style:"Belgian Winter Ale",abv:6.6,colors:{primary:"#1B3A5C",secondary:"#E0ECF8",text:"#FFFFFF"}},{slug:"leffe-noel",name:"Leffe Noël",brewery:"Abbaye de Leffe",style:"Belgian Winter Ale",abv:6.6,colors:{primary:"#1B3A5C",secondary:"#E0ECF8",text:"#FFFFFF"}},{slug:"leffe-dete",name:"Leffe d'Été",brewery:"Abbaye de Leffe",style:"Belgian Summer Ale",abv:5.2,colors:{primary:"#F5C242",secondary:"#FFFBE6",text:"#1A0F00"},imagePath:$e("leffe-dete")},{slug:"leffe-rituel",name:"Leffe Rituel 9°",brewery:"Abbaye de Leffe",style:"Belgian Strong Ale",abv:9,colors:{primary:"#2C1A00",secondary:"#F5E6D0",text:"#C8922A"},imagePath:$e("leffe-rituel")},{slug:"leffe-prestige",name:"Leffe Prestige 1240",brewery:"Abbaye de Leffe",style:"Belgian Strong Blonde",abv:8.5,colors:{primary:"#1A3366",secondary:"#E0E8F5",text:"#C8922A"},imagePath:$e("leffe-prestige")},{slug:"leffe-0",name:"Leffe Blonde 0.0%",brewery:"Abbaye de Leffe",style:"Non-Alcoholic Blonde",abv:0,colors:{primary:"#C8922A",secondary:"#FFF6E0",text:"#1A0F00"},imagePath:$e("leffe-0")},{slug:"hoegaarden",name:"Hoegaarden",brewery:"Brouwerij van Hoegaarden",style:"Belgian Witbier",abv:4.9,colors:{primary:"#F0E4C8",secondary:"#FFFDF2",text:"#2A4B1E"},imagePath:$e("hoegaarden")},{slug:"hoegaarden-rosee",name:"Hoegaarden Rosée",brewery:"Brouwerij van Hoegaarden",style:"Fruit Witbier",abv:3,colors:{primary:"#E87D9F",secondary:"#FFF0F5",text:"#4A0028"},imagePath:$e("hoegaarden-rosee")},{slug:"jupiler",name:"Jupiler",brewery:"AB InBev Belgium",style:"Belgian Pilsner",abv:5.2,colors:{primary:"#D4001A",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:$e("jupiler")},{slug:"kwak",name:"Pauwel Kwak",brewery:"Brouwerij Bosteels",style:"Belgian Strong Ale",abv:8.4,colors:{primary:"#B34700",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:$e("kwak")},{slug:"kwak-blonde",name:"Kwak Blonde",brewery:"Brouwerij Bosteels",style:"Belgian Blonde",abv:7.4,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#2C1A00"},imagePath:$e("kwak-blonde")},{slug:"tripel-karmeliet",name:"Tripel Karmeliet",brewery:"Brouwerij Bosteels",style:"Belgian Tripel",abv:8.4,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#2C1A00"},imagePath:$e("tripel-karmeliet")},{slug:"gulden-draak",name:"Gulden Draak",brewery:"Brouwerij Van Steenberge",style:"Belgian Strong Dark",abv:10.5,colors:{primary:"#1A1A2E",secondary:"#E8E0F0",text:"#C9A24D"}},{slug:"saint-feuillien",name:"Saint-Feuillien Blonde",brewery:"Brasserie St-Feuillien",style:"Belgian Blonde",abv:7.5,colors:{primary:"#C8922A",secondary:"#FFF6E0",text:"#1A0F00"},imagePath:$e("saint-feuillien")},{slug:"dupont",name:"Saison Dupont Dry Hop",brewery:"Brasserie Dupont",style:"Belgian Saison",abv:6.5,colors:{primary:"#8B6914",secondary:"#FFF8E0",text:"#1A0F00"},imagePath:$e("dupont")},{slug:"stella-artois",name:"Stella Artois",brewery:"Brouwerij Artois",style:"Belgian Lager",abv:5.2,colors:{primary:"#0E4C1E",secondary:"#F0F8E8",text:"#FFFFFF"},imagePath:$e("stella-artois")},{slug:"stella-artois-unfiltered",name:"Stella Artois Unfiltered",brewery:"Brouwerij Artois",style:"Unfiltered Lager",abv:5,colors:{primary:"#D4A547",secondary:"#FFFCE8",text:"#0E4C1E"},imagePath:$e("stella-artois-unfiltered")},{slug:"stella-artois-0",name:"Stella Artois 0.0%",brewery:"Brouwerij Artois",style:"Non-Alcoholic Lager",abv:0,colors:{primary:"#0E4C1E",secondary:"#F0F8E8",text:"#FFFFFF"},imagePath:$e("stella-artois-0")},{slug:"budweiser",name:"Budweiser",brewery:"Anheuser-Busch",style:"American Lager",abv:5,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"}},{slug:"bud",name:"Anheuser-Busch Bud",brewery:"Anheuser-Busch",style:"American Lager",abv:5,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:$e("bud")},{slug:"bud-light",name:"Bud Light",brewery:"Anheuser-Busch",style:"Light Lager",abv:3.5,colors:{primary:"#004B8D",secondary:"#E8F4FF",text:"#FFFFFF"},imagePath:$e("bud-light")},{slug:"corona",name:"Corona Extra",brewery:"Grupo Modelo",style:"Mexican Lager",abv:4.5,colors:{primary:"#FDB913",secondary:"#FFFCE5",text:"#00205B"},imagePath:$e("corona")},{slug:"corona-cero",name:"Corona Cero",brewery:"Grupo Modelo",style:"Non-Alcoholic Lager",abv:0,colors:{primary:"#0073B1",secondary:"#E5F3FF",text:"#FFFFFF"},imagePath:$e("corona-cero")},{slug:"becks",name:"Beck's",brewery:"Brauerei Beck & Co",style:"German Pilsner",abv:4.8,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"},imagePath:$e("becks")},{slug:"becks-gold",name:"Beck's Gold",brewery:"Brauerei Beck & Co",style:"German Lager",abv:4.9,colors:{primary:"#D4A547",secondary:"#FFF8E0",text:"#006838"},imagePath:$e("becks-gold")},{slug:"peroni",name:"Peroni Nastro Azzurro",brewery:"Birra Peroni",style:"Italian Lager",abv:5.1,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"},imagePath:$e("peroni")},{slug:"hertog-jan",name:"Hertog Jan",brewery:"AB InBev Netherlands",style:"Dutch Pilsner",abv:5.1,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#D4A547"},imagePath:$e("hertog-jan")},{slug:"hertog-jan-grand",name:"Hertog Jan Grand Pilsener",brewery:"AB InBev Netherlands",style:"Dutch Pilsner",abv:5.1,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#D4A547"},imagePath:$e("hertog-jan-grand")},{slug:"tennents",name:"Tennent's Lager",brewery:"Wellpark Brewery",style:"Scottish Lager",abv:5,colors:{primary:"#D4001A",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:$e("tennents")},{slug:"la-virgen",name:"La Virgen Lager",brewery:"Cervezas La Virgen",style:"Spanish Lager",abv:5,colors:{primary:"#1E6B3A",secondary:"#E8F5E0",text:"#FFFFFF"},imagePath:$e("la-virgen")},{slug:"san-miguel",name:"San Miguel",brewery:"San Miguel",style:"Spanish Lager",abv:5.4,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:$e("san-miguel")},{slug:"victoria",name:"Victoria",brewery:"Victoria",style:"Spanish Lager",abv:4.8,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#D4A547"},imagePath:$e("victoria")},{slug:"samson",name:"Samson 11",brewery:"Samson",style:"Czech Lager",abv:4.7,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"},imagePath:$e("samson")},{slug:"franziskaner",name:"Franziskaner Weissbier",brewery:"Spaten-Franziskaner-Bräu",style:"Hefeweizen",abv:5,colors:{primary:"#2E5090",secondary:"#E8F0FF",text:"#F5C242"},imagePath:$e("franziskaner")},{slug:"franziskaner-royal",name:"Franziskaner Royal",brewery:"Spaten-Franziskaner-Bräu",style:"Weissbier",abv:6,colors:{primary:"#1A1A5C",secondary:"#E0E0F8",text:"#F5C242"},imagePath:$e("franziskaner-royal")},{slug:"franziskaner-kellerbier",name:"Franziskaner Kellerbier",brewery:"Spaten-Franziskaner-Bräu",style:"Kellerbier",abv:5.2,colors:{primary:"#6B4423",secondary:"#F5E6D0",text:"#F5C242"},imagePath:$e("franziskaner-kellerbier")},{slug:"spaten",name:"Spaten",brewery:"Spaten-Franziskaner-Bräu",style:"Munich Helles",abv:5.2,colors:{primary:"#1A3C0A",secondary:"#E8F0E0",text:"#FFFFFF"},imagePath:$e("spaten")},{slug:"lowenbrau",name:"Löwenbräu",brewery:"Löwenbräu",style:"Munich Helles",abv:5.2,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"},imagePath:$e("lowenbrau")},{slug:"hasseroder",name:"Hasseröder Premium",brewery:"Hasseröder Brauerei",style:"German Pilsner",abv:4.9,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"},imagePath:$e("hasseroder")},{slug:"diebels",name:"Diebels Alt",brewery:"Brauerei Diebels",style:"Altbier",abv:4.9,colors:{primary:"#4A2810",secondary:"#F5E6D0",text:"#FFFFFF"},imagePath:$e("diebels")},{slug:"schneider",name:"Schneider Bayrisch Hell",brewery:"G. Schneider & Sohn",style:"Bavarian Helles",abv:5.2,colors:{primary:"#006838",secondary:"#E8F5E0",text:"#FFFFFF"},imagePath:$e("schneider")},{slug:"haake-beck",name:"Haake-Beck",brewery:"Brauerei Beck & Co",style:"German Pilsner",abv:4.9,colors:{primary:"#006838",secondary:"#E0F5E8",text:"#FFFFFF"},imagePath:$e("haake-beck")},{slug:"fruh-kolsch",name:"Früh Kölsch",brewery:"Cölner Hofbräu Früh",style:"Kölsch",abv:4.8,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:$e("fruh-kolsch")},{slug:"goose-island-ipa",name:"Goose Island IPA",brewery:"Goose Island",style:"India Pale Ale",abv:5.9,colors:{primary:"#D45500",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:$e("goose-island-ipa")},{slug:"goose-island-hazy",name:"Goose Island Hazy Beer Hug",brewery:"Goose Island",style:"Hazy IPA",abv:6.4,colors:{primary:"#F5A623",secondary:"#FFFAE5",text:"#2C1A00"}},{slug:"goose-midway",name:"Goose Midway Session IPA",brewery:"Goose Island",style:"Session IPA",abv:4.1,colors:{primary:"#D45500",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:$e("goose-midway")},{slug:"brewdog-punk-ipa",name:"BrewDog Punk IPA",brewery:"BrewDog",style:"India Pale Ale",abv:5.4,colors:{primary:"#00A3E0",secondary:"#E5F5FF",text:"#FFFFFF"},imagePath:$e("brewdog-punk-ipa")},{slug:"brewdog-elvis-juice",name:"BrewDog Elvis Juice",brewery:"BrewDog",style:"Grapefruit IPA",abv:6.5,colors:{primary:"#FF6B1A",secondary:"#FFF3E5",text:"#1A1A1A"},imagePath:$e("brewdog-elvis-juice")},{slug:"camden-hells",name:"Camden Hells",brewery:"Camden Town Brewery",style:"Helles Lager",abv:4.6,colors:{primary:"#000000",secondary:"#F5F0E0",text:"#F5C242"},imagePath:$e("camden-hells")},{slug:"camden-pale",name:"Camden Pale Ale",brewery:"Camden Town Brewery",style:"Pale Ale",abv:4,colors:{primary:"#E87D00",secondary:"#FFF5E5",text:"#000000"},imagePath:$e("camden-pale")},{slug:"camden-ipa",name:"Camden IPA",brewery:"Camden Town Brewery",style:"India Pale Ale",abv:5.8,colors:{primary:"#2E8B57",secondary:"#E5F5EC",text:"#FFFFFF"},imagePath:$e("camden-ipa")},{slug:"camden-eazy",name:"Camden Eazy",brewery:"Camden Town Brewery",style:"Session Pale",abv:4,colors:{primary:"#F5C242",secondary:"#FFFCE5",text:"#000000"},imagePath:$e("camden-eazy")},{slug:"tiny-rebel-clwb",name:"Tiny Rebel Clwb Tropicana",brewery:"Tiny Rebel",style:"Tropical IPA",abv:5.5,colors:{primary:"#FF3399",secondary:"#FFE5F2",text:"#1A1A1A"},imagePath:$e("tiny-rebel-clwb")},{slug:"vocation-life-death",name:"Vocation Life & Death",brewery:"Vocation Brewery",style:"India Pale Ale",abv:6.5,colors:{primary:"#1A1A1A",secondary:"#F0F0F0",text:"#D4001A"},imagePath:$e("vocation-life-death")},{slug:"vocation-hop-skip",name:"Vocation Hop, Skip & Juice",brewery:"Vocation Brewery",style:"Pale Ale",abv:5.7,colors:{primary:"#F5A623",secondary:"#FFFAE5",text:"#1A1A1A"},imagePath:$e("vocation-hop-skip")},{slug:"thornbridge-jaipur",name:"Thornbridge Jaipur",brewery:"Thornbridge Brewery",style:"India Pale Ale",abv:5.9,colors:{primary:"#8B4513",secondary:"#FFF5EB",text:"#FFFFFF"},imagePath:$e("thornbridge-jaipur")},{slug:"ninkasi",name:"Ninkasi IPA",brewery:"Ninkasi Brasserie",style:"India Pale Ale",abv:5.4,colors:{primary:"#D45500",secondary:"#FFF2E5",text:"#FFFFFF"},imagePath:$e("ninkasi")},{slug:"fullers-london-pride",name:"Fuller's London Pride",brewery:"Fuller's",style:"English Bitter",abv:4.7,colors:{primary:"#7B241C",secondary:"#F5E6E0",text:"#FFFFFF"},imagePath:$e("fullers-london-pride")},{slug:"hawkstone",name:"Hawkstone Lager",brewery:"Hawkstone Brewing",style:"English Lager",abv:4.8,colors:{primary:"#3D6B35",secondary:"#E8F0E0",text:"#F5E6C8"}},{slug:"old-peculier",name:"Theakston Old Peculier",brewery:"Theakston Brewery",style:"Old Ale",abv:5.6,colors:{primary:"#2C0A1E",secondary:"#F0E0E8",text:"#C8922A"},imagePath:$e("old-peculier")},{slug:"adnams",name:"Adnams Ghost Ship",brewery:"Adnams",style:"Pale Ale",abv:4.5,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"}},{slug:"old-speckled-hen",name:"Old Speckled Hen",brewery:"Greene King",style:"English Bitter",abv:5,colors:{primary:"#8B4513",secondary:"#FFF5EB",text:"#FFFFFF"},imagePath:$e("old-speckled-hen")},{slug:"northern-monk",name:"Northern Monk A Little Faith",brewery:"Northern Monk",style:"Session Pale",abv:4,colors:{primary:"#1A1A1A",secondary:"#F0F0F0",text:"#F5C242"},imagePath:$e("northern-monk")},{slug:"st-austell",name:"St Austell Proper Job IPA",brewery:"St Austell",style:"India Pale Ale",abv:5.5,colors:{primary:"#C8102E",secondary:"#FFF0F0",text:"#FFFFFF"},imagePath:$e("st-austell")},{slug:"trooper",name:"Trooper Original",brewery:"Robinsons",style:"English Bitter",abv:4.7,colors:{primary:"#1A1A1A",secondary:"#F0F0F0",text:"#C8102E"},imagePath:$e("trooper")},{slug:"castelain",name:"Castelain Grand Cru",brewery:"Brasserie Castelain",style:"Bière de Garde",abv:6.2,colors:{primary:"#8B6914",secondary:"#FFF8E0",text:"#FFFFFF"},imagePath:$e("castelain")},{slug:"castelain-chti",name:"Castelain Ch'ti Blonde",brewery:"Brasserie Castelain",style:"Bière de Garde",abv:6.4,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#1A0F00"},imagePath:$e("castelain-chti")},{slug:"meteor",name:"Meteor White IPA",brewery:"Brasserie Meteor",style:"White IPA",abv:5.6,colors:{primary:"#003DA5",secondary:"#E8F0FF",text:"#FFFFFF"},imagePath:$e("meteor")},{slug:"anoesteke",name:"Anosteké Blonde",brewery:"Brasserie du Pays Flamand",style:"French Blonde",abv:8,colors:{primary:"#D4A547",secondary:"#FFF8E8",text:"#1A0F00"},imagePath:$e("anoesteke")},{slug:"rousse-mont-blanc",name:"Rousse du Mont Blanc",brewery:"Brasserie du Mont Blanc",style:"French Amber",abv:6.5,colors:{primary:"#B5651D",secondary:"#FFF0D6",text:"#FFFFFF"},imagePath:$e("rousse-mont-blanc")},{slug:"custom",name:"Custom Beer",brewery:"Unknown",style:"Beer",abv:5,colors:{primary:"#555555",secondary:"#F0F0F0",text:"#FFFFFF"}}],Ee=new Map,Pe=new Map;for(const e of Ae)Ee.set(e.slug,e),Pe.set(e.name.toLowerCase(),e);function Ce(){return Ae.filter(e=>"custom"!==e.slug)}function ke(e,t){if(e){const i=(s=e,Pe.get(s.toLowerCase()));if(i)return i;const a=(r=e,Ee.get(r));if(a)return a;if(t){const r=t.find(t=>t.name.toLowerCase()===e.toLowerCase());if(r)return{slug:r.name.toLowerCase().replace(/\s+/g,"-"),name:r.name,brewery:r.brewery??"Custom",style:r.style??"Beer",abv:r.abv??5,colors:{primary:r.color_primary??"#555555",secondary:r.color_secondary??"#F0F0F0",text:r.color_text??"#FFFFFF"},imagePath:r.image_url}}return{...Ee.get("custom"),name:e,slug:e.toLowerCase().replace(/\s+/g,"-")}}var r,s;return Ce()[0]}let Se=class extends ne{constructor(){super(...arguments),this._devices=[]}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&this._discoverDevices()}_discoverDevices(){if(!this.hass)return;const e=this.hass.entities||{},t=this.hass.devices||{},r=new Map;for(const[s,i]of Object.entries(e)){if(i.platform!==ge)continue;const e=i.device_id;if(!e)continue;if(!r.has(e)){const s=t[e],i=s?.name_by_user||s?.name||e;r.set(e,{deviceId:e,name:i,entities:new Map})}const a=i.translation_key||i.original_name?.toLowerCase()?.replace(/\s+/g,"_")||s;r.get(e).entities.set(a,s)}this._devices=[...r.values()],1!==this._devices.length||this._config.device_id||this._updateConfig("device_id",this._devices[0].deviceId)}_updateConfig(e,t){this._config={...this._config,[e]:t};const r=new CustomEvent("config-changed",{detail:{config:this._config},bubbles:!0,composed:!0});this.dispatchEvent(r)}render(){if(!this.hass)return G`
Loading...
`;const e=Ce();return G`
-
PerfectDraft Card Editor v${"0.1.6"} · ${this._devices.length} device(s) found
- ${0===this._devices.length?U`
No PerfectDraft devices found. Please install and configure the PerfectDraft integration first.
`:U` +
PerfectDraft Card Editor v${"0.2.0"} · ${this._devices.length} device(s) found
+ ${0===this._devices.length?G`
No PerfectDraft devices found. Please install and configure the PerfectDraft integration first.
`:G`
this._updateConfig("glass_size",parseInt(e.target.value,10))} > - ${ye.map(e=>U` - `)}
+
+ + +
+ +
Emoji matrix (advanced)
+ +
+ + +
+ +
+ + this._updateConfig("max_matrix_width",e.target.value||void 0)} + /> +
+
Loading...
`;if(!this._config.device_id)return U`
No device configured. Please edit this card to select a PerfectDraft device.
`;if(this._config.beer_entity){const e=this._getState(this._config.beer_entity);if(e&&"unavailable"!==e&&"unknown"!==e){const t=Ee(e,this._config.custom_beers);t.slug!==this._beer?.slug&&(this._beer=t)}}const e=Se(this._getState(this._entityIds.temperature)),t=Se(this._getState(this._entityIds.kegRemaining)),r=Se(this._getState(this._entityIds.kegFreshness)),s=null===(i=r)?"normal":i<=ve?"expired":i<=Fe?"critical":i<=fe?"urgent":i<=be?"warning":"normal";var i;const a=null!==t?t/100*6e3:null,o=null!==a?Math.floor(a/this._glassSize):null,n=this._beer??Ee(void 0);return U` - -
-
{this._showBeerDialog=!0}} - style="background: linear-gradient(135deg, ${n.colors.primary}dd, ${n.colors.primary}88);"> -
- ${n.imagePath?U`{const t=e.target;if(!t.parentElement.querySelector(".beer-logo-text")){t.style.display="none";const e=document.createElement("div");e.className="beer-logo-text",e.style.color=n.colors.text,e.textContent=n.name.charAt(0),t.parentElement.appendChild(e)}}} />`:U`
${n.name.charAt(0)}
`} -
-
- ❄ ${null!==e?`${Math.round(e)}°C`:"--°C"} -
-
- ${n.name} -
-
- ${n.brewery} · ${n.abv}% -
-
- -
{this._showGlassDialog=!0}}> - ${null!==o&&o>0?this._renderEmojiGrid(o):0===o||null!==t&&0===t?this._renderEmptyKeg():this._renderEmojiGrid(0)} -
- ${null!==o?`${o} × ${this._glassLabel()}`:`-- × ${this._glassLabel()}`} -
- ${this._renderFreshnessIndicator(r,s)} + `}};e([pe({attribute:!1})],Se.prototype,"hass",void 0),e([ue()],Se.prototype,"_config",void 0),e([ue()],Se.prototype,"_devices",void 0),Se=e([ce("perfectdraft-card-editor")],Se);function Be(){const e=document.querySelectorAll("script[src]");for(const t of e){const e=t.src;if(e.includes("perfectdraft-card"))return e.substring(0,e.lastIndexOf("/")+1)}return"/hacsfiles/perfectdraft-card/"}function De(e,t){return`perfectdraft-card:${e}:${t}`}function ze(e){if(!e||"unavailable"===e||"unknown"===e)return null;const t=parseFloat(e);return isNaN(t)?null:t}let Le=class extends ne{constructor(){super(...arguments),this._glassSize=ye,this._layout=be,this._showGlassDialog=!1,this._showBeerDialog=!1,this._beerSearchQuery="",this._failedImages=new Set,this._entityIds={},this._openBeerDialog=()=>{this._showBeerDialog=!0},this._openGlassDialog=()=>{this._showGlassDialog=!0}}setConfig(e){if(!e.device_id)throw new Error("PerfectDraft Card: No device configured. Please use the visual editor to select a PerfectDraft device.");var t;this._config={...e},this._layout=(t=e.layout,fe.some(e=>e.value===t)?t:be);const r=e.matrix_columns;this._matrixColumns="number"==typeof r&&Number.isFinite(r)&&r>0?Math.floor(r):void 0,this._maxMatrixWidth="string"==typeof e.max_matrix_width&&e.max_matrix_width.trim()?e.max_matrix_width.trim():void 0;const s=localStorage.getItem(De(e.device_id,"glass"));this._glassSize=s?parseInt(s,10):e.glass_size??ye;const i=localStorage.getItem(De(e.device_id,"beer"))??e.beer_name;this._beer=ke(i,e.custom_beers)}getCardSize(){switch(this._layout){case"compact":return 1;case"vessel":return 4;case"portrait":return 6;default:return 5}}getGridOptions(){switch(this._layout){case"compact":return{rows:1,columns:12,min_columns:2,min_rows:1};case"portrait":return{rows:5,columns:6,min_columns:1,min_rows:3};case"vessel":return{rows:4,columns:6,min_columns:1,min_rows:2};case"hero":return{rows:5,columns:8,min_columns:1,min_rows:2};default:return{columns:4,rows:3,min_columns:1,min_rows:2}}}static getStubConfig(e){const t=e.entities||{},r=new Set;for(const e of Object.values(t))e.platform===ge&&e.device_id&&r.add(e.device_id);return{device_id:1===r.size?[...r][0]:"",beer_name:"Stella Artois",glass_size:ye,layout:be}}static getConfigElement(){return document.createElement("perfectdraft-card-editor")}connectedCallback(){super.connectedCallback(),this._resolveEntities()}updated(e){super.updated(e),e.has("hass")&&this._resolveEntities()}_resolveEntities(){if(!this.hass||!this._config?.device_id)return;if(this._entityIds.temperature)return;const e=this.hass.entities||{};for(const[t,r]of Object.entries(e)){if(r.platform!==ge||r.device_id!==this._config.device_id)continue;const e=r.translation_key;"temperature"===e?this._entityIds.temperature=t:"keg_remaining"===e?this._entityIds.kegRemaining=t:"keg_freshness"===e&&(this._entityIds.kegFreshness=t)}}_getState(e){if(e&&this.hass)return this.hass.states[e]?.state}_selectGlass(e){this._glassSize=e,this._showGlassDialog=!1,this._config?.device_id&&localStorage.setItem(De(this._config.device_id,"glass"),String(e))}_selectBeer(e){this._beer=e,this._showBeerDialog=!1,this._beerSearchQuery="",this._config?.device_id&&localStorage.setItem(De(this._config.device_id,"beer"),e.name)}_imgError(e){this._failedImages=new Set(this._failedImages).add(e)}render(){if(!this._config||!this.hass)return G`
Loading...
`;if(!this._config.device_id)return G`
No device configured. Please edit this card to select a PerfectDraft device.
`;if(this._config.beer_entity){const e=this._getState(this._config.beer_entity);if(e&&"unavailable"!==e&&"unknown"!==e){const t=ke(e,this._config.custom_beers);t.slug!==this._beer?.slug&&(this._beer=t)}}const e=ze(this._getState(this._entityIds.temperature)),t=ze(this._getState(this._entityIds.kegRemaining)),r=ze(this._getState(this._entityIds.kegFreshness)),s=null===(i=r)?"normal":i<=xe?"expired":i<=_e?"critical":i<=Fe?"urgent":i<=ve?"warning":"normal";var i;const a=null!==t?t/100*6e3:null,o=null!==a?Math.floor(a/this._glassSize):null,n={beer:this._beer??ke(void 0),temp:e,kegPct:t,freshDays:r,tier:s,glassCount:o},l="portrait"===this._layout?this._renderPortrait(n):"compact"===this._layout?this._renderCompact(n):"hero"===this._layout?this._renderHero(n):"vessel"===this._layout?this._renderVessel(n):this._renderLandscape(n);return G` + + ${l} + ${this._showGlassDialog?this._renderGlassDialog():V} + ${this._showBeerDialog?this._renderBeerDialog():V} + + `}_labelStyle(e){return`background: linear-gradient(135deg, ${e.colors.primary}dd, ${e.colors.primary}88);`}_tempText(e){return null!==e?`${Math.round(e)}°C`:"--°C"}_countText(e){return null!==e?`${e} × ${this._glassLabel()}`:`-- × ${this._glassLabel()}`}_renderVisual(e){const t=e.imagePath?e.imagePath.startsWith("http")?e.imagePath:Be()+e.imagePath:void 0;if(t&&!this._failedImages.has(t))return G`this._imgError(t)} />`;const r=e.breweryLogo??((s=e.brewery)?we[s]:void 0);var s;const i=r?r.startsWith("http")?r:Be()+r:void 0;return i&&!this._failedImages.has(i)?G`this._imgError(i)} />`:this._renderKegSilhouette(e)}_renderKegSilhouette(e){const t=(e.name.charAt(0)||"?").toUpperCase(),{primary:r,secondary:s}=e.colors;return G` + + + + + ${t} + + + `}_renderGlassVessel(e,t){const r=Math.max(0,Math.min(100,t)),s=128,i=s-112*r/100,a=`pdfill-${e.slug.replace(/[^a-z0-9]/gi,"")}`,o="M24 16 H76 L70 122 Q70 128 64 128 H36 Q30 128 30 122 Z";return G` + + + + + + ${r>0&&r<100?G``:V} + + + + `}_renderLabelInner(e,t){return G` +
${this._renderVisual(e)}
+
❄ ${this._tempText(t)}
+
${e.name}
+
${e.brewery} · ${e.abv}%
+ `}_renderKegContent(e){return G` + ${null!==e.glassCount&&e.glassCount>0?this._renderEmojiGrid(e.glassCount):0===e.glassCount||null!==e.kegPct&&0===e.kegPct?this._renderEmptyKeg():this._renderEmojiGrid(0)} +
${this._countText(e.glassCount)}
+ ${this._renderFreshnessIndicator(e.freshDays,e.tier)} + `}_renderLandscape(e){return G` +
+
+ ${this._renderLabelInner(e.beer,e.temp)} +
+
${this._renderKegContent(e)}
+
+ `}_renderPortrait(e){return G` +
+
+ ${this._renderLabelInner(e.beer,e.temp)} +
+
${this._renderKegContent(e)}
+
+ `}_renderCompact(e){const t=e.kegPct??0;return G` +
+
${this._renderVisual(e.beer)}
+
+
${e.beer.name}
+
+
- - ${this._showGlassDialog?this._renderGlassDialog():W} - ${this._showBeerDialog?this._renderBeerDialog():W} - - `}_renderEmojiGrid(e){const t=Math.floor(6e3/this._glassSize),r=t<=10?5:6,s=Math.ceil(t/r),i=[];for(let r=0;r🍺`:U`🍺`);return U` -
+
+
❄ ${this._tempText(e.temp)}
+
${this._countText(e.glassCount)}
+
+
+ `}_renderHero(e){return G` +
+
${this._renderVisual(e.beer)}
+
+
+ ${e.beer.name} + ❄ ${this._tempText(e.temp)} +
+
${this._countText(e.glassCount)}
+
+ ${this._renderFreshnessIndicator(e.freshDays,e.tier)} +
+ `}_renderVessel(e){const t=e.kegPct??0;return G` +
+
+ ${e.beer.name} + ❄ ${this._tempText(e.temp)} +
+
${this._renderGlassVessel(e.beer,t)}
+
${this._countText(e.glassCount)}
+ ${this._renderFreshnessIndicator(e.freshDays,e.tier)} +
+ `}_renderEmojiGrid(e){const t=Math.floor(6e3/this._glassSize),r=this._matrixColumns&&this._matrixColumns>0?Math.min(this._matrixColumns,t):t<=10?5:6,s=Math.ceil(t/r),i=[];for(let r=0;r🍺`:G`🍺`);const a=this._maxMatrixWidth?`max-width: ${this._maxMatrixWidth}; margin-left: auto; margin-right: auto;`:"";return G` +
${i}
- `}_renderEmptyKeg(){return U` + `}_renderEmptyKeg(){return G`
🫗
Keg Empty
Time to reload!
- `}_renderFreshnessIndicator(e,t){if("normal"===t||null===e)return U``;return U`
${{warning:`⏳ ${e}d fresh`,urgent:`⚠ ${e} days left — drink up!`,critical:`🚨 ${e} days left!`,expired:"Keg expired"}[t]??""}
`}_glassLabel(){const e=ye.find(e=>e.value===this._glassSize);return e?e.label:`${this._glassSize} mL`}_renderGlassDialog(){return U` + `}_renderFreshnessIndicator(e,t){if("normal"===t||null===e)return G``;return G`
${{warning:`⏳ ${e}d fresh`,urgent:`⚠ ${e} days left — drink up!`,critical:`🚨 ${e} days left!`,expired:"Keg expired"}[t]??""}
`}_glassLabel(){const e=me.find(e=>e.value===this._glassSize);return e?e.label:`${this._glassSize} mL`}_renderGlassDialog(){return G`
{this._showGlassDialog=!1}}>
e.stopPropagation()}>
Glass Size
- ${ye.map(e=>U` + ${me.map(e=>G`
this._selectGlass(e.value)}> ${e.label} @@ -150,7 +250,7 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro `)}
- `}_renderBeerDialog(){const e=this._beerSearchQuery?function(e){const t=e.toLowerCase();return Ae.filter(e=>"custom"!==e.slug&&(e.name.toLowerCase().includes(t)||e.brewery.toLowerCase().includes(t)))}(this._beerSearchQuery):xe(),t=(this._config.custom_beers??[]).filter(e=>!this._beerSearchQuery||e.name.toLowerCase().includes(this._beerSearchQuery.toLowerCase()));return U` + `}_renderBeerDialog(){const e=this._beerSearchQuery?function(e){const t=e.toLowerCase();return Ae.filter(e=>"custom"!==e.slug&&(e.name.toLowerCase().includes(t)||e.brewery.toLowerCase().includes(t)))}(this._beerSearchQuery):Ce(),t=(this._config.custom_beers??[]).filter(e=>!this._beerSearchQuery||e.name.toLowerCase().includes(this._beerSearchQuery.toLowerCase()));return G`
{this._showBeerDialog=!1,this._beerSearchQuery=""}}>
e.stopPropagation()}>
Select Beer
@@ -162,7 +262,7 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro @input=${e=>{this._beerSearchQuery=e.target.value}} />
- ${e.map(e=>U` + ${e.map(e=>G`
this._selectBeer(e)}> @@ -170,17 +270,17 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro ${e.brewery} · ${e.abv}%
`)} - ${t.length>0?U` + ${t.length>0?G`
Custom
- ${t.map(e=>U` + ${t.map(e=>G`
this._selectBeer(Ee(e.name,this._config.custom_beers))}> + @click=${()=>this._selectBeer(ke(e.name,this._config.custom_beers))}> ${e.name} ${e.brewery??"Custom"}
`)} - `:W} + `:V}
@@ -222,7 +322,7 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro 50% { border-color: #db4437; box-shadow: 0 0 20px #db443744; } } - /* === LAYOUT === */ + /* === LAYOUT (landscape default) === */ .card-content { display: flex; height: 100%; @@ -231,6 +331,7 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro .label-zone { flex: 1 1 25%; + min-width: 0; max-width: 30%; display: flex; flex-direction: column; @@ -248,6 +349,8 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro .keg-zone { flex: 3; + min-width: 0; + container-type: inline-size; display: flex; flex-direction: column; align-items: center; @@ -276,6 +379,11 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro max-height: 100%; object-fit: contain; } + .gen-svg, .vessel-svg { + width: 100%; + height: 100%; + max-height: 100%; + } .beer-logo-text { font-size: 5em; font-weight: bold; @@ -315,7 +423,8 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro justify-content: center; width: 100%; height: 100%; - font-size: min(7vw, 5em); + font-size: min(7vw, 4.5em); + font-size: clamp(0.5em, 14cqi, 4.5em); } .glass.empty { opacity: 0.15; @@ -328,6 +437,178 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro flex-shrink: 0; } + /* === PORTRAIT === */ + .layout-portrait-content { + flex-direction: column; + } + .layout-portrait-content .label-zone { + flex: 0 0 auto; + max-width: none; + width: 100%; + padding: 18px 16px; + border-radius: var(--ha-card-border-radius, 12px) var(--ha-card-border-radius, 12px) 0 0; + } + .layout-portrait-content .label-zone .beer-logo-area { + max-height: 120px; + } + .layout-portrait-content .keg-zone { + flex: 1 1 auto; + width: 100%; + } + + /* === COMPACT === */ + .layout-compact-content { + min-height: 0; + align-items: center; + gap: 12px; + padding: 10px 16px; + } + .compact-visual { + flex: 0 0 auto; + width: 44px; + height: 44px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + } + .compact-visual .beer-logo, + .compact-visual .gen-svg { + max-width: 44px; + max-height: 44px; + } + .compact-main { + flex: 1 1 auto; + min-width: 0; + cursor: pointer; + } + .compact-name { + font-weight: bold; + font-size: 1.05em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + .compact-bar { + margin-top: 6px; + height: 8px; + border-radius: 4px; + background: rgba(255, 255, 255, 0.12); + overflow: hidden; + } + .compact-bar-fill { + height: 100%; + border-radius: 4px; + transition: width 0.4s ease; + } + .compact-side { + flex: 0 0 auto; + text-align: right; + cursor: pointer; + white-space: nowrap; + } + .compact-temp { + font-size: 1.1em; + font-weight: 300; + } + .compact-count { + font-size: 0.8em; + opacity: 0.6; + } + + /* === HERO === */ + .layout-hero-content { + flex-direction: column; + align-items: center; + justify-content: center; + position: relative; + min-height: 320px; + cursor: pointer; + } + .hero-visual { + flex: 1 1 auto; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + min-height: 0; + padding: 18px 18px 0; + box-sizing: border-box; + } + .hero-visual .beer-logo, + .hero-visual .gen-svg { + max-height: 100%; + max-width: 80%; + filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45)); + } + .hero-scrim { + width: 100%; + box-sizing: border-box; + padding: 28px 20px 16px; + background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent); + text-align: center; + } + .hero-line { + display: flex; + align-items: baseline; + justify-content: center; + gap: 14px; + flex-wrap: wrap; + } + .hero-name { + font-size: 1.5em; + font-weight: bold; + } + .hero-temp { + font-size: 1.3em; + font-weight: 300; + } + .hero-count { + font-size: 1.05em; + opacity: 0.7; + margin-top: 2px; + } + + /* === VESSEL === */ + .layout-vessel-content { + flex-direction: column; + align-items: center; + justify-content: center; + gap: 6px; + padding: 16px; + min-height: 280px; + } + .vessel-top { + display: flex; + align-items: baseline; + gap: 12px; + cursor: pointer; + flex-wrap: wrap; + justify-content: center; + } + .vessel-name { + font-size: 1.4em; + font-weight: bold; + } + .vessel-temp { + font-size: 1.2em; + font-weight: 300; + opacity: 0.85; + } + .vessel-mid { + flex: 1 1 auto; + min-height: 0; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + } + .vessel-count { + font-size: 1.2em; + opacity: 0.7; + cursor: pointer; + } + /* === EMPTY KEG === */ .empty-keg { text-align: center; @@ -490,4 +771,4 @@ function e(e,t,r,s){var i,a=arguments.length,o=a<3?t:null===s?s=Object.getOwnPro padding: 16px; color: var(--error-color, #db4437); } - `}};e([pe({attribute:!1})],Be.prototype,"hass",void 0),e([ue()],Be.prototype,"_config",void 0),e([ue()],Be.prototype,"_beer",void 0),e([ue()],Be.prototype,"_glassSize",void 0),e([ue()],Be.prototype,"_showGlassDialog",void 0),e([ue()],Be.prototype,"_showBeerDialog",void 0),e([ue()],Be.prototype,"_beerSearchQuery",void 0),Be=e([ce("perfectdraft-card")],Be),window.customCards=window.customCards||[],window.customCards.push({type:"perfectdraft-card",name:"PerfectDraft Card",description:"Display PerfectDraft Pro keg status with beer emojis",preview:!0,documentationURL:"https://github.com/Falkvinge/hassio-component-perfectdraft-pro"}),console.info("%c PERFECTDRAFT-CARD %c v0.1.6 ","background: #f5a623; color: #000; font-weight: bold;","background: #333; color: #f5a623;");export{Be as PerfectDraftCard}; + `}};e([pe({attribute:!1})],Le.prototype,"hass",void 0),e([ue()],Le.prototype,"_config",void 0),e([ue()],Le.prototype,"_beer",void 0),e([ue()],Le.prototype,"_glassSize",void 0),e([ue()],Le.prototype,"_layout",void 0),e([ue()],Le.prototype,"_matrixColumns",void 0),e([ue()],Le.prototype,"_maxMatrixWidth",void 0),e([ue()],Le.prototype,"_showGlassDialog",void 0),e([ue()],Le.prototype,"_showBeerDialog",void 0),e([ue()],Le.prototype,"_beerSearchQuery",void 0),e([ue()],Le.prototype,"_failedImages",void 0),Le=e([ce("perfectdraft-card")],Le),window.customCards=window.customCards||[],window.customCards.push({type:"perfectdraft-card",name:"PerfectDraft Card",description:"Display PerfectDraft Pro keg status with beer emojis",preview:!0,documentationURL:"https://github.com/Falkvinge/hassio-component-perfectdraft-pro"}),console.info("%c PERFECTDRAFT-CARD %c v0.2.0 ","background: #f5a623; color: #000; font-weight: bold;","background: #333; color: #f5a623;");export{Le as PerfectDraftCard}; diff --git a/openspec/changes/card-layouts-and-imagery/.openspec.yaml b/openspec/changes/card-layouts-and-imagery/.openspec.yaml new file mode 100644 index 0000000..a2168c3 --- /dev/null +++ b/openspec/changes/card-layouts-and-imagery/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-06-01 diff --git a/openspec/changes/card-layouts-and-imagery/assets/cropped-viewport.png b/openspec/changes/card-layouts-and-imagery/assets/cropped-viewport.png new file mode 100644 index 0000000..e72a97f Binary files /dev/null and b/openspec/changes/card-layouts-and-imagery/assets/cropped-viewport.png differ diff --git a/openspec/changes/card-layouts-and-imagery/design.md b/openspec/changes/card-layouts-and-imagery/design.md new file mode 100644 index 0000000..f27ceb3 --- /dev/null +++ b/openspec/changes/card-layouts-and-imagery/design.md @@ -0,0 +1,124 @@ +## Context + +The PerfectDraft Card (`src/perfectdraft-card.ts`, Lit + TypeScript, bundled via Rollup) currently renders exactly one layout: a fixed two-zone landscape view (beer label left ~25-30%, emoji keg grid right ~75%) tuned for the Sonoff NSPanel Pro 120 (1334×750). Imagery is used in a single place — a small logo in the label zone — with a first-letter-of-name fallback when no image exists. + +Asset state today: 52 of ~75 catalog beers have a keg photo. The photos are 1200×1200 PNGs totalling ~13 MB, shipped in `dist/` and downloaded wholesale by HACS, yet rendered at ~120 px. The ~23 beers without a photo render as a single grey letter on a gradient box. Copyright concern flagged in the original design is now considered settled: using a product's own image as a reference to that product is an established exception to exclusive rights. + +Constraints carried over from the original card design: CSS-driven animations only (no JS animation loops), minimal re-render path, ~50 KB JS budget (images are external assets, not bundled). NSPanel Pro 120 landscape remains the owner's primary target, but the card now has external installs on phones, tablets, and portrait panels. + +## Goals / Non-Goals + +**Goals:** +- Let users **explicitly choose** a layout via card config and the visual editor. +- Ship five layouts: `landscape` (today), `portrait`, `compact`, `hero`, `vessel`. +- Keep `landscape` the default so every existing install is byte-for-byte unchanged in behavior (non-breaking). +- Raise image coverage toward complete for currently-sold beers. +- Replace the bare-letter fallback with a tiered chain so every beer looks intentional. +- Preserve NSPanel performance: layout selection is CSS-class driven, no new animation loops. + +**Non-Goals:** +- Automatic/responsive layout switching by viewport (container queries / `ResizeObserver`). Deferred — explicit pick only this round. +- Free-form per-layout theming beyond the five presets. +- Runtime fetching or scraping of images at card load — images remain bundled static assets. +- Multi-device picker (still deferred to a later change). +- Animated emoji/SVG or video imagery. + +## Decisions + +### D1: Layout is an explicit config enum, default `landscape` +Add `layout?: "landscape" | "portrait" | "compact" | "hero" | "vessel"` to `PerfectDraftCardConfig`, defaulting to `landscape`. The editor exposes a Layout dropdown. + +**Alternatives considered:** +- *Auto-responsive via container queries / `ResizeObserver`* — "just works" but unpredictable, harder to test, and adds a JS observation path on the weak NSPanel. Rejected for now; revisit as a future `auto` value once the explicit presets are proven. +- *Separate card types (`perfectdraft-card-compact`, …)* — fragments config, editor, and the HA card picker. Rejected. + +**Rationale:** Explicit pick is predictable and keeps the default identical to today, which is what protects existing installs. + +### D2: One component, render dispatch by layout +`render()` selects a per-layout template (`_renderLandscape()`, `_renderPortrait()`, …) and sets a `layout-` class on `ha-card`. Shared sub-renderers — `_renderEmojiGrid()`, `_renderEmptyKeg()`, `_renderFreshnessIndicator()`, both dialogs, and the new fallback renderer — are reused unchanged across layouts. Layout differences are primarily CSS (zone arrangement, sizes) over the same data. + +**Rationale:** Maximizes reuse, keeps one config/editor/registration, and confines most of the work to CSS. + +### D3: The five layouts +- **`landscape`** (default): current two-zone horizontal view. Unchanged. +- **`portrait`**: stacked — label band on top (image + temp + name), emoji grid below. For phones and portrait wall panels. +- **`compact`**: a single low-height row (image thumbnail + name + temp + inline remaining indicator) for dashboards where the card is one of many. Emoji grid collapses to a compact count or mini-bar. +- **`hero`**: image-forward — the keg photo is the centerpiece/background with temperature, name, and count overlaid. Leans on image quality (see D7/D8). +- **`vessel`**: a single glass/keg vessel that fills proportionally to keg %, replacing the N-emoji grid with one calm gauge. Count shown as text. + +### D4: Layout-aware HA sizing +`getCardSize()` and `getGridOptions()` return values per layout (e.g., `compact` → 1-2 rows, `hero`/`portrait` → taller, `landscape` → today's values). This keeps masonry and sections views placing each shape sensibly. + +### D5: Tiered visual fallback +Resolve a beer's visual in priority order: +1. Keg photo (`imagePath`) +2. Brewery logo (shared asset for the beer's brewery) +3. Generated keg/glass silhouette rendered as **inline SVG**, tinted from the beer's existing `colors` palette +4. First letter of the name (final fallback) + +The generated silhouette is inline SVG: zero downloaded asset, scales crisply at any layout size, and themes from data already present. This is what guarantees "every beer looks intentional" even for seasonals, brand-new releases, and custom beers we will never have art for. + +**Alternatives considered:** keeping the bare letter (rejected — the original complaint); a single generic keg PNG (rejected — not tinted, looks identical for every unknown beer). + +### D6: Brewery logos as shared assets +Add `src/assets/breweries/.` and a brewery→logo map (plus an optional `breweryLogo`/`brewery_slug` hint on `BeerEntry`). One Leffe logo covers Leffe Ambrée/Winter/Noël; one BrewDog logo covers Punk + Elvis Juice; etc. High coverage for few assets, and tier 2 of D5. + +### D7: Image sourcing — PerfectDraft regional stores, bundled once +Source the missing keg photos from the PerfectDraft regional storefronts whose catalogs carry them (UK for BrewDog/Tiny Rebel/Fuller's/Adnams/Theakston/Thornbridge/Tennent's; DE for Diebels/Haake-Beck; ES/IT for La Virgen/Peroni; FR for Castelain Ch'ti; plus Hertog Jan Grand). Download once and commit as static assets — same approach used for the existing 52, not runtime scraping. Some beers are seasonal/discontinued and may have no store image; those rely on D5. + +### D8: Image sizing / encoding policy +Re-encode bundled keg photos to **WebP** and cap the longest edge at a hero-suitable size (target ~600-800 px) rather than shipping 1200×1200 PNGs. Small layouts downscale via CSS; `hero`/`vessel` still look sharp. This is expected to cut the ~13 MB asset payload substantially while improving the image-forward layouts. Provide a single optimized asset per beer (not multiple resolutions) to keep the pipeline simple. + +**Alternatives considered:** keep 1200 px PNG (wasteful for a card that shows one image at a time); per-beer responsive image sets (complexity not justified at this scale). + +### D9: Backward compatibility +A missing or unrecognized `layout` value resolves to `landscape`. Existing YAML and editor-produced configs keep working untouched. + +### D10: Width-tolerant emoji matrix (no enforced min-width) +The emoji matrix currently imposes an *emergent* minimum width: the flex children (`.label-zone`, `.keg-zone`) default to `min-width: auto`, and the emoji is sized to the viewport (`font-size: min(7vw, 5em)`), so on a wide window the glyphs stay ~5em and a 5-6 wide row cannot shrink below ~480px. `getGridOptions().min_columns: 2` and `min-height: 300px` reserve further space. The card therefore overflows when placed in a column narrower than ~700px. + +Confirmed in the field: `assets/cropped-viewport.png` shows a 568 mL grid (5 columns) clipped to ~3.5 columns by the viewport — and because `ha-card` sets `overflow: hidden`, the excess is cropped rather than scrollable. (The same card shows the bare-letter "S" fallback that D5 addresses.) + +The fix is CSS-only and applies across all layouts: +- Set `min-width: 0` on the flex zones so they can shrink below their content's intrinsic width. +- Size the emoji relative to the card using container-query units, e.g. `clamp(0.6em, 14cqi, 5em)`, instead of `7vw`. +- Lower `getGridOptions().min_columns` to 1 and relax `min-height` so HA *permits* narrower/shorter slots — without changing the default landscape size at normal widths. + +The grid keeps its fixed 5-6 column shape (preserving the greyed ghost-slot design) and simply shrinks to fit. + +**Alternatives considered:** +- *An explicit `max_matrix_width` knob* (the original framing) — not the *primary* fix (the real defect is a too-rigid *minimum*, not a missing *maximum*), but added as an additive option in D11 since explicit knobs are welcome. +- *Pure `vw`/`em` sizing* — rejected; it tracks the window, not the card. +- *Column reflow via `auto-fit`* — more tolerant but shifts slot positions as width changes; superseded by the explicit `matrix_columns` knob (D11), which gives the same control without surprising slot movement. +- *`ResizeObserver` setting a `--emoji-size` var* — kept only as a fallback if container-query units prove unavailable on the NSPanel WebView (it fires on resize, not as an animation loop, so it respects the performance rule). + +### D11: Explicit emoji-matrix display options +Community preference (HA/modding) favors explicit knobs over magic, so the matrix exposes two optional, layout-independent options: +- `matrix_columns`: `"auto"` (default — the existing 5/6 heuristic, now width-tolerant per D10) or a fixed integer to force a column count. Rows wrap to hold the full-keg slot count. +- `max_matrix_width`: an optional CSS length (e.g., `"480px"`, `"60%"`). When set, the matrix is capped to that width and centered within the keg zone so it does not spread on ultra-wide cards. Default unset. + +This also resolves the fixed-vs-reflow question: the default stays fixed-columns-that-shrink (stable ghost slots), and anyone wanting a different shape sets `matrix_columns` explicitly instead of relying on surprising `auto-fit` reflow. + +### D12: Secondary layout details (resolved — all backward-compatible) +Parked as open questions; resolved here with defaults that never change an existing `landscape` install (each is opt-in or only engages when space-constrained): +- **`vessel` shape**: a **beer glass** that fills proportionally (reuses the D5 silhouette shape), matching the card's "glasses remaining" metaphor and the 🍺 motif. +- **`hero` treatment**: **full-bleed** beer visual (`object-fit: cover`) with a bottom gradient **scrim** carrying temperature/name/count; the resolved fallback visual fills the same frame when there is no photo. +- **`compact` indicator**: a horizontal **fill bar** sized to keg-remaining %, plus the `"N × size"` count text — no emoji grid (avoids re-introducing the width pressure D10 fixes). +- **`layout` persistence**: **config-only**. `layout`, `matrix_columns`, and `max_matrix_width` are dashboard-authoring settings, not per-session toggles, so they are not written to `localStorage` (beer and glass-size selection remain the only persisted per-device values). +- **Matrix knobs in the editor**: **yes** — exposed in an Advanced section. +- **Container-query units**: use `cqi`; if unavailable on the NSPanel WebView, fall back to the `ResizeObserver` `--emoji-size` path (tasks 2.6 / 9.6) — a verification item, not a design fork. + +## Risks / Trade-offs + +- **[Test-matrix growth]** Five layouts × empty-keg × five freshness tiers × two dialogs × long beer names is a large manual surface. → Mitigate by sharing sub-renderers (one code path to verify), shipping a layout/state checklist, and prioritizing `landscape` + `portrait` for hardware testing first. +- **[NSPanel performance]** New layouts must not regress the weak panel. → No JS-driven layout *switching*; layout is a static CSS class and width-tolerance is CSS-only (container-query units). A resize-driven `--emoji-size` var is a last-resort fallback only (fires on resize, not an animation loop). +- **[Edge content in tight layouts]** `compact` and `vessel` have little room for long names or 24-glass counts. → Define truncation/min font rules; count shown as text in `vessel`. +- **[Generated silhouette legibility]** Some palettes have light `secondary` or low contrast. → Silhouette uses `primary` fill with a derived contrasting outline/letter; verify against the existing palette set. +- **[Re-encode quality]** WebP/resize could soften hero imagery. → Pick a quality target validated on the `hero` layout; keep original downloads out of `dist/`. +- **[Coverage still imperfect]** A few discontinued beers may remain photo-less. → Acceptable; D5 makes them presentable. + +## Open Questions + +- **Final D8 numbers**: the exact max image dimension and WebP quality — set by eyeballing a re-encoded sample in the `hero` layout during implementation. + +All other previously-parked questions are resolved in **D12** with backward-compatible defaults. diff --git a/openspec/changes/card-layouts-and-imagery/proposal.md b/openspec/changes/card-layouts-and-imagery/proposal.md new file mode 100644 index 0000000..e84fea1 --- /dev/null +++ b/openspec/changes/card-layouts-and-imagery/proposal.md @@ -0,0 +1,34 @@ +## Why + +The PerfectDraft Card ships a single fixed landscape layout (built for the NSPanel Pro 120) and shows a beer's keg photo in only one small spot, falling back to a bare first letter when no photo exists. Now that other people are installing the card on phones, tablets, and portrait wall panels, one layout no longer fits everyone — and ~23 of ~75 catalog beers still render as a lonely letter. This change makes the display shape user-selectable and makes every beer look intentional, whether or not we have its photo. + +## What Changes + +- Add a `layout` config option letting users explicitly choose how the card displays, with five variants: **landscape** (current), **portrait**, **compact**, **hero**, **vessel**. +- **Default stays `landscape`** so existing installs are visually unchanged — this change is non-breaking. +- The visual card editor gains a **Layout** dropdown. +- Make the emoji matrix **width-tolerant**: it shrinks to fit narrow card placements instead of forcing a min-width wider than the available space — emoji sized relative to the card (not the viewport), flex zones allowed to shrink, and a relaxed Home Assistant placement floor. +- Add explicit **emoji-matrix display options** — `matrix_columns` (`auto` or a fixed column count) and `max_matrix_width` (cap + center the matrix on wide cards) — for the HA/modding crowd who prefer knobs over magic. +- Expand bundled keg product imagery toward full coverage of currently-sold beers, sourced from PerfectDraft regional stores (product images used as references to the product they depict). +- Introduce a **tiered visual fallback**: keg photo → brewery logo → generated keg/glass silhouette tinted with the beer's brand palette → first letter. No beer renders as a bare letter on a plain box anymore. +- Add bundled **brewery logo** assets that cover several variants of a brand at once (e.g., one Leffe logo serves every Leffe entry that lacks its own keg shot). +- Decide and apply an image **sizing/encoding** policy (design.md): hero/vessel layouts can use higher resolution, small-logo layouts cannot, and HACS download weight matters. + +## Capabilities + +### New Capabilities +- `card-layouts`: User-selectable card layout. Defines the `layout` config option, the five layout variants and their behavior, layout-aware Home Assistant sizing (`getCardSize`/`getGridOptions`), and a backward-compatible default. +- `beer-imagery`: Expanded keg product images plus a tiered visual fallback (keg photo → brewery logo → generated tinted silhouette → letter), brewery logo assets, and the image sourcing/optimization approach. + +### Modified Capabilities +- (none as delta files) New requirements are additive and build on the in-flight `card-core`, `card-config`, `beer-catalog`, and `beer-label` capabilities from the `perfectdraft-card` change. The `landscape` layout preserves today's behavior, so no existing requirement is removed or contradicted. When `perfectdraft-card` archives into `openspec/specs/`, these capabilities reconcile there. + +## Impact + +- **Config / types** (`src/types.ts`): `PerfectDraftCardConfig` gains optional `layout` (enum, default `landscape`), `matrix_columns` (`"auto"` | number), and `max_matrix_width` (CSS length). +- **Card render** (`src/perfectdraft-card.ts`): `render()` dispatches per layout; shared sub-renderers (emoji grid, freshness, dialogs) are reused; `getCardSize()`/`getGridOptions()` vary per layout. New fallback renderer (brewery logo / generated silhouette). The emoji matrix is made width-tolerant via `min-width: 0` on the flex zones, container-relative emoji sizing (replacing `min(7vw, 5em)`), and a lower `getGridOptions().min_columns`. +- **Catalog** (`src/beer-catalog.ts`): add a brewery→logo mapping and an optional `breweryLogo`/`brewery_slug` field; wire new `imagePath`s for newly sourced beers. +- **Assets**: new files under `src/assets/kegs/` (more keg photos) and a new `src/assets/breweries/` (brewery logos), copied to `dist/` by Rollup. Possible re-encode/resize pass; watch HACS download weight and keep the JS bundle out of it (~50 KB budget unaffected — images are external). +- **Editor** (`src/editor.ts`): a Layout dropdown plus an Advanced section for `matrix_columns` and `max_matrix_width`. +- **Docs / HACS**: README layout gallery + version bump; release ships the new `dist/` assets. +- **Targets**: NSPanel Pro 120 remains the primary design target; new layouts broaden phone / tablet / portrait support. Each layout enlarges the manual test matrix (empty keg × freshness tiers × dialogs × long beer names). diff --git a/openspec/changes/card-layouts-and-imagery/specs/beer-imagery/spec.md b/openspec/changes/card-layouts-and-imagery/specs/beer-imagery/spec.md new file mode 100644 index 0000000..b93d8f9 --- /dev/null +++ b/openspec/changes/card-layouts-and-imagery/specs/beer-imagery/spec.md @@ -0,0 +1,77 @@ +## ADDED Requirements + +### Requirement: Expanded keg image coverage +The built-in catalog SHALL provide keg product images for the PerfectDraft beers currently sold across the regional storefronts, closing the gap left by beers that previously had no image. + +#### Scenario: Previously-missing current beer gains an image +- **WHEN** a currently-sold catalog beer that previously had no `imagePath` is displayed +- **THEN** the card SHALL display its keg product image +- **THEN** the image SHALL be a bundled static asset, not fetched at runtime + +#### Scenario: Discontinued or unavailable beer +- **WHEN** a catalog beer has no keg image because it is seasonal, discontinued, or otherwise unavailable from any storefront +- **THEN** the card SHALL present it via the tiered visual fallback rather than a bare placeholder + +### Requirement: Tiered visual fallback +When a beer's keg photo is unavailable, the card SHALL resolve its visual through an ordered fallback chain so that no beer renders as a bare letter on a plain background. + +#### Scenario: Keg photo available +- **WHEN** a beer has a keg photo (`imagePath`, or a custom beer's `image_url`) +- **THEN** the card SHALL display the keg photo + +#### Scenario: Brewery logo fallback +- **WHEN** a beer has no keg photo but its brewery has a bundled logo +- **THEN** the card SHALL display the brewery logo + +#### Scenario: Generated silhouette fallback +- **WHEN** a beer has neither a keg photo nor a brewery logo +- **THEN** the card SHALL display a generated keg/glass silhouette tinted from the beer's brand color palette + +#### Scenario: Runtime image load failure +- **WHEN** a resolved image asset fails to load in the browser +- **THEN** the card SHALL degrade to the next tier in the chain rather than showing a broken image + +### Requirement: Generated silhouette is asset-free and palette-tinted +The generated fallback silhouette SHALL be rendered without any downloaded image asset and SHALL derive its appearance from data already present on the beer entry. + +#### Scenario: Silhouette uses brand palette +- **WHEN** the generated silhouette is shown +- **THEN** its fill SHALL be derived from the beer's `colors` palette +- **THEN** it SHALL remain legible across light and dark palettes via a contrasting outline or accent + +#### Scenario: Silhouette scales with layout +- **WHEN** the generated silhouette is shown in any layout +- **THEN** it SHALL render crisply at that layout's size (including the large `hero` and `vessel` sizes) without pixelation + +### Requirement: Brewery logo assets +The card SHALL bundle brewery logo assets that can serve as the fallback visual for multiple beers from the same brewery. + +#### Scenario: One logo covers multiple variants +- **WHEN** several catalog beers share a brewery and lack individual keg photos +- **THEN** a single bundled brewery logo SHALL be usable as the fallback visual for all of them + +#### Scenario: Brewery logo resolution +- **WHEN** a brewery logo is displayed +- **THEN** it SHALL be loaded as a bundled static asset resolved against the card's install base URL, consistent with keg image resolution + +### Requirement: Images sourced as bundled product references +Keg and brewery images SHALL be sourced once from the products' own storefront/brand imagery and committed as bundled static assets; the card SHALL NOT fetch or scrape imagery at runtime. + +#### Scenario: No runtime fetching +- **WHEN** the card renders any beer visual +- **THEN** it SHALL reference only bundled assets (or a user-provided `image_url`) and SHALL NOT perform network scraping of external storefronts + +#### Scenario: Assets copied into the distribution +- **WHEN** the card is built +- **THEN** keg images and brewery logos SHALL be copied into `dist/` alongside the card JS so HACS and manual installs receive them + +### Requirement: Optimized image encoding +Bundled keg images SHALL be encoded to keep download weight reasonable while remaining sharp in the image-forward layouts. + +#### Scenario: Optimized assets +- **WHEN** keg images are bundled +- **THEN** they SHALL be encoded in an efficient web format and capped at a dimension suitable for the largest layout, rather than shipped at full source resolution + +#### Scenario: Sharp in hero and vessel layouts +- **WHEN** a keg image is shown in the `hero` or `vessel` layout +- **THEN** it SHALL render without visible pixelation at that size diff --git a/openspec/changes/card-layouts-and-imagery/specs/card-layouts/spec.md b/openspec/changes/card-layouts-and-imagery/specs/card-layouts/spec.md new file mode 100644 index 0000000..454840b --- /dev/null +++ b/openspec/changes/card-layouts-and-imagery/specs/card-layouts/spec.md @@ -0,0 +1,150 @@ +## ADDED Requirements + +### Requirement: Layout selection via configuration +The card SHALL support a `layout` configuration option that selects one of five named layouts, defaulting to `landscape` when unset. + +#### Scenario: Layout explicitly configured +- **WHEN** the card config sets `layout` to one of `landscape`, `portrait`, `compact`, `hero`, or `vessel` +- **THEN** the card SHALL render using that layout + +#### Scenario: No layout configured +- **WHEN** the card config has no `layout` value +- **THEN** the card SHALL render using the `landscape` layout +- **THEN** the rendered result SHALL be behaviorally identical to the card prior to this change + +#### Scenario: Unrecognized layout value +- **WHEN** the card config sets `layout` to a value that is not a known layout +- **THEN** the card SHALL fall back to the `landscape` layout without throwing + +#### Scenario: Layout selectable in the visual editor +- **WHEN** the visual card editor is displayed +- **THEN** it SHALL provide a Layout control listing the five layouts +- **THEN** changing the control SHALL fire a `config-changed` event updating `layout` +- **THEN** the card preview SHALL re-render in the chosen layout + +### Requirement: Landscape layout +The card SHALL provide a `landscape` layout that preserves the existing two-zone horizontal arrangement: beer label zone on the left (~1/3) and keg emoji zone on the right (~2/3). + +#### Scenario: Landscape rendering +- **WHEN** the active layout is `landscape` +- **THEN** the label zone SHALL occupy approximately one-third of the card width on the left +- **THEN** the keg emoji zone SHALL occupy approximately two-thirds on the right +- **THEN** both zones SHALL fill the full card height + +### Requirement: Portrait layout +The card SHALL provide a `portrait` layout that stacks the beer label above the keg display for tall/narrow surfaces. + +#### Scenario: Portrait rendering +- **WHEN** the active layout is `portrait` +- **THEN** the beer label (image/fallback, temperature, name) SHALL render in an upper band +- **THEN** the keg emoji display SHALL render below it +- **THEN** content SHALL remain legible at narrow widths typical of phones and portrait wall panels + +### Requirement: Compact layout +The card SHALL provide a `compact` layout that presents keg status in a single low-height row suitable for dashboards containing many cards. + +#### Scenario: Compact rendering +- **WHEN** the active layout is `compact` +- **THEN** the card SHALL render a single horizontal row containing the beer visual, name, temperature, a horizontal fill bar sized to the keg-remaining percentage, and the count text +- **THEN** the card SHALL NOT render the full multi-row emoji grid +- **THEN** overflowing beer names SHALL be truncated rather than wrapping the row + +### Requirement: Hero layout +The card SHALL provide a `hero` layout that makes the beer visual the centerpiece with status overlaid. + +#### Scenario: Hero rendering with image +- **WHEN** the active layout is `hero` and the beer has a keg photo +- **THEN** the photo SHALL be displayed as the dominant visual element +- **THEN** the photo SHALL fill the card (cover), and temperature, beer name, and remaining count SHALL sit on a gradient scrim so they remain legible against the image + +#### Scenario: Hero rendering without image +- **WHEN** the active layout is `hero` and the beer has no keg photo +- **THEN** the card SHALL display the resolved fallback visual (brewery logo or generated silhouette) as the centerpiece + +### Requirement: Vessel layout +The card SHALL provide a `vessel` layout that represents remaining keg volume as a single proportionally-filled beer glass instead of a grid of emoji. + +#### Scenario: Vessel proportional fill +- **WHEN** the active layout is `vessel` and `keg_remaining` reports a percentage > 0 +- **THEN** the card SHALL render one beer-glass vessel filled in proportion to the keg-remaining percentage +- **THEN** the remaining glasses count and glass size SHALL be shown as text + +#### Scenario: Vessel empty keg +- **WHEN** the active layout is `vessel` and the keg is empty (0%) +- **THEN** the vessel SHALL render visibly empty +- **THEN** the card SHALL communicate the empty state consistently with other layouts + +### Requirement: Consistent behavior across layouts +All layouts SHALL share the same data, interactions, and warning behavior; only the visual arrangement differs. + +#### Scenario: Interactions available in every layout +- **WHEN** any layout is active +- **THEN** the user SHALL be able to open the beer selection dialog and the glass size selection dialog from the card +- **THEN** selecting a beer or glass size SHALL update the display and persist exactly as in the landscape layout + +#### Scenario: Freshness warnings in every layout +- **WHEN** the keg freshness tier is `warning` or worse +- **THEN** the active layout SHALL surface the freshness indicator and the card-level freshness styling +- **THEN** freshness animations SHALL remain CSS-driven with no added JavaScript animation loop + +#### Scenario: Glasses calculation is layout-independent +- **WHEN** the layout changes +- **THEN** the remaining-glasses value SHALL be computed identically (`floor((keg_remaining% / 100 × 6000) / glass_size_mL)`) regardless of layout + +### Requirement: Layout-aware card sizing +The card SHALL report sizing to Home Assistant layout engines appropriate to the active layout. + +#### Scenario: Sizing reflects layout +- **WHEN** `getCardSize()` or `getGridOptions()` is called +- **THEN** the returned values SHALL reflect the active layout (e.g., `compact` reports a short height; `hero` and `portrait` report taller placements; `landscape` reports its existing values) + +### Requirement: Width-tolerant emoji matrix +The emoji matrix SHALL shrink to fit the available card width without overflowing, and SHALL NOT impose a minimum width wider than its container. + +#### Scenario: Narrow placement +- **WHEN** the card is placed in a container narrower than its natural content width (e.g., a narrow dashboard column, or a phone in a multi-column view) +- **THEN** the label and keg zones SHALL shrink to fit +- **THEN** the emoji matrix SHALL remain fully visible without horizontal overflow or clipping + +#### Scenario: Emoji size tracks the card, not the viewport +- **WHEN** the card is narrow while the browser viewport is wide +- **THEN** the emoji SHALL be sized relative to the card's own width +- **THEN** the emoji SHALL become smaller as the card narrows rather than retaining a fixed viewport-derived size + +#### Scenario: Placement floor allows narrow slots +- **WHEN** Home Assistant queries the card's grid options for placement +- **THEN** the card SHALL permit placement in a single grid column and SHALL NOT require a minimum of two columns + +#### Scenario: Fixed slot shape preserved +- **WHEN** the matrix shrinks to fit a narrow card +- **THEN** the full-keg slot count and the greyed empty/ghost slots SHALL remain in their fixed grid positions (the grid shrinks to fit rather than changing its column count) + +### Requirement: Emoji matrix display options +The card SHALL provide optional configuration to control the emoji matrix's column count and maximum width, independent of the selected layout. + +#### Scenario: Default column behavior +- **WHEN** `matrix_columns` is unset or set to `auto` +- **THEN** the card SHALL choose the column count automatically using its built-in heuristic +- **THEN** the matrix SHALL remain width-tolerant + +#### Scenario: Explicit column count +- **WHEN** `matrix_columns` is set to a positive integer N +- **THEN** the matrix SHALL render N columns, wrapping the full-keg slot count across as many rows as needed + +#### Scenario: Maximum matrix width +- **WHEN** `max_matrix_width` is set to a CSS length +- **THEN** the matrix SHALL NOT exceed that width +- **THEN** the matrix SHALL be centered within the keg zone + +#### Scenario: No maximum width configured +- **WHEN** `max_matrix_width` is unset +- **THEN** the matrix SHALL fill the available zone width, subject to the width-tolerant behavior + +#### Scenario: Invalid option values +- **WHEN** `matrix_columns` or `max_matrix_width` has a malformed value +- **THEN** the card SHALL ignore the malformed option and fall back to its default (auto columns / no maximum width) without throwing + +#### Scenario: Matrix options in the editor +- **WHEN** the visual card editor is displayed +- **THEN** it SHALL provide controls for `matrix_columns` and `max_matrix_width` +- **THEN** changing either control SHALL fire a `config-changed` event and update the card preview diff --git a/openspec/changes/card-layouts-and-imagery/tasks.md b/openspec/changes/card-layouts-and-imagery/tasks.md new file mode 100644 index 0000000..540cdd0 --- /dev/null +++ b/openspec/changes/card-layouts-and-imagery/tasks.md @@ -0,0 +1,68 @@ +## 1. Config and types + +- [x] 1.1 Add `layout?: "landscape" | "portrait" | "compact" | "hero" | "vessel"` to `PerfectDraftCardConfig` in `src/types.ts` +- [x] 1.2 In `setConfig()`, resolve the active layout: use `config.layout` when valid, otherwise default to `landscape` (unrecognized values fall back without throwing) +- [x] 1.3 Add a `LAYOUTS` constant (value + label) in `src/const.ts` for use by the card and editor +- [x] 1.4 Update `getStubConfig()` so new cards default to (or omit) `layout: landscape` +- [x] 1.5 Add optional `matrix_columns` (`"auto"` | positive integer) and `max_matrix_width` (CSS length string) to `PerfectDraftCardConfig`; validate and ignore malformed values (fall back to `auto` / unset) + +## 2. Render dispatch and shared scaffolding + +- [x] 2.1 Set a `layout-` class on the `ha-card` root and have `render()` dispatch to a per-layout template method +- [x] 2.2 Extract the current markup into `_renderLandscape()` with no behavioral change (verify visual parity with today) +- [x] 2.3 Confirm `_renderEmojiGrid()`, `_renderEmptyKeg()`, `_renderFreshnessIndicator()`, `_renderGlassDialog()`, and `_renderBeerDialog()` are reused unchanged across layouts +- [x] 2.4 Ensure both dialogs are reachable in every layout (beer dialog + glass size dialog tap targets defined per layout) +- [x] 2.5 Make the keg/label flex zones width-tolerant: add `min-width: 0` so they can shrink below their content width +- [x] 2.6 Replace the viewport-relative emoji size (`min(7vw, 5em)`) with a card-relative size using container-query units (e.g., `clamp(0.6em, 14cqi, 5em)`); establish the container context on the card/keg zone (with a `ResizeObserver` `--emoji-size` fallback if `cqi` is unsupported on the NSPanel WebView) +- [x] 2.7 Support the matrix display options in `_renderEmojiGrid()`: honor an explicit `matrix_columns` count (else keep the auto 5/6 heuristic), and apply `max_matrix_width` as a `max-width` + centering on the grid container + +## 3. Tiered visual fallback + +- [x] 3.1 Add a brewery→logo mapping and an optional `breweryLogo`/`brewery_slug` field on `BeerEntry` in `src/beer-catalog.ts` +- [x] 3.2 Implement a `resolveBeerVisual(beer)` helper returning the chosen tier: keg photo → brewery logo → generated silhouette → letter +- [x] 3.3 Implement the generated keg/glass silhouette as inline SVG tinted from `beer.colors`, with a contrasting outline/accent for low-contrast palettes +- [x] 3.4 Replace the label-zone image block with the tiered resolver; on `` error, degrade to the next tier instead of showing a broken image +- [x] 3.5 Verify custom beers (no image, default palette) resolve to a tinted silhouette rather than a bare letter + +## 4. Layout implementations + +- [x] 4.1 `portrait`: stacked label band over keg grid; legible at narrow widths +- [x] 4.2 `compact`: single low-height row (visual + name + temp + remaining indicator); truncate long names; no full grid +- [x] 4.3 `hero`: beer visual as centerpiece/background with overlaid temp/name/count; uses the tiered visual when no photo +- [x] 4.4 `vessel`: single proportionally-filled glass/keg gauge (CSS fill from keg %); count shown as text; visible empty state +- [x] 4.5 Verify freshness styling/indicator and empty-keg state render correctly in each new layout + +## 5. Layout-aware sizing + +- [x] 5.1 Make `getCardSize()` return a per-layout value (compact short; hero/portrait taller; landscape unchanged) +- [x] 5.2 Make `getGridOptions()` return per-layout columns/rows/min sizes +- [x] 5.3 Relax the placement floor: lower `getGridOptions().min_columns` to 1 and revisit `.card-content` `min-height` so HA offers narrow/short slots + +## 6. Imagery sourcing and assets + +- [x] 6.1 Source missing keg photos from the regional PerfectDraft storefronts per design D7 (UK: BrewDog Punk/Elvis, Tiny Rebel, Fuller's, Adnams, Theakston, Thornbridge, Tennent's; DE: Diebels, Haake-Beck; ES/IT: La Virgen, Peroni; FR: Castelain Ch'ti; NL: Hertog Jan Grand) +- [x] 6.2 Add sourced keg photos to `src/assets/kegs/` and wire `imagePath: kegImage(slug)` for each newly covered beer +- [x] 6.3 Create `src/assets/breweries/` and add brewery logos covering variant-heavy brands without keg shots (e.g., Leffe seasonals, Gulden Draak, Bud/Bud Light, Goose Island Hazy, Stella Unfiltered) +- [x] 6.4 Note in the catalog which beers remain photo-less by design (seasonal/discontinued) so they intentionally use the silhouette + +## 7. Image optimization pipeline + +- [x] 7.1 Re-encode bundled keg images to WebP and cap the longest edge per design D8 (target ~600-800px); pick a quality validated in the `hero` layout +- [x] 7.2 Update `kegImage()`/paths and `rollup.config.mjs` copy globs for the new format/locations (kegs + breweries) +- [x] 7.3 Verify `dist/` contains the optimized kegs and brewery logos after build and that total asset weight dropped versus the 1200px PNG set + +## 8. Editor and documentation + +- [x] 8.1 Add a Layout dropdown to `src/editor.ts` bound to `layout`, firing `config-changed`; bump the editor version marker +- [x] 8.2 Add an Advanced editor section exposing `matrix_columns` and `max_matrix_width`, firing `config-changed` +- [x] 8.3 Update `README.md` with a layout gallery/screenshots and a `layout` / matrix-options YAML reference; note `landscape` is the default +- [x] 8.4 Bump `CARD_VERSION`/`EDITOR_VERSION` and `package.json` version for the release + +## 9. Build and verification + +- [x] 9.1 Build and confirm the JS bundle stays within budget (images excluded) and there are no console errors +- [x] 9.2 Walk the manual test matrix: each of the 5 layouts × {normal, near-empty, empty} × {normal + each freshness tier} × long beer name × both dialogs +- [x] 9.3 Verify backward compatibility: an existing config with no `layout` renders identically to the pre-change landscape card +- [ ] 9.4 Test `landscape` and `portrait` on the NSPanel Pro 120 first (primary target), then spot-check the others +- [x] 9.5 Cut a release with the new `dist/` assets and update HACS notes +- [x] 9.6 Verify width tolerance: place the card in a narrow column on a wide viewport and confirm no overflow/clipping, emoji shrink with the card, and ghost slots stay fixed; confirm `cqi` works on the NSPanel WebView (else wire the `--emoji-size` fallback) diff --git a/package.json b/package.json index baa2a6a..867e6c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perfectdraft-card", - "version": "0.1.6", + "version": "0.2.0", "description": "Custom Lovelace card for the PerfectDraft Pro Home Assistant integration", "main": "dist/perfectdraft-card.js", "type": "module", diff --git a/src/assets/kegs/anoesteke.png b/src/assets/kegs/anoesteke.png deleted file mode 100644 index d4024ed..0000000 Binary files a/src/assets/kegs/anoesteke.png and /dev/null differ diff --git a/src/assets/kegs/anoesteke.webp b/src/assets/kegs/anoesteke.webp new file mode 100644 index 0000000..5cc972a Binary files /dev/null and b/src/assets/kegs/anoesteke.webp differ diff --git a/src/assets/kegs/becks-gold.png b/src/assets/kegs/becks-gold.png deleted file mode 100644 index a2fb094..0000000 Binary files a/src/assets/kegs/becks-gold.png and /dev/null differ diff --git a/src/assets/kegs/becks-gold.webp b/src/assets/kegs/becks-gold.webp new file mode 100644 index 0000000..5d353cd Binary files /dev/null and b/src/assets/kegs/becks-gold.webp differ diff --git a/src/assets/kegs/becks.png b/src/assets/kegs/becks.png deleted file mode 100644 index cd4a5c1..0000000 Binary files a/src/assets/kegs/becks.png and /dev/null differ diff --git a/src/assets/kegs/becks.webp b/src/assets/kegs/becks.webp new file mode 100644 index 0000000..7adb172 Binary files /dev/null and b/src/assets/kegs/becks.webp differ diff --git a/src/assets/kegs/brewdog-elvis-juice.webp b/src/assets/kegs/brewdog-elvis-juice.webp new file mode 100644 index 0000000..0f12599 Binary files /dev/null and b/src/assets/kegs/brewdog-elvis-juice.webp differ diff --git a/src/assets/kegs/brewdog-punk-ipa.webp b/src/assets/kegs/brewdog-punk-ipa.webp new file mode 100644 index 0000000..9598639 Binary files /dev/null and b/src/assets/kegs/brewdog-punk-ipa.webp differ diff --git a/src/assets/kegs/bud-light.webp b/src/assets/kegs/bud-light.webp new file mode 100644 index 0000000..8477f0d Binary files /dev/null and b/src/assets/kegs/bud-light.webp differ diff --git a/src/assets/kegs/bud.png b/src/assets/kegs/bud.png deleted file mode 100644 index c051d1d..0000000 Binary files a/src/assets/kegs/bud.png and /dev/null differ diff --git a/src/assets/kegs/bud.webp b/src/assets/kegs/bud.webp new file mode 100644 index 0000000..c009610 Binary files /dev/null and b/src/assets/kegs/bud.webp differ diff --git a/src/assets/kegs/camden-eazy.png b/src/assets/kegs/camden-eazy.png deleted file mode 100644 index a2d8684..0000000 Binary files a/src/assets/kegs/camden-eazy.png and /dev/null differ diff --git a/src/assets/kegs/camden-eazy.webp b/src/assets/kegs/camden-eazy.webp new file mode 100644 index 0000000..488e995 Binary files /dev/null and b/src/assets/kegs/camden-eazy.webp differ diff --git a/src/assets/kegs/camden-hells.png b/src/assets/kegs/camden-hells.png deleted file mode 100644 index 5052cbd..0000000 Binary files a/src/assets/kegs/camden-hells.png and /dev/null differ diff --git a/src/assets/kegs/camden-hells.webp b/src/assets/kegs/camden-hells.webp new file mode 100644 index 0000000..29e54fe Binary files /dev/null and b/src/assets/kegs/camden-hells.webp differ diff --git a/src/assets/kegs/camden-ipa.png b/src/assets/kegs/camden-ipa.png deleted file mode 100644 index d4aa6bd..0000000 Binary files a/src/assets/kegs/camden-ipa.png and /dev/null differ diff --git a/src/assets/kegs/camden-ipa.webp b/src/assets/kegs/camden-ipa.webp new file mode 100644 index 0000000..62bfb3c Binary files /dev/null and b/src/assets/kegs/camden-ipa.webp differ diff --git a/src/assets/kegs/camden-pale.png b/src/assets/kegs/camden-pale.png deleted file mode 100644 index a31be50..0000000 Binary files a/src/assets/kegs/camden-pale.png and /dev/null differ diff --git a/src/assets/kegs/camden-pale.webp b/src/assets/kegs/camden-pale.webp new file mode 100644 index 0000000..e9516b7 Binary files /dev/null and b/src/assets/kegs/camden-pale.webp differ diff --git a/src/assets/kegs/castelain-chti.webp b/src/assets/kegs/castelain-chti.webp new file mode 100644 index 0000000..65ca7f1 Binary files /dev/null and b/src/assets/kegs/castelain-chti.webp differ diff --git a/src/assets/kegs/castelain.png b/src/assets/kegs/castelain.png deleted file mode 100644 index d9b66f8..0000000 Binary files a/src/assets/kegs/castelain.png and /dev/null differ diff --git a/src/assets/kegs/castelain.webp b/src/assets/kegs/castelain.webp new file mode 100644 index 0000000..e89216b Binary files /dev/null and b/src/assets/kegs/castelain.webp differ diff --git a/src/assets/kegs/corona-cero.png b/src/assets/kegs/corona-cero.png deleted file mode 100644 index 9630d2d..0000000 Binary files a/src/assets/kegs/corona-cero.png and /dev/null differ diff --git a/src/assets/kegs/corona-cero.webp b/src/assets/kegs/corona-cero.webp new file mode 100644 index 0000000..0482198 Binary files /dev/null and b/src/assets/kegs/corona-cero.webp differ diff --git a/src/assets/kegs/corona.png b/src/assets/kegs/corona.png deleted file mode 100644 index 6f72c34..0000000 Binary files a/src/assets/kegs/corona.png and /dev/null differ diff --git a/src/assets/kegs/corona.webp b/src/assets/kegs/corona.webp new file mode 100644 index 0000000..2096b02 Binary files /dev/null and b/src/assets/kegs/corona.webp differ diff --git a/src/assets/kegs/diebels.webp b/src/assets/kegs/diebels.webp new file mode 100644 index 0000000..4c2e7f2 Binary files /dev/null and b/src/assets/kegs/diebels.webp differ diff --git a/src/assets/kegs/dupont.png b/src/assets/kegs/dupont.png deleted file mode 100644 index 40d6004..0000000 Binary files a/src/assets/kegs/dupont.png and /dev/null differ diff --git a/src/assets/kegs/dupont.webp b/src/assets/kegs/dupont.webp new file mode 100644 index 0000000..d03c0cc Binary files /dev/null and b/src/assets/kegs/dupont.webp differ diff --git a/src/assets/kegs/franziskaner-kellerbier.png b/src/assets/kegs/franziskaner-kellerbier.png deleted file mode 100644 index 678a8a1..0000000 Binary files a/src/assets/kegs/franziskaner-kellerbier.png and /dev/null differ diff --git a/src/assets/kegs/franziskaner-kellerbier.webp b/src/assets/kegs/franziskaner-kellerbier.webp new file mode 100644 index 0000000..b1d3d84 Binary files /dev/null and b/src/assets/kegs/franziskaner-kellerbier.webp differ diff --git a/src/assets/kegs/franziskaner-royal.png b/src/assets/kegs/franziskaner-royal.png deleted file mode 100644 index 1946255..0000000 Binary files a/src/assets/kegs/franziskaner-royal.png and /dev/null differ diff --git a/src/assets/kegs/franziskaner-royal.webp b/src/assets/kegs/franziskaner-royal.webp new file mode 100644 index 0000000..4af89e4 Binary files /dev/null and b/src/assets/kegs/franziskaner-royal.webp differ diff --git a/src/assets/kegs/franziskaner.png b/src/assets/kegs/franziskaner.png deleted file mode 100644 index 5d99dff..0000000 Binary files a/src/assets/kegs/franziskaner.png and /dev/null differ diff --git a/src/assets/kegs/franziskaner.webp b/src/assets/kegs/franziskaner.webp new file mode 100644 index 0000000..a99ff2d Binary files /dev/null and b/src/assets/kegs/franziskaner.webp differ diff --git a/src/assets/kegs/fruh-kolsch.png b/src/assets/kegs/fruh-kolsch.png deleted file mode 100644 index 8dba961..0000000 Binary files a/src/assets/kegs/fruh-kolsch.png and /dev/null differ diff --git a/src/assets/kegs/fruh-kolsch.webp b/src/assets/kegs/fruh-kolsch.webp new file mode 100644 index 0000000..c0a2c52 Binary files /dev/null and b/src/assets/kegs/fruh-kolsch.webp differ diff --git a/src/assets/kegs/fullers-london-pride.webp b/src/assets/kegs/fullers-london-pride.webp new file mode 100644 index 0000000..d40fbbc Binary files /dev/null and b/src/assets/kegs/fullers-london-pride.webp differ diff --git a/src/assets/kegs/goose-island-ipa.png b/src/assets/kegs/goose-island-ipa.png deleted file mode 100644 index eff2422..0000000 Binary files a/src/assets/kegs/goose-island-ipa.png and /dev/null differ diff --git a/src/assets/kegs/goose-island-ipa.webp b/src/assets/kegs/goose-island-ipa.webp new file mode 100644 index 0000000..93f20c4 Binary files /dev/null and b/src/assets/kegs/goose-island-ipa.webp differ diff --git a/src/assets/kegs/goose-midway.png b/src/assets/kegs/goose-midway.png deleted file mode 100644 index 96b156e..0000000 Binary files a/src/assets/kegs/goose-midway.png and /dev/null differ diff --git a/src/assets/kegs/goose-midway.webp b/src/assets/kegs/goose-midway.webp new file mode 100644 index 0000000..252c2cb Binary files /dev/null and b/src/assets/kegs/goose-midway.webp differ diff --git a/src/assets/kegs/haake-beck.webp b/src/assets/kegs/haake-beck.webp new file mode 100644 index 0000000..7ccfb92 Binary files /dev/null and b/src/assets/kegs/haake-beck.webp differ diff --git a/src/assets/kegs/hasseroder.png b/src/assets/kegs/hasseroder.png deleted file mode 100644 index 6c10214..0000000 Binary files a/src/assets/kegs/hasseroder.png and /dev/null differ diff --git a/src/assets/kegs/hasseroder.webp b/src/assets/kegs/hasseroder.webp new file mode 100644 index 0000000..5285c06 Binary files /dev/null and b/src/assets/kegs/hasseroder.webp differ diff --git a/src/assets/kegs/hertog-jan-grand.webp b/src/assets/kegs/hertog-jan-grand.webp new file mode 100644 index 0000000..56e1b24 Binary files /dev/null and b/src/assets/kegs/hertog-jan-grand.webp differ diff --git a/src/assets/kegs/hertog-jan.png b/src/assets/kegs/hertog-jan.png deleted file mode 100644 index e95f18c..0000000 Binary files a/src/assets/kegs/hertog-jan.png and /dev/null differ diff --git a/src/assets/kegs/hertog-jan.webp b/src/assets/kegs/hertog-jan.webp new file mode 100644 index 0000000..f038998 Binary files /dev/null and b/src/assets/kegs/hertog-jan.webp differ diff --git a/src/assets/kegs/hoegaarden-rosee.png b/src/assets/kegs/hoegaarden-rosee.png deleted file mode 100644 index f3bf440..0000000 Binary files a/src/assets/kegs/hoegaarden-rosee.png and /dev/null differ diff --git a/src/assets/kegs/hoegaarden-rosee.webp b/src/assets/kegs/hoegaarden-rosee.webp new file mode 100644 index 0000000..dd97d44 Binary files /dev/null and b/src/assets/kegs/hoegaarden-rosee.webp differ diff --git a/src/assets/kegs/hoegaarden.png b/src/assets/kegs/hoegaarden.png deleted file mode 100644 index b936351..0000000 Binary files a/src/assets/kegs/hoegaarden.png and /dev/null differ diff --git a/src/assets/kegs/hoegaarden.webp b/src/assets/kegs/hoegaarden.webp new file mode 100644 index 0000000..8a4f925 Binary files /dev/null and b/src/assets/kegs/hoegaarden.webp differ diff --git a/src/assets/kegs/jupiler.png b/src/assets/kegs/jupiler.png deleted file mode 100644 index f9ef494..0000000 Binary files a/src/assets/kegs/jupiler.png and /dev/null differ diff --git a/src/assets/kegs/jupiler.webp b/src/assets/kegs/jupiler.webp new file mode 100644 index 0000000..95818c0 Binary files /dev/null and b/src/assets/kegs/jupiler.webp differ diff --git a/src/assets/kegs/kwak-blonde.png b/src/assets/kegs/kwak-blonde.png deleted file mode 100644 index ce69ab8..0000000 Binary files a/src/assets/kegs/kwak-blonde.png and /dev/null differ diff --git a/src/assets/kegs/kwak-blonde.webp b/src/assets/kegs/kwak-blonde.webp new file mode 100644 index 0000000..5d9b15c Binary files /dev/null and b/src/assets/kegs/kwak-blonde.webp differ diff --git a/src/assets/kegs/kwak.png b/src/assets/kegs/kwak.png deleted file mode 100644 index 9753803..0000000 Binary files a/src/assets/kegs/kwak.png and /dev/null differ diff --git a/src/assets/kegs/kwak.webp b/src/assets/kegs/kwak.webp new file mode 100644 index 0000000..85f6a44 Binary files /dev/null and b/src/assets/kegs/kwak.webp differ diff --git a/src/assets/kegs/la-virgen.webp b/src/assets/kegs/la-virgen.webp new file mode 100644 index 0000000..751c42d Binary files /dev/null and b/src/assets/kegs/la-virgen.webp differ diff --git a/src/assets/kegs/leffe-0.png b/src/assets/kegs/leffe-0.png deleted file mode 100644 index 21850a1..0000000 Binary files a/src/assets/kegs/leffe-0.png and /dev/null differ diff --git a/src/assets/kegs/leffe-0.webp b/src/assets/kegs/leffe-0.webp new file mode 100644 index 0000000..b4bbb8a Binary files /dev/null and b/src/assets/kegs/leffe-0.webp differ diff --git a/src/assets/kegs/leffe-amber.webp b/src/assets/kegs/leffe-amber.webp new file mode 100644 index 0000000..ee8a448 Binary files /dev/null and b/src/assets/kegs/leffe-amber.webp differ diff --git a/src/assets/kegs/leffe-blanche.png b/src/assets/kegs/leffe-blanche.png deleted file mode 100644 index 6dc2cb6..0000000 Binary files a/src/assets/kegs/leffe-blanche.png and /dev/null differ diff --git a/src/assets/kegs/leffe-blanche.webp b/src/assets/kegs/leffe-blanche.webp new file mode 100644 index 0000000..eca4598 Binary files /dev/null and b/src/assets/kegs/leffe-blanche.webp differ diff --git a/src/assets/kegs/leffe-blonde.png b/src/assets/kegs/leffe-blonde.png deleted file mode 100644 index 0db5382..0000000 Binary files a/src/assets/kegs/leffe-blonde.png and /dev/null differ diff --git a/src/assets/kegs/leffe-blonde.webp b/src/assets/kegs/leffe-blonde.webp new file mode 100644 index 0000000..cfb17d4 Binary files /dev/null and b/src/assets/kegs/leffe-blonde.webp differ diff --git a/src/assets/kegs/leffe-brune.png b/src/assets/kegs/leffe-brune.png deleted file mode 100644 index 144dda7..0000000 Binary files a/src/assets/kegs/leffe-brune.png and /dev/null differ diff --git a/src/assets/kegs/leffe-brune.webp b/src/assets/kegs/leffe-brune.webp new file mode 100644 index 0000000..b389202 Binary files /dev/null and b/src/assets/kegs/leffe-brune.webp differ diff --git a/src/assets/kegs/leffe-dete.png b/src/assets/kegs/leffe-dete.png deleted file mode 100644 index 9f9a559..0000000 Binary files a/src/assets/kegs/leffe-dete.png and /dev/null differ diff --git a/src/assets/kegs/leffe-dete.webp b/src/assets/kegs/leffe-dete.webp new file mode 100644 index 0000000..026b977 Binary files /dev/null and b/src/assets/kegs/leffe-dete.webp differ diff --git a/src/assets/kegs/leffe-prestige.png b/src/assets/kegs/leffe-prestige.png deleted file mode 100644 index 1fc0d09..0000000 Binary files a/src/assets/kegs/leffe-prestige.png and /dev/null differ diff --git a/src/assets/kegs/leffe-prestige.webp b/src/assets/kegs/leffe-prestige.webp new file mode 100644 index 0000000..93dd0dc Binary files /dev/null and b/src/assets/kegs/leffe-prestige.webp differ diff --git a/src/assets/kegs/leffe-rituel.png b/src/assets/kegs/leffe-rituel.png deleted file mode 100644 index 946b3ad..0000000 Binary files a/src/assets/kegs/leffe-rituel.png and /dev/null differ diff --git a/src/assets/kegs/leffe-rituel.webp b/src/assets/kegs/leffe-rituel.webp new file mode 100644 index 0000000..a5d2e07 Binary files /dev/null and b/src/assets/kegs/leffe-rituel.webp differ diff --git a/src/assets/kegs/leffe-ruby.png b/src/assets/kegs/leffe-ruby.png deleted file mode 100644 index b37f1af..0000000 Binary files a/src/assets/kegs/leffe-ruby.png and /dev/null differ diff --git a/src/assets/kegs/leffe-ruby.webp b/src/assets/kegs/leffe-ruby.webp new file mode 100644 index 0000000..4050a06 Binary files /dev/null and b/src/assets/kegs/leffe-ruby.webp differ diff --git a/src/assets/kegs/lowenbrau.png b/src/assets/kegs/lowenbrau.png deleted file mode 100644 index 0b271dc..0000000 Binary files a/src/assets/kegs/lowenbrau.png and /dev/null differ diff --git a/src/assets/kegs/lowenbrau.webp b/src/assets/kegs/lowenbrau.webp new file mode 100644 index 0000000..d2c827a Binary files /dev/null and b/src/assets/kegs/lowenbrau.webp differ diff --git a/src/assets/kegs/meteor.png b/src/assets/kegs/meteor.png deleted file mode 100644 index 85704c4..0000000 Binary files a/src/assets/kegs/meteor.png and /dev/null differ diff --git a/src/assets/kegs/meteor.webp b/src/assets/kegs/meteor.webp new file mode 100644 index 0000000..16cc49c Binary files /dev/null and b/src/assets/kegs/meteor.webp differ diff --git a/src/assets/kegs/ninkasi.png b/src/assets/kegs/ninkasi.png deleted file mode 100644 index de30d4a..0000000 Binary files a/src/assets/kegs/ninkasi.png and /dev/null differ diff --git a/src/assets/kegs/ninkasi.webp b/src/assets/kegs/ninkasi.webp new file mode 100644 index 0000000..a6327b3 Binary files /dev/null and b/src/assets/kegs/ninkasi.webp differ diff --git a/src/assets/kegs/northern-monk.png b/src/assets/kegs/northern-monk.png deleted file mode 100644 index 1d8f80a..0000000 Binary files a/src/assets/kegs/northern-monk.png and /dev/null differ diff --git a/src/assets/kegs/northern-monk.webp b/src/assets/kegs/northern-monk.webp new file mode 100644 index 0000000..98d0a5c Binary files /dev/null and b/src/assets/kegs/northern-monk.webp differ diff --git a/src/assets/kegs/old-peculier.webp b/src/assets/kegs/old-peculier.webp new file mode 100644 index 0000000..6cd7c10 Binary files /dev/null and b/src/assets/kegs/old-peculier.webp differ diff --git a/src/assets/kegs/old-speckled-hen.png b/src/assets/kegs/old-speckled-hen.png deleted file mode 100644 index 8ae05bc..0000000 Binary files a/src/assets/kegs/old-speckled-hen.png and /dev/null differ diff --git a/src/assets/kegs/old-speckled-hen.webp b/src/assets/kegs/old-speckled-hen.webp new file mode 100644 index 0000000..718129b Binary files /dev/null and b/src/assets/kegs/old-speckled-hen.webp differ diff --git a/src/assets/kegs/peroni.webp b/src/assets/kegs/peroni.webp new file mode 100644 index 0000000..74eff99 Binary files /dev/null and b/src/assets/kegs/peroni.webp differ diff --git a/src/assets/kegs/rousse-mont-blanc.png b/src/assets/kegs/rousse-mont-blanc.png deleted file mode 100644 index 700644b..0000000 Binary files a/src/assets/kegs/rousse-mont-blanc.png and /dev/null differ diff --git a/src/assets/kegs/rousse-mont-blanc.webp b/src/assets/kegs/rousse-mont-blanc.webp new file mode 100644 index 0000000..a378af0 Binary files /dev/null and b/src/assets/kegs/rousse-mont-blanc.webp differ diff --git a/src/assets/kegs/saint-feuillien.png b/src/assets/kegs/saint-feuillien.png deleted file mode 100644 index 0db5a42..0000000 Binary files a/src/assets/kegs/saint-feuillien.png and /dev/null differ diff --git a/src/assets/kegs/saint-feuillien.webp b/src/assets/kegs/saint-feuillien.webp new file mode 100644 index 0000000..7af6876 Binary files /dev/null and b/src/assets/kegs/saint-feuillien.webp differ diff --git a/src/assets/kegs/samson.png b/src/assets/kegs/samson.png deleted file mode 100644 index 7d4292a..0000000 Binary files a/src/assets/kegs/samson.png and /dev/null differ diff --git a/src/assets/kegs/samson.webp b/src/assets/kegs/samson.webp new file mode 100644 index 0000000..a1a25e0 Binary files /dev/null and b/src/assets/kegs/samson.webp differ diff --git a/src/assets/kegs/san-miguel.png b/src/assets/kegs/san-miguel.png deleted file mode 100644 index ce6b29e..0000000 Binary files a/src/assets/kegs/san-miguel.png and /dev/null differ diff --git a/src/assets/kegs/san-miguel.webp b/src/assets/kegs/san-miguel.webp new file mode 100644 index 0000000..dc5bdf5 Binary files /dev/null and b/src/assets/kegs/san-miguel.webp differ diff --git a/src/assets/kegs/schneider.png b/src/assets/kegs/schneider.png deleted file mode 100644 index 6c6ca91..0000000 Binary files a/src/assets/kegs/schneider.png and /dev/null differ diff --git a/src/assets/kegs/schneider.webp b/src/assets/kegs/schneider.webp new file mode 100644 index 0000000..feac851 Binary files /dev/null and b/src/assets/kegs/schneider.webp differ diff --git a/src/assets/kegs/spaten.png b/src/assets/kegs/spaten.png deleted file mode 100644 index 82c66df..0000000 Binary files a/src/assets/kegs/spaten.png and /dev/null differ diff --git a/src/assets/kegs/spaten.webp b/src/assets/kegs/spaten.webp new file mode 100644 index 0000000..c17d21d Binary files /dev/null and b/src/assets/kegs/spaten.webp differ diff --git a/src/assets/kegs/st-austell.png b/src/assets/kegs/st-austell.png deleted file mode 100644 index d08852d..0000000 Binary files a/src/assets/kegs/st-austell.png and /dev/null differ diff --git a/src/assets/kegs/st-austell.webp b/src/assets/kegs/st-austell.webp new file mode 100644 index 0000000..a9f14fe Binary files /dev/null and b/src/assets/kegs/st-austell.webp differ diff --git a/src/assets/kegs/stella-artois-0.png b/src/assets/kegs/stella-artois-0.png deleted file mode 100644 index a935732..0000000 Binary files a/src/assets/kegs/stella-artois-0.png and /dev/null differ diff --git a/src/assets/kegs/stella-artois-0.webp b/src/assets/kegs/stella-artois-0.webp new file mode 100644 index 0000000..3c6d83b Binary files /dev/null and b/src/assets/kegs/stella-artois-0.webp differ diff --git a/src/assets/kegs/stella-artois-unfiltered.webp b/src/assets/kegs/stella-artois-unfiltered.webp new file mode 100644 index 0000000..e29fe44 Binary files /dev/null and b/src/assets/kegs/stella-artois-unfiltered.webp differ diff --git a/src/assets/kegs/stella-artois.png b/src/assets/kegs/stella-artois.png deleted file mode 100644 index 42692b6..0000000 Binary files a/src/assets/kegs/stella-artois.png and /dev/null differ diff --git a/src/assets/kegs/stella-artois.webp b/src/assets/kegs/stella-artois.webp new file mode 100644 index 0000000..502b26b Binary files /dev/null and b/src/assets/kegs/stella-artois.webp differ diff --git a/src/assets/kegs/tennents.webp b/src/assets/kegs/tennents.webp new file mode 100644 index 0000000..5396592 Binary files /dev/null and b/src/assets/kegs/tennents.webp differ diff --git a/src/assets/kegs/thornbridge-jaipur.webp b/src/assets/kegs/thornbridge-jaipur.webp new file mode 100644 index 0000000..5bca37d Binary files /dev/null and b/src/assets/kegs/thornbridge-jaipur.webp differ diff --git a/src/assets/kegs/tiny-rebel-clwb.webp b/src/assets/kegs/tiny-rebel-clwb.webp new file mode 100644 index 0000000..2546f6b Binary files /dev/null and b/src/assets/kegs/tiny-rebel-clwb.webp differ diff --git a/src/assets/kegs/tripel-karmeliet.png b/src/assets/kegs/tripel-karmeliet.png deleted file mode 100644 index 4d20411..0000000 Binary files a/src/assets/kegs/tripel-karmeliet.png and /dev/null differ diff --git a/src/assets/kegs/tripel-karmeliet.webp b/src/assets/kegs/tripel-karmeliet.webp new file mode 100644 index 0000000..8210562 Binary files /dev/null and b/src/assets/kegs/tripel-karmeliet.webp differ diff --git a/src/assets/kegs/trooper.png b/src/assets/kegs/trooper.png deleted file mode 100644 index a17dbe4..0000000 Binary files a/src/assets/kegs/trooper.png and /dev/null differ diff --git a/src/assets/kegs/trooper.webp b/src/assets/kegs/trooper.webp new file mode 100644 index 0000000..8835dfb Binary files /dev/null and b/src/assets/kegs/trooper.webp differ diff --git a/src/assets/kegs/victoria.png b/src/assets/kegs/victoria.png deleted file mode 100644 index 8b78c34..0000000 Binary files a/src/assets/kegs/victoria.png and /dev/null differ diff --git a/src/assets/kegs/victoria.webp b/src/assets/kegs/victoria.webp new file mode 100644 index 0000000..49690da Binary files /dev/null and b/src/assets/kegs/victoria.webp differ diff --git a/src/assets/kegs/vocation-hop-skip.png b/src/assets/kegs/vocation-hop-skip.png deleted file mode 100644 index a0aeb43..0000000 Binary files a/src/assets/kegs/vocation-hop-skip.png and /dev/null differ diff --git a/src/assets/kegs/vocation-hop-skip.webp b/src/assets/kegs/vocation-hop-skip.webp new file mode 100644 index 0000000..466577b Binary files /dev/null and b/src/assets/kegs/vocation-hop-skip.webp differ diff --git a/src/assets/kegs/vocation-life-death.png b/src/assets/kegs/vocation-life-death.png deleted file mode 100644 index a177293..0000000 Binary files a/src/assets/kegs/vocation-life-death.png and /dev/null differ diff --git a/src/assets/kegs/vocation-life-death.webp b/src/assets/kegs/vocation-life-death.webp new file mode 100644 index 0000000..7859041 Binary files /dev/null and b/src/assets/kegs/vocation-life-death.webp differ diff --git a/src/beer-catalog.ts b/src/beer-catalog.ts index c3b14af..b19f52e 100644 --- a/src/beer-catalog.ts +++ b/src/beer-catalog.ts @@ -10,18 +10,27 @@ export interface BeerEntry { text: string; }; imagePath?: string; + breweryLogo?: string; kegId?: string; } function kegImage(slug: string): string { - return `kegs/${slug}.png`; + return `kegs/${slug}.webp`; +} + +// Tier-2 visual fallback: a brewery logo shown when a beer has no keg photo. +// Keyed by the exact brewery name used in the catalog entries below. Extensible. +const BREWERY_LOGOS: Record = {}; + +export function getBreweryLogo(brewery: string | undefined): string | undefined { + return brewery ? BREWERY_LOGOS[brewery] : undefined; } const CATALOG: BeerEntry[] = [ // === LEFFE === { slug: "leffe-blonde", name: "Leffe Blonde", brewery: "Abbaye de Leffe", style: "Belgian Blonde", abv: 6.6, colors: { primary: "#C8922A", secondary: "#FFF6E0", text: "#1A0F00" }, imagePath: kegImage("leffe-blonde") }, { slug: "leffe-brune", name: "Leffe Brune", brewery: "Abbaye de Leffe", style: "Belgian Dubbel", abv: 6.5, colors: { primary: "#4A2810", secondary: "#F5E6D0", text: "#FFFFFF" }, imagePath: kegImage("leffe-brune") }, - { slug: "leffe-amber", name: "Leffe Ambrée", brewery: "Abbaye de Leffe", style: "Belgian Amber", abv: 6.6, colors: { primary: "#B5651D", secondary: "#FFF0D6", text: "#1A0F00" } }, + { slug: "leffe-amber", name: "Leffe Ambrée", brewery: "Abbaye de Leffe", style: "Belgian Amber", abv: 6.6, colors: { primary: "#B5651D", secondary: "#FFF0D6", text: "#1A0F00" }, imagePath: kegImage("leffe-amber") }, { slug: "leffe-ruby", name: "Leffe Ruby", brewery: "Abbaye de Leffe", style: "Belgian Fruit Beer", abv: 5.0, colors: { primary: "#8B1A4A", secondary: "#FFE6F0", text: "#FFFFFF" }, imagePath: kegImage("leffe-ruby") }, { slug: "leffe-blanche", name: "Leffe Blanche", brewery: "Abbaye de Leffe", style: "Belgian Witbier", abv: 5.0, colors: { primary: "#E8DCC8", secondary: "#FFFDF5", text: "#2C2C2C" }, imagePath: kegImage("leffe-blanche") }, { slug: "leffe-winter", name: "Leffe Winter", brewery: "Abbaye de Leffe", style: "Belgian Winter Ale", abv: 6.6, colors: { primary: "#1B3A5C", secondary: "#E0ECF8", text: "#FFFFFF" } }, @@ -44,22 +53,22 @@ const CATALOG: BeerEntry[] = [ // === STELLA ARTOIS === { slug: "stella-artois", name: "Stella Artois", brewery: "Brouwerij Artois", style: "Belgian Lager", abv: 5.2, colors: { primary: "#0E4C1E", secondary: "#F0F8E8", text: "#FFFFFF" }, imagePath: kegImage("stella-artois") }, - { slug: "stella-artois-unfiltered", name: "Stella Artois Unfiltered", brewery: "Brouwerij Artois", style: "Unfiltered Lager", abv: 5.0, colors: { primary: "#D4A547", secondary: "#FFFCE8", text: "#0E4C1E" } }, + { slug: "stella-artois-unfiltered", name: "Stella Artois Unfiltered", brewery: "Brouwerij Artois", style: "Unfiltered Lager", abv: 5.0, colors: { primary: "#D4A547", secondary: "#FFFCE8", text: "#0E4C1E" }, imagePath: kegImage("stella-artois-unfiltered") }, { slug: "stella-artois-0", name: "Stella Artois 0.0%", brewery: "Brouwerij Artois", style: "Non-Alcoholic Lager", abv: 0.0, colors: { primary: "#0E4C1E", secondary: "#F0F8E8", text: "#FFFFFF" }, imagePath: kegImage("stella-artois-0") }, // === LAGERS & PILSNERS === { slug: "budweiser", name: "Budweiser", brewery: "Anheuser-Busch", style: "American Lager", abv: 5.0, colors: { primary: "#C8102E", secondary: "#FFF0F0", text: "#FFFFFF" } }, { slug: "bud", name: "Anheuser-Busch Bud", brewery: "Anheuser-Busch", style: "American Lager", abv: 5.0, colors: { primary: "#C8102E", secondary: "#FFF0F0", text: "#FFFFFF" }, imagePath: kegImage("bud") }, - { slug: "bud-light", name: "Bud Light", brewery: "Anheuser-Busch", style: "Light Lager", abv: 3.5, colors: { primary: "#004B8D", secondary: "#E8F4FF", text: "#FFFFFF" } }, + { slug: "bud-light", name: "Bud Light", brewery: "Anheuser-Busch", style: "Light Lager", abv: 3.5, colors: { primary: "#004B8D", secondary: "#E8F4FF", text: "#FFFFFF" }, imagePath: kegImage("bud-light") }, { slug: "corona", name: "Corona Extra", brewery: "Grupo Modelo", style: "Mexican Lager", abv: 4.5, colors: { primary: "#FDB913", secondary: "#FFFCE5", text: "#00205B" }, imagePath: kegImage("corona") }, { slug: "corona-cero", name: "Corona Cero", brewery: "Grupo Modelo", style: "Non-Alcoholic Lager", abv: 0.0, colors: { primary: "#0073B1", secondary: "#E5F3FF", text: "#FFFFFF" }, imagePath: kegImage("corona-cero") }, { slug: "becks", name: "Beck's", brewery: "Brauerei Beck & Co", style: "German Pilsner", abv: 4.8, colors: { primary: "#006838", secondary: "#E0F5E8", text: "#FFFFFF" }, imagePath: kegImage("becks") }, { slug: "becks-gold", name: "Beck's Gold", brewery: "Brauerei Beck & Co", style: "German Lager", abv: 4.9, colors: { primary: "#D4A547", secondary: "#FFF8E0", text: "#006838" }, imagePath: kegImage("becks-gold") }, - { slug: "peroni", name: "Peroni Nastro Azzurro", brewery: "Birra Peroni", style: "Italian Lager", abv: 5.1, colors: { primary: "#003DA5", secondary: "#E8F0FF", text: "#FFFFFF" } }, + { slug: "peroni", name: "Peroni Nastro Azzurro", brewery: "Birra Peroni", style: "Italian Lager", abv: 5.1, colors: { primary: "#003DA5", secondary: "#E8F0FF", text: "#FFFFFF" }, imagePath: kegImage("peroni") }, { slug: "hertog-jan", name: "Hertog Jan", brewery: "AB InBev Netherlands", style: "Dutch Pilsner", abv: 5.1, colors: { primary: "#1A3C0A", secondary: "#E8F0E0", text: "#D4A547" }, imagePath: kegImage("hertog-jan") }, - { slug: "hertog-jan-grand", name: "Hertog Jan Grand Pilsener", brewery: "AB InBev Netherlands", style: "Dutch Pilsner", abv: 5.1, colors: { primary: "#1A3C0A", secondary: "#E8F0E0", text: "#D4A547" } }, - { slug: "tennents", name: "Tennent's Lager", brewery: "Wellpark Brewery", style: "Scottish Lager", abv: 5.0, colors: { primary: "#D4001A", secondary: "#FFF0F0", text: "#FFFFFF" } }, - { slug: "la-virgen", name: "La Virgen Lager", brewery: "Cervezas La Virgen", style: "Spanish Lager", abv: 5.0, colors: { primary: "#1E6B3A", secondary: "#E8F5E0", text: "#FFFFFF" } }, + { slug: "hertog-jan-grand", name: "Hertog Jan Grand Pilsener", brewery: "AB InBev Netherlands", style: "Dutch Pilsner", abv: 5.1, colors: { primary: "#1A3C0A", secondary: "#E8F0E0", text: "#D4A547" }, imagePath: kegImage("hertog-jan-grand") }, + { slug: "tennents", name: "Tennent's Lager", brewery: "Wellpark Brewery", style: "Scottish Lager", abv: 5.0, colors: { primary: "#D4001A", secondary: "#FFF0F0", text: "#FFFFFF" }, imagePath: kegImage("tennents") }, + { slug: "la-virgen", name: "La Virgen Lager", brewery: "Cervezas La Virgen", style: "Spanish Lager", abv: 5.0, colors: { primary: "#1E6B3A", secondary: "#E8F5E0", text: "#FFFFFF" }, imagePath: kegImage("la-virgen") }, { slug: "san-miguel", name: "San Miguel", brewery: "San Miguel", style: "Spanish Lager", abv: 5.4, colors: { primary: "#C8102E", secondary: "#FFF0F0", text: "#FFFFFF" }, imagePath: kegImage("san-miguel") }, { slug: "victoria", name: "Victoria", brewery: "Victoria", style: "Spanish Lager", abv: 4.8, colors: { primary: "#1A3C0A", secondary: "#E8F0E0", text: "#D4A547" }, imagePath: kegImage("victoria") }, { slug: "samson", name: "Samson 11", brewery: "Samson", style: "Czech Lager", abv: 4.7, colors: { primary: "#006838", secondary: "#E0F5E8", text: "#FFFFFF" }, imagePath: kegImage("samson") }, @@ -71,31 +80,31 @@ const CATALOG: BeerEntry[] = [ { slug: "spaten", name: "Spaten", brewery: "Spaten-Franziskaner-Bräu", style: "Munich Helles", abv: 5.2, colors: { primary: "#1A3C0A", secondary: "#E8F0E0", text: "#FFFFFF" }, imagePath: kegImage("spaten") }, { slug: "lowenbrau", name: "Löwenbräu", brewery: "Löwenbräu", style: "Munich Helles", abv: 5.2, colors: { primary: "#003DA5", secondary: "#E8F0FF", text: "#FFFFFF" }, imagePath: kegImage("lowenbrau") }, { slug: "hasseroder", name: "Hasseröder Premium", brewery: "Hasseröder Brauerei", style: "German Pilsner", abv: 4.9, colors: { primary: "#006838", secondary: "#E0F5E8", text: "#FFFFFF" }, imagePath: kegImage("hasseroder") }, - { slug: "diebels", name: "Diebels Alt", brewery: "Brauerei Diebels", style: "Altbier", abv: 4.9, colors: { primary: "#4A2810", secondary: "#F5E6D0", text: "#FFFFFF" } }, + { slug: "diebels", name: "Diebels Alt", brewery: "Brauerei Diebels", style: "Altbier", abv: 4.9, colors: { primary: "#4A2810", secondary: "#F5E6D0", text: "#FFFFFF" }, imagePath: kegImage("diebels") }, { slug: "schneider", name: "Schneider Bayrisch Hell", brewery: "G. Schneider & Sohn", style: "Bavarian Helles", abv: 5.2, colors: { primary: "#006838", secondary: "#E8F5E0", text: "#FFFFFF" }, imagePath: kegImage("schneider") }, - { slug: "haake-beck", name: "Haake-Beck", brewery: "Brauerei Beck & Co", style: "German Pilsner", abv: 4.9, colors: { primary: "#006838", secondary: "#E0F5E8", text: "#FFFFFF" } }, + { slug: "haake-beck", name: "Haake-Beck", brewery: "Brauerei Beck & Co", style: "German Pilsner", abv: 4.9, colors: { primary: "#006838", secondary: "#E0F5E8", text: "#FFFFFF" }, imagePath: kegImage("haake-beck") }, { slug: "fruh-kolsch", name: "Früh Kölsch", brewery: "Cölner Hofbräu Früh", style: "Kölsch", abv: 4.8, colors: { primary: "#C8102E", secondary: "#FFF0F0", text: "#FFFFFF" }, imagePath: kegImage("fruh-kolsch") }, // === CRAFT & IPA === { slug: "goose-island-ipa", name: "Goose Island IPA", brewery: "Goose Island", style: "India Pale Ale", abv: 5.9, colors: { primary: "#D45500", secondary: "#FFF2E5", text: "#FFFFFF" }, imagePath: kegImage("goose-island-ipa") }, { slug: "goose-island-hazy", name: "Goose Island Hazy Beer Hug", brewery: "Goose Island", style: "Hazy IPA", abv: 6.4, colors: { primary: "#F5A623", secondary: "#FFFAE5", text: "#2C1A00" } }, { slug: "goose-midway", name: "Goose Midway Session IPA", brewery: "Goose Island", style: "Session IPA", abv: 4.1, colors: { primary: "#D45500", secondary: "#FFF2E5", text: "#FFFFFF" }, imagePath: kegImage("goose-midway") }, - { slug: "brewdog-punk-ipa", name: "BrewDog Punk IPA", brewery: "BrewDog", style: "India Pale Ale", abv: 5.4, colors: { primary: "#00A3E0", secondary: "#E5F5FF", text: "#FFFFFF" } }, - { slug: "brewdog-elvis-juice", name: "BrewDog Elvis Juice", brewery: "BrewDog", style: "Grapefruit IPA", abv: 6.5, colors: { primary: "#FF6B1A", secondary: "#FFF3E5", text: "#1A1A1A" } }, + { slug: "brewdog-punk-ipa", name: "BrewDog Punk IPA", brewery: "BrewDog", style: "India Pale Ale", abv: 5.4, colors: { primary: "#00A3E0", secondary: "#E5F5FF", text: "#FFFFFF" }, imagePath: kegImage("brewdog-punk-ipa") }, + { slug: "brewdog-elvis-juice", name: "BrewDog Elvis Juice", brewery: "BrewDog", style: "Grapefruit IPA", abv: 6.5, colors: { primary: "#FF6B1A", secondary: "#FFF3E5", text: "#1A1A1A" }, imagePath: kegImage("brewdog-elvis-juice") }, { slug: "camden-hells", name: "Camden Hells", brewery: "Camden Town Brewery", style: "Helles Lager", abv: 4.6, colors: { primary: "#000000", secondary: "#F5F0E0", text: "#F5C242" }, imagePath: kegImage("camden-hells") }, { slug: "camden-pale", name: "Camden Pale Ale", brewery: "Camden Town Brewery", style: "Pale Ale", abv: 4.0, colors: { primary: "#E87D00", secondary: "#FFF5E5", text: "#000000" }, imagePath: kegImage("camden-pale") }, { slug: "camden-ipa", name: "Camden IPA", brewery: "Camden Town Brewery", style: "India Pale Ale", abv: 5.8, colors: { primary: "#2E8B57", secondary: "#E5F5EC", text: "#FFFFFF" }, imagePath: kegImage("camden-ipa") }, { slug: "camden-eazy", name: "Camden Eazy", brewery: "Camden Town Brewery", style: "Session Pale", abv: 4.0, colors: { primary: "#F5C242", secondary: "#FFFCE5", text: "#000000" }, imagePath: kegImage("camden-eazy") }, - { slug: "tiny-rebel-clwb", name: "Tiny Rebel Clwb Tropicana", brewery: "Tiny Rebel", style: "Tropical IPA", abv: 5.5, colors: { primary: "#FF3399", secondary: "#FFE5F2", text: "#1A1A1A" } }, + { slug: "tiny-rebel-clwb", name: "Tiny Rebel Clwb Tropicana", brewery: "Tiny Rebel", style: "Tropical IPA", abv: 5.5, colors: { primary: "#FF3399", secondary: "#FFE5F2", text: "#1A1A1A" }, imagePath: kegImage("tiny-rebel-clwb") }, { slug: "vocation-life-death", name: "Vocation Life & Death", brewery: "Vocation Brewery", style: "India Pale Ale", abv: 6.5, colors: { primary: "#1A1A1A", secondary: "#F0F0F0", text: "#D4001A" }, imagePath: kegImage("vocation-life-death") }, { slug: "vocation-hop-skip", name: "Vocation Hop, Skip & Juice", brewery: "Vocation Brewery", style: "Pale Ale", abv: 5.7, colors: { primary: "#F5A623", secondary: "#FFFAE5", text: "#1A1A1A" }, imagePath: kegImage("vocation-hop-skip") }, - { slug: "thornbridge-jaipur", name: "Thornbridge Jaipur", brewery: "Thornbridge Brewery", style: "India Pale Ale", abv: 5.9, colors: { primary: "#8B4513", secondary: "#FFF5EB", text: "#FFFFFF" } }, + { slug: "thornbridge-jaipur", name: "Thornbridge Jaipur", brewery: "Thornbridge Brewery", style: "India Pale Ale", abv: 5.9, colors: { primary: "#8B4513", secondary: "#FFF5EB", text: "#FFFFFF" }, imagePath: kegImage("thornbridge-jaipur") }, { slug: "ninkasi", name: "Ninkasi IPA", brewery: "Ninkasi Brasserie", style: "India Pale Ale", abv: 5.4, colors: { primary: "#D45500", secondary: "#FFF2E5", text: "#FFFFFF" }, imagePath: kegImage("ninkasi") }, // === ENGLISH & SCOTTISH === - { slug: "fullers-london-pride", name: "Fuller's London Pride", brewery: "Fuller's", style: "English Bitter", abv: 4.7, colors: { primary: "#7B241C", secondary: "#F5E6E0", text: "#FFFFFF" } }, + { slug: "fullers-london-pride", name: "Fuller's London Pride", brewery: "Fuller's", style: "English Bitter", abv: 4.7, colors: { primary: "#7B241C", secondary: "#F5E6E0", text: "#FFFFFF" }, imagePath: kegImage("fullers-london-pride") }, { slug: "hawkstone", name: "Hawkstone Lager", brewery: "Hawkstone Brewing", style: "English Lager", abv: 4.8, colors: { primary: "#3D6B35", secondary: "#E8F0E0", text: "#F5E6C8" } }, - { slug: "old-peculier", name: "Theakston Old Peculier", brewery: "Theakston Brewery", style: "Old Ale", abv: 5.6, colors: { primary: "#2C0A1E", secondary: "#F0E0E8", text: "#C8922A" } }, + { slug: "old-peculier", name: "Theakston Old Peculier", brewery: "Theakston Brewery", style: "Old Ale", abv: 5.6, colors: { primary: "#2C0A1E", secondary: "#F0E0E8", text: "#C8922A" }, imagePath: kegImage("old-peculier") }, { slug: "adnams", name: "Adnams Ghost Ship", brewery: "Adnams", style: "Pale Ale", abv: 4.5, colors: { primary: "#003DA5", secondary: "#E8F0FF", text: "#FFFFFF" } }, { slug: "old-speckled-hen", name: "Old Speckled Hen", brewery: "Greene King", style: "English Bitter", abv: 5.0, colors: { primary: "#8B4513", secondary: "#FFF5EB", text: "#FFFFFF" }, imagePath: kegImage("old-speckled-hen") }, { slug: "northern-monk", name: "Northern Monk A Little Faith", brewery: "Northern Monk", style: "Session Pale", abv: 4.0, colors: { primary: "#1A1A1A", secondary: "#F0F0F0", text: "#F5C242" }, imagePath: kegImage("northern-monk") }, @@ -104,7 +113,7 @@ const CATALOG: BeerEntry[] = [ // === FRENCH === { slug: "castelain", name: "Castelain Grand Cru", brewery: "Brasserie Castelain", style: "Bière de Garde", abv: 6.2, colors: { primary: "#8B6914", secondary: "#FFF8E0", text: "#FFFFFF" }, imagePath: kegImage("castelain") }, - { slug: "castelain-chti", name: "Castelain Ch'ti Blonde", brewery: "Brasserie Castelain", style: "Bière de Garde", abv: 6.4, colors: { primary: "#D4A547", secondary: "#FFF8E8", text: "#1A0F00" } }, + { slug: "castelain-chti", name: "Castelain Ch'ti Blonde", brewery: "Brasserie Castelain", style: "Bière de Garde", abv: 6.4, colors: { primary: "#D4A547", secondary: "#FFF8E8", text: "#1A0F00" }, imagePath: kegImage("castelain-chti") }, { slug: "meteor", name: "Meteor White IPA", brewery: "Brasserie Meteor", style: "White IPA", abv: 5.6, colors: { primary: "#003DA5", secondary: "#E8F0FF", text: "#FFFFFF" }, imagePath: kegImage("meteor") }, { slug: "anoesteke", name: "Anosteké Blonde", brewery: "Brasserie du Pays Flamand", style: "French Blonde", abv: 8.0, colors: { primary: "#D4A547", secondary: "#FFF8E8", text: "#1A0F00" }, imagePath: kegImage("anoesteke") }, { slug: "rousse-mont-blanc", name: "Rousse du Mont Blanc", brewery: "Brasserie du Mont Blanc", style: "French Amber", abv: 6.5, colors: { primary: "#B5651D", secondary: "#FFF0D6", text: "#FFFFFF" }, imagePath: kegImage("rousse-mont-blanc") }, diff --git a/src/const.ts b/src/const.ts index db0f95a..9d0e26e 100644 --- a/src/const.ts +++ b/src/const.ts @@ -12,6 +12,20 @@ export const GLASS_SIZES = [ export const DEFAULT_GLASS_SIZE = 330; export const DEFAULT_BEER = "stella-artois"; +export const LAYOUTS = [ + { value: "landscape", label: "Landscape (default)" }, + { value: "portrait", label: "Portrait (stacked)" }, + { value: "compact", label: "Compact (single row)" }, + { value: "hero", label: "Hero (image-forward)" }, + { value: "vessel", label: "Vessel (single gauge)" }, +] as const; + +export const DEFAULT_LAYOUT = "landscape"; + +export function resolveLayout(value: unknown): string { + return LAYOUTS.some((l) => l.value === value) ? (value as string) : DEFAULT_LAYOUT; +} + export const FRESHNESS_THRESHOLDS = { WARNING: 14, URGENT: 7, diff --git a/src/editor.ts b/src/editor.ts index 8f32983..6503b0b 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -2,10 +2,10 @@ import { LitElement, html, css, type CSSResultGroup, type TemplateResult } from import { customElement, property, state } from "lit/decorators.js"; import type { PerfectDraftCardConfig } from "./types.js"; -import { GLASS_SIZES, DEFAULT_GLASS_SIZE, DOMAIN } from "./const.js"; +import { GLASS_SIZES, DEFAULT_GLASS_SIZE, DOMAIN, LAYOUTS, DEFAULT_LAYOUT } from "./const.js"; import { getAllBeers } from "./beer-catalog.js"; -const EDITOR_VERSION = "0.1.6"; +const EDITOR_VERSION = "0.2.0"; interface DiscoveredDevice { deviceId: string; @@ -133,6 +133,52 @@ export class PerfectDraftCardEditor extends LitElement {
+
+ + +
+ +
Emoji matrix (advanced)
+ +
+ + +
+ +
+ + this._updateConfig("max_matrix_width", (e.target as HTMLInputElement).value || undefined)} + /> +
+
(); private _entityIds: { temperature?: string; kegRemaining?: string; kegFreshness?: string } = {}; @@ -61,6 +77,17 @@ export class PerfectDraftCard extends LitElement { } this._config = { ...config }; + this._layout = resolveLayout(config.layout) as CardLayout; + + const mc = config.matrix_columns; + this._matrixColumns = + typeof mc === "number" && Number.isFinite(mc) && mc > 0 ? Math.floor(mc) : undefined; + + this._maxMatrixWidth = + typeof config.max_matrix_width === "string" && config.max_matrix_width.trim() + ? config.max_matrix_width.trim() + : undefined; + const savedGlass = localStorage.getItem(storageKey(config.device_id, "glass")); this._glassSize = savedGlass ? parseInt(savedGlass, 10) : (config.glass_size ?? DEFAULT_GLASS_SIZE); @@ -70,11 +97,31 @@ export class PerfectDraftCard extends LitElement { } public getCardSize(): number { - return 5; + switch (this._layout) { + case "compact": + return 1; + case "vessel": + return 4; + case "portrait": + return 6; + default: + return 5; + } } public getGridOptions() { - return { columns: 4, rows: 3, min_columns: 2, min_rows: 2 }; + switch (this._layout) { + case "compact": + return { rows: 1, columns: 12, min_columns: 2, min_rows: 1 }; + case "portrait": + return { rows: 5, columns: 6, min_columns: 1, min_rows: 3 }; + case "vessel": + return { rows: 4, columns: 6, min_columns: 1, min_rows: 2 }; + case "hero": + return { rows: 5, columns: 8, min_columns: 1, min_rows: 2 }; + default: + return { columns: 4, rows: 3, min_columns: 1, min_rows: 2 }; + } } public static getStubConfig(hass: any): Record { @@ -86,7 +133,7 @@ export class PerfectDraftCard extends LitElement { } } const firstDevice = deviceIds.size === 1 ? [...deviceIds][0] : ""; - return { device_id: firstDevice, beer_name: "Stella Artois", glass_size: DEFAULT_GLASS_SIZE }; + return { device_id: firstDevice, beer_name: "Stella Artois", glass_size: DEFAULT_GLASS_SIZE, layout: DEFAULT_LAYOUT }; } public static getConfigElement(): HTMLElement { @@ -148,6 +195,18 @@ export class PerfectDraftCard extends LitElement { } } + private _imgError(src: string): void { + this._failedImages = new Set(this._failedImages).add(src); + } + + private _openBeerDialog = (): void => { + this._showBeerDialog = true; + }; + + private _openGlassDialog = (): void => { + this._showGlassDialog = true; + }; + protected render(): TemplateResult { if (!this._config || !this.hass) { return html`
Loading...
`; @@ -177,68 +236,217 @@ export class PerfectDraftCard extends LitElement { const glassCount = volumeMl !== null ? Math.floor(volumeMl / this._glassSize) : null; const beer = this._beer ?? resolveBeer(undefined); + const ctx: RenderCtx = { beer, temp, kegPct, freshDays, tier, glassCount }; + + const body = + this._layout === "portrait" + ? this._renderPortrait(ctx) + : this._layout === "compact" + ? this._renderCompact(ctx) + : this._layout === "hero" + ? this._renderHero(ctx) + : this._layout === "vessel" + ? this._renderVessel(ctx) + : this._renderLandscape(ctx); return html` - -
-
{ this._showBeerDialog = true; }} - style="background: linear-gradient(135deg, ${beer.colors.primary}dd, ${beer.colors.primary}88);"> -
- ${beer.imagePath - ? html` { const img = e.target as HTMLImageElement; const fallback = img.parentElement!.querySelector('.beer-logo-text'); if (!fallback) { img.style.display = 'none'; const div = document.createElement('div'); div.className = 'beer-logo-text'; div.style.color = beer.colors.text; div.textContent = beer.name.charAt(0); img.parentElement!.appendChild(div); }}} />` - : html`
${beer.name.charAt(0)}
` - } -
-
- ❄ ${temp !== null ? `${Math.round(temp)}°C` : "--°C"} -
-
- ${beer.name} -
-
- ${beer.brewery} · ${beer.abv}% -
-
- -
{ this._showGlassDialog = true; }}> - ${glassCount !== null && glassCount > 0 - ? this._renderEmojiGrid(glassCount) - : glassCount === 0 || (kegPct !== null && kegPct === 0) - ? this._renderEmptyKeg() - : this._renderEmojiGrid(0) - } -
- ${glassCount !== null - ? `${glassCount} × ${this._glassLabel()}` - : `-- × ${this._glassLabel()}` - } -
- ${this._renderFreshnessIndicator(freshDays, tier)} -
-
- + + ${body} ${this._showGlassDialog ? this._renderGlassDialog() : nothing} ${this._showBeerDialog ? this._renderBeerDialog() : nothing} `; } + private _labelStyle(beer: BeerEntry): string { + return `background: linear-gradient(135deg, ${beer.colors.primary}dd, ${beer.colors.primary}88);`; + } + + private _tempText(temp: number | null): string { + return temp !== null ? `${Math.round(temp)}°C` : "--°C"; + } + + private _countText(glassCount: number | null): string { + return glassCount !== null ? `${glassCount} × ${this._glassLabel()}` : `-- × ${this._glassLabel()}`; + } + + /** Tiered visual: keg photo -> brewery logo -> generated tinted silhouette. */ + private _renderVisual(beer: BeerEntry): TemplateResult { + const kegSrc = beer.imagePath + ? beer.imagePath.startsWith("http") + ? beer.imagePath + : getCardBaseUrl() + beer.imagePath + : undefined; + if (kegSrc && !this._failedImages.has(kegSrc)) { + return html` this._imgError(kegSrc)} />`; + } + + const logoRel = beer.breweryLogo ?? getBreweryLogo(beer.brewery); + const logoSrc = logoRel + ? logoRel.startsWith("http") + ? logoRel + : getCardBaseUrl() + logoRel + : undefined; + if (logoSrc && !this._failedImages.has(logoSrc)) { + return html` this._imgError(logoSrc)} />`; + } + + return this._renderKegSilhouette(beer); + } + + /** Generated, asset-free keg silhouette tinted from the beer palette, with its initial. */ + private _renderKegSilhouette(beer: BeerEntry): TemplateResult { + const initial = (beer.name.charAt(0) || "?").toUpperCase(); + const { primary, secondary } = beer.colors; + return html` + + + + + ${initial} + + + `; + } + + /** Beer glass that fills proportionally — used by the vessel layout. */ + private _renderGlassVessel(beer: BeerEntry, fillPct: number): TemplateResult { + const p = Math.max(0, Math.min(100, fillPct)); + const top = 16; + const bottom = 128; + const height = bottom - top; + const fillTop = bottom - (height * p) / 100; + const cid = `pdfill-${beer.slug.replace(/[^a-z0-9]/gi, "")}`; + const outline = `M24 ${top} H76 L70 ${bottom - 6} Q70 ${bottom} 64 ${bottom} H36 Q30 ${bottom} 30 ${bottom - 6} Z`; + return html` + + + + + + ${p > 0 && p < 100 + ? html`` + : nothing} + + + + `; + } + + private _renderLabelInner(beer: BeerEntry, temp: number | null): TemplateResult { + return html` +
${this._renderVisual(beer)}
+
❄ ${this._tempText(temp)}
+
${beer.name}
+
${beer.brewery} · ${beer.abv}%
+ `; + } + + private _renderKegContent(c: RenderCtx): TemplateResult { + return html` + ${c.glassCount !== null && c.glassCount > 0 + ? this._renderEmojiGrid(c.glassCount) + : c.glassCount === 0 || (c.kegPct !== null && c.kegPct === 0) + ? this._renderEmptyKeg() + : this._renderEmojiGrid(0)} +
${this._countText(c.glassCount)}
+ ${this._renderFreshnessIndicator(c.freshDays, c.tier)} + `; + } + + private _renderLandscape(c: RenderCtx): TemplateResult { + return html` +
+
+ ${this._renderLabelInner(c.beer, c.temp)} +
+
${this._renderKegContent(c)}
+
+ `; + } + + private _renderPortrait(c: RenderCtx): TemplateResult { + return html` +
+
+ ${this._renderLabelInner(c.beer, c.temp)} +
+
${this._renderKegContent(c)}
+
+ `; + } + + private _renderCompact(c: RenderCtx): TemplateResult { + const pct = c.kegPct ?? 0; + return html` +
+
${this._renderVisual(c.beer)}
+
+
${c.beer.name}
+
+
+
+
+
+
❄ ${this._tempText(c.temp)}
+
${this._countText(c.glassCount)}
+
+
+ `; + } + + private _renderHero(c: RenderCtx): TemplateResult { + return html` +
+
${this._renderVisual(c.beer)}
+
+
+ ${c.beer.name} + ❄ ${this._tempText(c.temp)} +
+
${this._countText(c.glassCount)}
+
+ ${this._renderFreshnessIndicator(c.freshDays, c.tier)} +
+ `; + } + + private _renderVessel(c: RenderCtx): TemplateResult { + const pct = c.kegPct ?? 0; + return html` +
+
+ ${c.beer.name} + ❄ ${this._tempText(c.temp)} +
+
${this._renderGlassVessel(c.beer, pct)}
+
${this._countText(c.glassCount)}
+ ${this._renderFreshnessIndicator(c.freshDays, c.tier)} +
+ `; + } + private _renderEmojiGrid(count: number): TemplateResult { const maxGlasses = Math.floor(KEG_TOTAL_VOLUME_ML / this._glassSize); - const cols = maxGlasses <= 10 ? 5 : 6; + const cols = + this._matrixColumns && this._matrixColumns > 0 + ? Math.min(this._matrixColumns, maxGlasses) + : maxGlasses <= 10 + ? 5 + : 6; const rows = Math.ceil(maxGlasses / cols); const slots = []; for (let i = 0; i < maxGlasses; i++) { - slots.push(i < count - ? html`🍺` - : html`🍺` - ); + slots.push(i < count ? html`🍺` : html`🍺`); } + const widthStyle = this._maxMatrixWidth + ? `max-width: ${this._maxMatrixWidth}; margin-left: auto; margin-right: auto;` + : ""; return html` -
+
${slots}
`; @@ -383,7 +591,7 @@ export class PerfectDraftCard extends LitElement { 50% { border-color: #db4437; box-shadow: 0 0 20px #db443744; } } - /* === LAYOUT === */ + /* === LAYOUT (landscape default) === */ .card-content { display: flex; height: 100%; @@ -392,6 +600,7 @@ export class PerfectDraftCard extends LitElement { .label-zone { flex: 1 1 25%; + min-width: 0; max-width: 30%; display: flex; flex-direction: column; @@ -409,6 +618,8 @@ export class PerfectDraftCard extends LitElement { .keg-zone { flex: 3; + min-width: 0; + container-type: inline-size; display: flex; flex-direction: column; align-items: center; @@ -437,6 +648,11 @@ export class PerfectDraftCard extends LitElement { max-height: 100%; object-fit: contain; } + .gen-svg, .vessel-svg { + width: 100%; + height: 100%; + max-height: 100%; + } .beer-logo-text { font-size: 5em; font-weight: bold; @@ -476,7 +692,8 @@ export class PerfectDraftCard extends LitElement { justify-content: center; width: 100%; height: 100%; - font-size: min(7vw, 5em); + font-size: min(7vw, 4.5em); + font-size: clamp(0.5em, 14cqi, 4.5em); } .glass.empty { opacity: 0.15; @@ -489,6 +706,178 @@ export class PerfectDraftCard extends LitElement { flex-shrink: 0; } + /* === PORTRAIT === */ + .layout-portrait-content { + flex-direction: column; + } + .layout-portrait-content .label-zone { + flex: 0 0 auto; + max-width: none; + width: 100%; + padding: 18px 16px; + border-radius: var(--ha-card-border-radius, 12px) var(--ha-card-border-radius, 12px) 0 0; + } + .layout-portrait-content .label-zone .beer-logo-area { + max-height: 120px; + } + .layout-portrait-content .keg-zone { + flex: 1 1 auto; + width: 100%; + } + + /* === COMPACT === */ + .layout-compact-content { + min-height: 0; + align-items: center; + gap: 12px; + padding: 10px 16px; + } + .compact-visual { + flex: 0 0 auto; + width: 44px; + height: 44px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + } + .compact-visual .beer-logo, + .compact-visual .gen-svg { + max-width: 44px; + max-height: 44px; + } + .compact-main { + flex: 1 1 auto; + min-width: 0; + cursor: pointer; + } + .compact-name { + font-weight: bold; + font-size: 1.05em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + .compact-bar { + margin-top: 6px; + height: 8px; + border-radius: 4px; + background: rgba(255, 255, 255, 0.12); + overflow: hidden; + } + .compact-bar-fill { + height: 100%; + border-radius: 4px; + transition: width 0.4s ease; + } + .compact-side { + flex: 0 0 auto; + text-align: right; + cursor: pointer; + white-space: nowrap; + } + .compact-temp { + font-size: 1.1em; + font-weight: 300; + } + .compact-count { + font-size: 0.8em; + opacity: 0.6; + } + + /* === HERO === */ + .layout-hero-content { + flex-direction: column; + align-items: center; + justify-content: center; + position: relative; + min-height: 320px; + cursor: pointer; + } + .hero-visual { + flex: 1 1 auto; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + min-height: 0; + padding: 18px 18px 0; + box-sizing: border-box; + } + .hero-visual .beer-logo, + .hero-visual .gen-svg { + max-height: 100%; + max-width: 80%; + filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45)); + } + .hero-scrim { + width: 100%; + box-sizing: border-box; + padding: 28px 20px 16px; + background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent); + text-align: center; + } + .hero-line { + display: flex; + align-items: baseline; + justify-content: center; + gap: 14px; + flex-wrap: wrap; + } + .hero-name { + font-size: 1.5em; + font-weight: bold; + } + .hero-temp { + font-size: 1.3em; + font-weight: 300; + } + .hero-count { + font-size: 1.05em; + opacity: 0.7; + margin-top: 2px; + } + + /* === VESSEL === */ + .layout-vessel-content { + flex-direction: column; + align-items: center; + justify-content: center; + gap: 6px; + padding: 16px; + min-height: 280px; + } + .vessel-top { + display: flex; + align-items: baseline; + gap: 12px; + cursor: pointer; + flex-wrap: wrap; + justify-content: center; + } + .vessel-name { + font-size: 1.4em; + font-weight: bold; + } + .vessel-temp { + font-size: 1.2em; + font-weight: 300; + opacity: 0.85; + } + .vessel-mid { + flex: 1 1 auto; + min-height: 0; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + } + .vessel-count { + font-size: 1.2em; + opacity: 0.7; + cursor: pointer; + } + /* === EMPTY KEG === */ .empty-keg { text-align: center; diff --git a/src/types.ts b/src/types.ts index 83d7527..b100922 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,5 @@ +export type CardLayout = "landscape" | "portrait" | "compact" | "hero" | "vessel"; + export interface PerfectDraftCardConfig { type?: string; device_id: string; @@ -5,6 +7,9 @@ export interface PerfectDraftCardConfig { glass_size?: number; beer_entity?: string; custom_beers?: CustomBeerEntry[]; + layout?: CardLayout; + matrix_columns?: number | "auto"; + max_matrix_width?: string; } export interface CustomBeerEntry {