doxa-maps/library/constants/posterDefaults.js
doxa-maps d5ba21fa76 doxa-maps — portable bundler for embeddable JAMstack maps
Standalone repo that builds embeddable JAMstack map bundles (web components),
composes them into a lazy-loaded SPA via layouts/, and optionally wraps a
Capacitor Android/iOS app — one build, choose your output/CDN. Diátaxis docs.

History reset to a single clean commit; no PII, IPs, or internal terms.
2026-09-10 01:53:07 +00:00

107 lines
3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* posterDefaults.js — default margins, bleed, slot sizes, and typography
* used by the poster pipeline.
*
* These are reasonable starting values for a 24×36" research poster at
* 300 DPI. Override per-spec via the PosterSpec passed to useMapPoster().
*
* All measurements are in INCHES unless noted. The renderer converts to
* pixels using the spec's DPI.
*/
export const posterDefaults = {
dpi: 300,
// Outside margins (printed area inset from page edge, after bleed).
margins: {
top: 0.75,
right: 0.75,
bottom: 0.75,
left: 0.75,
},
// Bleed area (pulled outside the trimmed page); 0.125" = 3 mm is industry standard.
bleed: 0.125,
// Vertical/horizontal gutter between sections.
gutter: { in: 0.20 },
// Title strip across the top of content area.
title: {
heightIn: 1.25,
fontFamily: 'Inter, system-ui, -apple-system, "Segoe UI", sans-serif',
fontWeightTitle: 700,
fontWeightSubtitle: 500,
fontSizeTitlePt: 36,
fontSizeSubtitlePt: 16,
color: '#0a0a0a',
},
// Legend column on the right.
legend: {
widthIn: 3.0,
fontFamily: 'Inter, system-ui, sans-serif',
fontSizePt: 11,
swatchSize: 14, // px (in legend SVG)
backgroundColor: 'rgba(255,255,255,0.94)',
borderColor: '#cccccc',
},
// Chrome band (scale + north arrow) under the map.
chromeBand: { heightIn: 0.6 },
// Scale bar.
scaleBar: {
widthIn: 2.5,
units: 'both', // 'km' | 'mi' | 'both'
color: '#111',
backgroundColor: 'rgba(255,255,255,0.9)',
},
// North arrow.
north: {
sizeIn: 0.6,
color: '#111',
},
// Footer strip — ALWAYS present (Mapbox attribution requirement).
footer: {
heightIn: 0.45,
fontFamily: 'Inter, system-ui, sans-serif',
fontSizePt: 10,
color: '#222',
// Caller may set left/right text; attribution is enforced by FooterSlot.
attribution: '© Mapbox © OpenStreetMap',
backgroundColor: 'rgba(255,255,255,0.92)',
},
};
/**
* Build a default PosterSpec. Caller usually overrides title/legend/etc.
*
* @param {{ widthIn: number, heightIn: number, dpi?: number, orientation?: 'portrait'|'landscape' }} size
* @returns {import('../composables/poster/useMapPoster.js').PosterSpec}
*/
export function defaultPosterSpec(size) {
return {
widthIn: size.widthIn,
heightIn: size.heightIn,
dpi: size.dpi || posterDefaults.dpi,
orientation: size.orientation || (size.heightIn >= size.widthIn ? 'portrait' : 'landscape'),
margins: { ...posterDefaults.margins },
bleed: posterDefaults.bleed,
slots: {
title: { text: 'Untitled', subtitle: '', heightIn: posterDefaults.title.heightIn },
legend: { rows: [], type: 'generic', widthIn: posterDefaults.legend.widthIn },
scaleBar: true,
north: true,
footer: {
left: '',
right: '',
attribution: posterDefaults.footer.attribution,
heightIn: posterDefaults.footer.heightIn,
},
},
renderPath: 'auto',
};
}