feat(badges): layout CSS system — data-layout attribute, @page injection, style_href
Two compiled layout CSS files in src/lib/ae_events/badges/css/:
- badge_layout_epson_4x5_fanfold.css — 4"×5" per side, Epson ColorWorks C3500
fanfold duplex; preferred for general conference use (ISHLT, demos)
- badge_layout_zebra_zc10l_pvc.css — 3.5"×5.5" PVC card, Zebra ZC10L,
single-sided (pair with duplex=0 on template)
Rules scoped under [data-layout="..."] on the wrapper — beats Tailwind utility
class specificity without !important. Vite hot-reloads these in dev.
Badge component: add data-layout attribute from template.layout field; import
both layout CSS files (falls back to Tailwind 4"×6" defaults if layout unset).
Print page svelte:head: inject @page paper-size rule per layout code
(@page cannot use attribute selectors so it must be dynamic). Also wire
style_href as a <link> for per-event external client branding CSS.
db_events.ts Badge_template interface: add style_href and duplex fields.
MODULE doc: update layout codes table with badge_4x5_fanfold entry.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -176,15 +176,19 @@ to avoid bleeding into the rest of the app. The classes used in
|
||||
|
||||
The `layout` field encodes physical badge stock dimensions. Standard codes to use:
|
||||
|
||||
| Code | Dimensions | Description |
|
||||
|---|---|---|
|
||||
| `badge_3.5x5.5_pvc` | 3.5" × 5.5" (88.9 × 139.7mm) | PVC card, Zebra ZC10L |
|
||||
| `badge_4x6_fanfold` | 4" × 6" (101.6 × 152.4mm) | Fanfold paper badge |
|
||||
| `badge_4x6_fanfold_tickets` | 4" × 6" + tear-offs | Fanfold with ticket stubs |
|
||||
| Code | Dimensions | CSS file | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `badge_4x5_fanfold` | 4" × 5" (101.6 × 127mm) | `badge_layout_epson_4x5_fanfold.css` | Epson ColorWorks C3500 / ExpoBadge fanfold — preferred for general conference use (ISHLT, demos) |
|
||||
| `badge_3.5x5.5_pvc` | 3.5" × 5.5" (88.9 × 139.7mm) | `badge_layout_zebra_zc10l_pvc.css` | PVC card, Zebra ZC10L — single-sided, set `duplex=0` |
|
||||
| `badge_4x6_fanfold` | 4" × 6" (101.6 × 152.4mm) | *(none — Tailwind defaults)* | Generic fanfold fallback; dimensions match the hardcoded Tailwind values |
|
||||
| `badge_4x6_fanfold_tickets` | 4" × 6" + tear-offs | *(pending)* | Fanfold with ticket stubs |
|
||||
|
||||
The current badge component is hard-coded to `w-[4in]` / `min-h-[6.0in]`. These
|
||||
dimensions will need to be made template-driven once the `layout` field is wired up.
|
||||
For now, override via print CSS in the `style_href` stylesheet.
|
||||
Layout CSS files live in `src/lib/ae_events/badges/css/` and are imported by
|
||||
`ae_comp__badge_obj_view.svelte`. Rules are scoped under `[data-layout="..."]` on the
|
||||
wrapper so multiple layouts can coexist in the bundle without conflict.
|
||||
|
||||
`@page` paper size rules are injected per-layout from `print/+page.svelte <svelte:head>`
|
||||
(attribute selectors cannot scope `@page` rules, so they're handled dynamically).
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user