diff --git a/library/components/poster/PosterWall.vue b/library/components/poster/PosterWall.vue index 60f8fbe35..3d59c76bf 100644 --- a/library/components/poster/PosterWall.vue +++ b/library/components/poster/PosterWall.vue @@ -112,6 +112,9 @@ const props = defineProps({ // async (item, format) => a map SHEET generated now (packet/posterSheets.js); tried first for the poster // print and the packet's page 1. usePosterPrints' sheet. sheet: { type: Function, default: null }, + // (item, which) => void: start the loads a print of this item will need, called when the reader OPENS a print + // chooser (the Prayer List packets, the Card Deck sizes): an intent moment before the tap, so the print skips them. + prewarm: { 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' }, @@ -782,6 +785,10 @@ const deckKey = (id, which) => `${id}:${which}` function toggleDeck(id, ev, which = 'deck') { const key = deckKey(id, which) deckOpenFor.value = deckOpenFor.value === key ? null : key + if (deckOpenFor.value === key && props.prewarm) { + const item = (props.items || []).find((x) => x && x.id === id) + if (item) { try { props.prewarm(item, which) } catch (_) { /* a warm-up is only a head start */ } } + } // Tell the size row how far down to start: the print row's REAL height, which is // one line in en and two in the long-label locales. Walking up from the clicked // button to its own .pfs keeps this correct per card rather than per wall. diff --git a/plugin-designs/country-posters/country-poster-wall.vue b/plugin-designs/country-posters/country-poster-wall.vue index 86f277a41..93c8b0fcb 100644 --- a/plugin-designs/country-posters/country-poster-wall.vue +++ b/plugin-designs/country-posters/country-poster-wall.vue @@ -191,6 +191,16 @@ const countryOnlySheet = (card, format, opts) => sheetForRecord(byId.get(card.id const stateSheet = makeIndiaStateSheet({ records: recordsFor, assetsBase: () => assetsBase.value, states: () => indiaStates.value, region: INDIA_REGION, }) +// ★ WARM ON INTENT: opening a card's Prayer List or Card Deck chooser starts that card's people groups (the cached +// provider the print then reads) and, for the packet, whose page 1 is the country sheet, the sheet's boundaries and +// engine (warmSheet), so the print after the choice skips those loads. Never on browsing alone, never for a withheld card. +function prewarmPrint(card, which) { + if (!card || card.noGroups || rowsWithheld(card) || posterWithheld(card)) return + const rows = card.indiaState ? (card.slugs && card.slugs.length ? recordsFor({ type: 'pg_slugs', values: card.slugs }) : null) + : (card.iso3 ? recordsFor({ type: 'country', values: [card.iso3] }) : null) + if (rows && rows.catch) rows.catch(() => {}) + if (which === 'packet') import('@map/packet/posterSheets.js').then((m) => m.warmSheet && m.warmSheet(assetsBase.value)).catch(() => {}) +} const countrySheet = (card, format, opts) => (card.indiaState ? stateSheet(card, format, opts) : countryOnlySheet(card, format, opts)) // The name table the generated sheet was labelled from, so a packet in another language relabels page 1's // country names (the same seam the UPG-100 wall passes). @@ -274,6 +284,7 @@ const soonMessage = computed(() => t('messages.countryWallSoon')) :records="countryRecords" :card-stocks="true" :sheet="countrySheet" + :prewarm="prewarmPrint" :iso3-names="iso3Names" :map-image="countryMap" :collapsible="!filtered"