A packet printed from the wall names page 1's countries in its own language
The list's own print relabelled the map sheet (mapLabels.js); the wall's print, through usePosterPrints, lifted the sheet with no relabeller, so a zh packet printed from the wall kept INDIA, CHINA … on page 1. The generator's ISO3 -> name table is plugin data the library cannot import, so the host now supplies it: PosterWall iso3Names -> usePosterPrints iso3Names, and the UPG-100 wall passes its territory-counts table lazily. A host that passes nothing prints exactly as before. Measured two-sided through the real printPacket on a tracked sheet: without the table the page carries CHINA and no 中国; with it, 中国 and no CHINA.
This commit is contained in:
parent
98277dc30e
commit
ff0c433fce
3 changed files with 32 additions and 3 deletions
|
|
@ -93,6 +93,10 @@ const props = defineProps({
|
|||
// and gets the list + card-deck prints; one that cannot simply omits it and
|
||||
// those buttons stay hidden, rather than failing at click time.
|
||||
records: { type: Function, default: null },
|
||||
// () => the ISO3 -> English name table the host's map sheets were generated from (a loader, so a
|
||||
// bundle can keep it lazy). With it, a packet's page-1 map names its countries in the packet's
|
||||
// language; without it the sheet prints as drawn. usePosterPrints' iso3Names.
|
||||
iso3Names: { type: Function, default: null },
|
||||
// Card stock for the deck print, when this wall offers one. See card-render.js
|
||||
// STOCK — both orientations are available. This is the DEFAULT selection.
|
||||
cardStock: { type: String, default: 'poker' },
|
||||
|
|
@ -479,6 +483,7 @@ const prints = usePosterPrints({
|
|||
// guard skips silently and the wall would STILL print a mapless packet — the exact
|
||||
// seam-without-supplier failure this change exists to close, one layer down.
|
||||
assetsBase: () => props.assetsBase,
|
||||
iso3Names: props.iso3Names ? () => props.iso3Names() : null,
|
||||
sets: () => fetch(`${props.assetsBase}/tables/near-neighbors.json`)
|
||||
.then((r) => (r.ok ? r.json() : null)).catch(() => null),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -233,8 +233,25 @@ export function usePosterPrints(opts = {}) {
|
|||
// unit-testable against a real generated poster without a fetch.
|
||||
// ★ DELEGATES TO THE RENDERER. This used to carry its own copy of the page-1 wrapper (250px down,
|
||||
// scale 0.62), one of three identical copies; packet-render.js liftMap is now the only one.
|
||||
function liftPosterSvg(html, R) {
|
||||
return R.liftMap(html);
|
||||
function liftPosterSvg(html, R, labelFor = null) {
|
||||
return R.liftMap(html, { labelFor });
|
||||
}
|
||||
|
||||
// The map's country names in the packet's language (packet/mapLabels.js). The sheet is drawn in
|
||||
// English from the generator's ISO3 -> name table, and that table is PLUGIN data this library cannot
|
||||
// import, so the host supplies it (opts.iso3Names, a loader). Without it, or in English, or on any
|
||||
// failure: null, and the sheet prints exactly as drawn. The wall path had no such seam, so a zh
|
||||
// packet printed from the wall kept INDIA, CHINA … on page 1 while the list's own path relabelled.
|
||||
async function mapLabelFor() {
|
||||
if (!opts.iso3Names) return null;
|
||||
try {
|
||||
const [iso3Name, { makeCountryLabelFor }, countryName] = await Promise.all([
|
||||
Promise.resolve().then(() => opts.iso3Names()),
|
||||
import('../packet/mapLabels.js'),
|
||||
import('../utils/countryName.js').then((m) => m.countryName || m.default),
|
||||
]);
|
||||
return makeCountryLabelFor({ iso3Name, countryName, lang: lang() });
|
||||
} catch (_) { return null; }
|
||||
}
|
||||
|
||||
// The first page-1 map sheet this bundle serves, in the renderer's preference order (the map-only
|
||||
|
|
@ -316,7 +333,8 @@ export function usePosterPrints(opts = {}) {
|
|||
}
|
||||
// The map default lifts this bundle's own poster — the same file printPoster already reads.
|
||||
if (!mapSvg && opts.assetsBase) {
|
||||
mapSvg = liftPosterSvg(await fetchMapSheet(opts.assetsBase(), item.id, R), R);
|
||||
const [sheet, labelFor] = await Promise.all([fetchMapSheet(opts.assetsBase(), item.id, R), mapLabelFor()]);
|
||||
mapSvg = liftPosterSvg(sheet, R, labelFor);
|
||||
}
|
||||
const sets = nearTable ? buildPacketSets(data, nearTable) : null;
|
||||
openPrintFrame(R.buildPacket(item, data, photos, mapSvg, funnel, christian, variant, sets), { autoprint: true });
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ import { zonesForList } from './data/zones-for-list.js'
|
|||
import { normalizeRecords, extractRecords } from './data/normalize.js'
|
||||
import { evaluate as evaluateSelector } from './data/selector-evaluator.js'
|
||||
|
||||
// The table the zone map sheets were generated from (generate.mjs labels each country with it), so a
|
||||
// packet printed from this wall names page 1's countries in its own language, as the list's print does.
|
||||
// Lazy: only a packet print needs it.
|
||||
const iso3Names = () => import('./data/territory-counts.js').then((m) => m.ISO3_NAME)
|
||||
|
||||
const profileConfig = inject('profileConfig', ref(null))
|
||||
const instanceId = computed(() => profileConfig.value?.instanceId || 'upg-100-wall')
|
||||
const isDark = computed(() => profileConfig.value?.isDark === true)
|
||||
|
|
@ -291,6 +296,7 @@ const wallTag = computed(() => t('messages.upg100WallTag'))
|
|||
unit="UPG"
|
||||
item-noun="list"
|
||||
:records="fetchListRecords"
|
||||
:iso3-names="iso3Names"
|
||||
:card-stocks="true"
|
||||
poster-action="print"
|
||||
preview-action="print"
|
||||
|
|
|
|||
Loading…
Reference in a new issue