diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c32029f..dbadcd5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added +- **Where a type sits on the sheet.** Each item type on the builder's TYPES tab now has ON THE SHEET: EQUIPPED (worn or wielded), USABLE (used up or used often: potions, ammo, kits) or PACK. WEAPON and ARMOR presets start EQUIPPED, CONSUMABLE and SPELL start USABLE, and GEAR and every type you already have start in PACK. The sheet's GEAR tab sorts lines into these bands next. - **EDIT CURRENT in SHOP_CATALOGUES.** A new button beside DOWNLOAD CURRENT puts what your shops sell now straight into the box, ready to change, PREVIEW and SAVE, with no file to download and upload again. If the box already has text in it, it asks before replacing it. - **Publishing tidies the shop catalogue.** When you publish a system, any catalogue line that is now exactly one of your items, same name, price and columns, is taken out of the file, since the item sells itself. That includes lines that ADD NEW LINES TO ITEMS turned into items. The builder's publish message says how many. Lines naming an item kept out of the shops stay, so they sell again if you switch it back on. - **Catalogue lines can become items.** In SHOP_CATALOGUES, PREVIEW now offers ADD NEW LINES TO ITEMS, off to start. Switched on, it lists what it will add and how many items your system will hold. SAVE then makes each line that isn't one of your items yet into an item: of its section's type (a shelf's lines go to your DEFAULT type), with its columns, price and words, in the shops. They go into the builder's draft and are kept once you publish; until then the catalogue line sells them. If the builder is open, it takes them in, so its next save keeps them. diff --git a/README.md b/README.md index 9cbc2c39..66aafba5 100644 --- a/README.md +++ b/README.md @@ -481,7 +481,7 @@ CITY_NET/ │ │ ├── healthFormula.js # MAX HEALTH: A FORMULA (7d4): what the formula comes to for a sheet, read as a derived value is (stats, formulas, levels), whole and never below 0; any formula of the sheet's worked out the same way (7d5a); @capacity readable (8a5a) │ │ ├── healthLevels.js # MAX HEALTH: PER LEVEL (7d5a): level 1 the full die, each level after what it kept or the average, EACH LEVEL ADDS read now, never less than 1 a level; the token's base; REROLL ALL, KEEP HIGHER, a level's gain kept outright (7d5c); ROLL TO BEAT, a pool or a die per level against the maximum, a gain of 0 kept (7d5d); each level saying how it was kept (rolled, set, cleared), level 1 set by the GM, a level averaging its own die (7d7b1); an uploaded sheet's maximum the base for its levels, and a whole upload's health (7d7c) │ │ ├── items.js # A system's items (7e2a): slots each character has so many of, items whose features need carrying, wearing or wearing in a slot, checked; at the table (7e3a): carried by a readied or stowed gear line of its name, WEAR and TAKE OFF, ATTUNE with a slot free or the GM's anyway, END, the GM's count for one character, what works; GIVE.EXE's list of them, each with what it needs and its words (itemsGivable, 7e3b); INSTALLS (7e4a): each costing against a stat or formula, ADDING TO it up to a limit or TAKING FROM it down to one, an item needing one with a COST; INSTALL with room or the GM's anyway, REMOVE, the line kept in the gear wherever it is, the cost one of its modifiers (overlaid, never written in), each install's cost, value and limit for the sheet; checks the item types and each item's type and values (8a1); encumbrance beside them, and an install's WEIGHS (8a5a); an item's PRICE and IN SHOPS, checked, one IN SHOPS needing a price (8a7a3a) -│ │ ├── itemTypes.js # Item types (8a1; approved mockup item-types, 2026-11-14): each type's columns, NUMBER (a unit), TEXT, DAMAGE, DICE, COUNT (a button, a rest that refills it, the items it reloads from) and PICK ONE (its words), checked; GEAR, WEIGHT and PRICE, where a system makes none; an item's values checked against its type's columns; the types as the sheet is shown them; a line of gear's type, values and counts, from the item it is named like or its own; linesOf, the gear read as the sheet stores it, shared with gearRolls, gearCounts and encumbrance; SOLD AT (8a7a2), the kinds of shop a type's lines are sold at, the General Store where unsaid, and the type shelves a kind of building sells (typeShelvesAt); an item's price (its own, else its type's PRICE column) and whether it is IN SHOPS, one saved before the switch by whether it has a price (8a7a3a) +│ │ ├── itemTypes.js # Item types (8a1; approved mockup item-types, 2026-11-14): each type's columns, NUMBER (a unit), TEXT, DAMAGE, DICE, COUNT (a button, a rest that refills it, the items it reloads from) and PICK ONE (its words), checked; GEAR, WEIGHT and PRICE, where a system makes none; an item's values checked against its type's columns; the types as the sheet is shown them; a line of gear's type, values and counts, from the item it is named like or its own; linesOf, the gear read as the sheet stores it, shared with gearRolls, gearCounts and encumbrance; SOLD AT (8a7a2), the kinds of shop a type's lines are sold at, the General Store where unsaid, and the type shelves a kind of building sells (typeShelvesAt); an item's price (its own, else its type's PRICE column) and whether it is IN SHOPS, one saved before the switch by whether it has a price (8a7a3a); a type's band on the sheet, EQUIPPED, USABLE or PACK, PACK where unsaid (bandOf, G1) │ │ ├── encumbrance.js # Encumbrance (8a5a; approved mockup item-types, 2026-11-14, decision 7; shown, never enforced): COUNTED BY a NUMBER column, one of each times how many over the lines READIED or STOWED, an installed item only where its install WEIGHS; CAN CARRY a formula among the others (@capacity), what is carried read as @carried; bands as words at a share of it; the checks; each band and the word past them saying WHAT IT MEANS and naming an optional condition (8a5d1), the band as the sheet is told it; BAND_KEY, and CARRYING given CAN CARRY as the band reads it (8a5e1); the bands, the word past them and the condition's name given to the sheet for CARRYING on GEAR (8a6a) │ │ ├── wornSums.js # What is worn, summed by column (8a5b; approved mockup item-types, 2026-11-14, decision 6): each NUMBER column of a system's own types read as @type_column, the worn items of that type together (@armor_defense), each worn item once as its line has it; no name a stat's, formula's or level's │ │ ├── itemsImport.js # A system's items from a file (8aL3a; approved mockup items-layout, 2026-11-14): a section per type by its id or name, each column by its name or id, needs, cost where the system has an install, words, and [features]; read against the draft, matched by name, never deleting; one there under another type made it, keeping the values both have; each mistake skipped by its line, the rest going in; nothing saved. In a game with types of its own, PRICE (an item's own, where its type has no column holding it) and IN SHOPS, yes or no (8a7a3b2) @@ -928,7 +928,7 @@ CITY_NET/ │ │ │ ├── ChoicesPage.tsx # CHOICES (7a2b1; approved mockup builder-choices, 2026-10-27): the lists a character picks from down the left; the open list with ONE / MANY, A CHARACTER PICKS (ONE, SEVERAL with how many, ANY), MORE THAN ONCE and LEVELLED, a line saying what the list now means (with @_level when levelled), and its options; the open option with its name, words and an optional requirement, its level name in a levelled list, and its features (FeaturesEditor.tsx). DELETE asks first, saying what goes; a "?" beside every setting. A levelled list's option has a HIT DIE (R1b): NONE, D4 to D20, or OTHER with its sides typed, saying what rolls it. A TABLE TO ROLL ON (7a5b): NONE, d6, 2d6, d20, d100 or the system's own dice, sharing the rolls out evenly; PLAYERS PICK (BY HAND, BY HAND OR ROLL, BY ROLL ONLY); each option's roll, with what is wrong beside it; what an option gives: items as typed, money per currency (7c4e) │ │ │ ├── ItemsPage.tsx # ITEMS (7e2b): SLOTS each character has so many of, and ITEMS, each opening to its name, words, what its features need and its features (the CHOICES form without a level, list or increase); where to sell and give them, CATALOGUES.EXE's DOWNLOAD ITEMS and GIVE.EXE (7e3c); INSTALLS (7e4b): each with its name, what it costs against, ADDS TO IT or TAKES FROM IT, NEVER PAST or NEVER BELOW (a formula box), + INSTALL and ×; an item INSTALLED AS one gets a COST; ITEM TYPES above the items (8a2, ItemTypesSection.tsx), and on an item its TYPE and a field for each of its columns; as three tabs (8aL1; approved mockup items-layout, 2026-11-14), TYPES · SLOTS & INSTALLS · ITEMS in the order a system is set up, slots and installs side by side, one line of words each, the tab and the open item kept while the builder is open; ITEMS as a list grouped by type beside the open item (8aL2), + beside each type making one of it with its name selected, FIND filtering as it is typed into, the open item NAME, TYPE and its columns first, then ITS FEATURES NEED, COST, WORDS and its features; IMPORT, DOWNLOAD EXAMPLE and DOWNLOAD THIS LIST under the list (8aL3b), IMPORT opening in place of the open item; a fourth tab, ENCUMBRANCE (8a5c), and an install's WEIGHS WHILE INSTALLED while it counts; a new item IN SHOPS, and NOT SOLD beside one kept out (8a7a3b1) │ │ │ ├── EncumbranceSection.tsx # ENCUMBRANCE on ITEMS (8a5c): COUNTED BY a NUMBER column IN its unit, CAN CARRY a formula box, BANDS each named and placed by the GM and the word past them, what counts as carried, the names formulas read, STOP COUNTING asked first; under each band and past them WHAT IT MEANS and a CONDITION, NONE first, one gone said (8a5d2) -│ │ │ ├── ItemTypesSection.tsx # ITEM TYPES (8a2; approved mockup item-types, 2026-11-14): a tab for each type, + FROM A PRESET (WEAPON, ARMOR, GEAR, CONSUMABLE, SPELL) and + BLANK; the open type's NAME, ONE and its columns, each a name, a KIND and what the kind has (a unit; a button, the rest that refills it and the items it reloads from; PICK ONE's words), + COLUMN, ×, DELETE TYPE asking; on an item, its TYPE and a field for each column by its kind, DAMAGE and DICE a formula box; the types listed beside the open one (8aL1), the DEFAULT first with MAKE DEFAULT on the others, each with how many items are of it, and ON THE SHEET: the open type's table with its first item as the line; an item's PRICE and IN SHOPS under TYPE, its type's PRICE column shown there once, a price asked for while IN SHOPS (8a7a3b1) +│ │ │ ├── ItemTypesSection.tsx # ITEM TYPES (8a2; approved mockup item-types, 2026-11-14): a tab for each type, + FROM A PRESET (WEAPON, ARMOR, GEAR, CONSUMABLE, SPELL) and + BLANK; the open type's NAME, ONE and its columns, each a name, a KIND and what the kind has (a unit; a button, the rest that refills it and the items it reloads from; PICK ONE's words), + COLUMN, ×, DELETE TYPE asking; on an item, its TYPE and a field for each column by its kind, DAMAGE and DICE a formula box; the types listed beside the open one (8aL1), the DEFAULT first with MAKE DEFAULT on the others, each with how many items are of it, and ON THE SHEET: the open type's table with its first item as the line; an item's PRICE and IN SHOPS under TYPE, its type's PRICE column shown there once, a price asked for while IN SHOPS (8a7a3b1); ON THE SHEET under ONE: EQUIPPED, USABLE or PACK (G1) │ │ │ ├── ChoicesImport.tsx # IMPORT on a CHOICES list (choices import 2; approved mockup choices-import, 2026-10-28): over the list and option columns, DOWNLOAD THIS LIST and DOWNLOAD EXAMPLE, a file pasted or uploaded, PREVIEW read by the server, mistakes warned of by line (named at the top as links that select the line, marked in the line numbers beside the text), APPLY into the draft only for the text previewed │ │ │ ├── ItemsImport.tsx # IMPORT on the ITEMS tab (8aL3b; approved mockup items-layout, 2026-11-14): beside the list in place of the open item, a file pasted or uploaded, PREVIEW read by the server, mistakes named by line and marked beside the text, APPLY into the draft only for the text previewed, DOWNLOAD THIS LIST and DOWNLOAD EXAMPLE; its box's grey hint from the system (8a7a5) │ │ │ ├── FormulaIcon.tsx # The formula box's button mark: "math format professional" from Microsoft's Fluent UI System Icons (MIT), picked by the user 2026-10-29, drawn in the text's color so it follows the theme @@ -1284,7 +1284,7 @@ CITY_NET/ │ │ │ ├── houseRules.ts # HOUSE RULES as logic: a system's own house rules (up to 20, a new one starting off), changed keeping their ids, deleted leaving what waited on them always there (no part, section or condition waits on it, a formula loses its alternative), and what waits on a rule with the page GO TO opens; the draft as it would be worked out with one rule on, or as the game would run it with a set of rules on (the server's withHouseRules mirrored, held to it); the rules a running game has on (useHouseRules) and the boxes changed from them; held to the server's checks │ │ │ ├── choices.ts # CHOICES as logic (7a2b1): a system's lists and their options read, made (named to rename, ids free of every option's, feature's and level name's), changed (one pick, not levelled and not again store nothing; several capped) and removed (a list taking with it any feature opening it; an option from its own list only), and the level names formulas read; an option's features (7a2b2) made at a level, changed (blank words, level 1 or any level outside a levelled list, empty lists, no uses and no list store nothing; a level past the highest is the highest) and removed, what each does as tags, and what a feature can name: the stats, formulas and health fields, every rest (the off ones said so), the rolls and their changes. Mirrors backend choices.js, every edit held to its checks. A levelled list's option's die (R1b), kept to 2 to 100 sides and taken away with LEVELLED. A list's table (7a5b): its dice, the rolls shared out evenly, each option's roll, how players pick, and what is wrong with the table in the server's words; taken away, rolls and all, with NONE or EVERYONE HAS IT; an INCREASE kept and said in words (7d6a); the list an increase offers instead (7d6c1); a modifier's way and where it stops, and which field is the token's maximum (7e1b); the names taken shared with items, and a feature kept tidy for an item too (7e2b) │ │ │ ├── items.ts # ITEMS as logic (7e2b): slots and items read and written back, what an item's features need in words, an item's features kept as a pick's but never at a level; installs read and written back (7e4b), kept by every other edit, sharing the slots' names; an item needing one costs 1 to start, 0 to 1000, fractions allowed, none otherwise; INSTALLED AS in what an item needs; the item types and each item's type and values kept by every edit (8a1); a deleted item is reloaded from no longer (8a2); an item's words 1000 characters at most, as the server checks them (8aL3b; it said 2000); an install's weighs (8a5c); an item's own price and in_shops (8a7a3b1) -│ │ │ ├── itemTypes.ts # ITEM TYPES as logic (8a2): GEAR where a system makes none, the presets, types made, named and removed (their items to the first left), columns made, changed (a new kind keeps its own parts, its values gone from the items), removed with their values; an item's type (keeping the values both types have) and values; a rest or item deleted taken off a COUNT; mirrors the server's itemTypes.js; a type made the DEFAULT, moved to the top, the items that said nothing said to be the old default so none changes type (8aL1); an item's PRICE (in its type's PRICE column, else its own) and IN SHOPS, read as the server reads them, its price going with it to another type (8a7a3b1) +│ │ │ ├── itemTypes.ts # ITEM TYPES as logic (8a2): GEAR where a system makes none, the presets, types made, named and removed (their items to the first left), columns made, changed (a new kind keeps its own parts, its values gone from the items), removed with their values; an item's type (keeping the values both types have) and values; a rest or item deleted taken off a COUNT; mirrors the server's itemTypes.js; a type made the DEFAULT, moved to the top, the items that said nothing said to be the old default so none changes type (8aL1); an item's PRICE (in its type's PRICE column, else its own) and IN SHOPS, read as the server reads them, its price going with it to another type (8a7a3b1); a type's band on the sheet (BANDS, bandOf; the presets' own; PACK stores nothing, G1) │ │ │ ├── encumbrance.ts # The builder's ENCUMBRANCE as logic (8a5c; approved mockup item-types, 2026-11-14, decision 7): read and written back tidy, the NUMBER columns it can count with their types, how it starts (WEIGHT, ten times the first stat, LIGHT 50 / ENCUMBERED 100 / OVERLOADED), the bands, and the names formulas read of the gear for INSERT; a band's words and condition, and past them, kept through every edit (8a5d1); blank words and NONE kept as nothing, words cut at 200 (8a5d2) │ │ │ ├── ranks.ts # The builder's ranks as logic (7f1b): lists from four presets or empty, renamed and removed (their stats back to numbers), ranks added, changed, moved and removed (a stat's highest at the start following), a stat's HOLDS and AT START │ │ │ ├── gearItems.ts # Items on the GEAR tab as logic (7e3b): which gear line draws which item (by name, the first carried), what the last save worked out, each line's buttons and words (WEAR, ATTUNE, the GM's ATTUNE ANYWAY, WORKING, why it does nothing), a slot's verb from its name (ATTUNED → ATTUNE), the counters, the GM's own count asked, an item's uses; installed items (7e4c): INSTALL with room, a player's disabled past the limit and why, the GM's INSTALL ANYWAY, INSTALLED · REMOVE, each install's counter (CYBERWARE · STRAIN 2.75 OF 3, or NEVER BELOW), the names installed; the render copy's item types, and each item's type and values (8a3a) diff --git a/backend/__tests__/system_builder_item_types.test.js b/backend/__tests__/system_builder_item_types.test.js index 82da8f48..9bead3b4 100644 --- a/backend/__tests__/system_builder_item_types.test.js +++ b/backend/__tests__/system_builder_item_types.test.js @@ -10,7 +10,7 @@ import { createRequire } from 'module'; const require_ = createRequire(import.meta.url); const { checkDefinition } = require_('../systemBuilder/definition'); -const { GEAR, typesOf, ownTypes, typeNamed, valueProblem, lineColumns, itemValues } = require_('../systemBuilder/itemTypes'); +const { GEAR, typesOf, ownTypes, typeNamed, valueProblem, lineColumns, itemValues, bandOf, BANDS } = require_('../systemBuilder/itemTypes'); const { itemsRenderedOf, namesOf } = require_('../systemBuilder/choices'); const { buildFile, readFile } = require_('../systemBuilder/citysys'); @@ -147,7 +147,7 @@ describe('the sheet is told them', () => { it('each type\'s columns by name and kind, a COUNT\'s button and the items it reloads from by name; each item\'s type and values', () => { const shown = itemsRenderedOf(TYPED); // Sold at the General Store where the GM said nowhere (8a7a2). - expect(shown.types[0]).toEqual({ id: 'weapons', label: 'WEAPONS', one: 'Weapon', sold_at: ['general_store'], columns: [ + expect(shown.types[0]).toEqual({ id: 'weapons', label: 'WEAPONS', one: 'Weapon', sold_at: ['general_store'], on_sheet: 'pack', columns: [ { id: 'damage', label: 'DAMAGE', kind: 'damage' }, { id: 'heals', label: 'HEALS', kind: 'dice' }, { id: 'range', label: 'RANGE', kind: 'text' }, @@ -163,7 +163,7 @@ describe('the sheet is told them', () => { ]); // A COUNT with nothing said: USE, no rest, no reload; a type with no singular: its name. const plain = itemsRenderedOf(withTypes([{ id: 'w', label: 'WANDS', columns: [{ id: 'charges', label: 'CHARGES', kind: 'count' }] }], [])); - expect(plain.types).toEqual([{ id: 'w', label: 'WANDS', one: 'WANDS', sold_at: ['general_store'], columns: [{ id: 'charges', label: 'CHARGES', kind: 'count', button: 'USE' }] }]); + expect(plain.types).toEqual([{ id: 'w', label: 'WANDS', one: 'WANDS', sold_at: ['general_store'], on_sheet: 'pack', columns: [{ id: 'charges', label: 'CHARGES', kind: 'count', button: 'USE' }] }]); // Types alone are enough to tell; nothing at all, nothing to tell. A system making none tells no types (8a3a): its // sheet keeps the one list, its items still GEAR with their values. const none = itemsRenderedOf({ ...TYPED, items: { list: [{ id: 'rope', label: 'Rope', values: { weight: 10 } }] } }); @@ -218,3 +218,32 @@ describe('the system file', () => { expect(read.file.definition.items).toEqual(TYPED.items); }); }); + +describe('a type\'s band on the sheet (G1)', () => { + const TYPED = (onSheet) => ({ format: 1, name: 'Banded', core: { health: { model: 'pool' } }, stats: [{ id: 'abilities', label: 'ABILITIES', stats: [{ id: 'might', label: 'Might' }] }], + items: { types: [{ id: 'kit', label: 'KIT', columns: [], ...(onSheet === undefined ? {} : { on_sheet: onSheet }) }], list: [] } }); + + it('EQUIPPED, USABLE or PACK; PACK where unsaid or not one of them', () => { + expect(BANDS).toEqual(['equipped', 'usable', 'pack']); + expect(bandOf({ on_sheet: 'equipped' })).toBe('equipped'); + expect(bandOf({ on_sheet: 'usable' })).toBe('usable'); + expect(bandOf({})).toBe('pack'); + expect(bandOf({ on_sheet: 'belt' })).toBe('pack'); + expect(bandOf(null)).toBe('pack'); + }); + + it('checked: one of the three', () => { + const problems = (v) => checkDefinition(TYPED(v)).problems.filter((p) => /on_sheet/.test(p.where)); + for (const v of ['equipped', 'usable', 'pack', undefined]) expect(problems(v), String(v)).toEqual([]); + expect(problems('belt')).toEqual([{ where: 'type kit, on_sheet', message: 'EQUIPPED, USABLE or PACK' }]); + }); + + it('told to the sheet, and carried by the system file unchanged', () => { + const def = TYPED('usable'); + expect(itemsRenderedOf(def).types[0].on_sheet).toBe('usable'); + expect(itemsRenderedOf(TYPED(undefined)).types[0].on_sheet).toBe('pack'); + const read = readFile(JSON.stringify(buildFile({ definition: def, version: 1, origin: 'sys_bandbandbandband' }))); + expect(read.problems).toEqual([]); + expect(read.file.definition.items.types[0].on_sheet).toBe('usable'); + }); +}); diff --git a/backend/systemBuilder/itemTypes.js b/backend/systemBuilder/itemTypes.js index ac9157d6..0b603ee6 100644 --- a/backend/systemBuilder/itemTypes.js +++ b/backend/systemBuilder/itemTypes.js @@ -41,7 +41,15 @@ const linesOf = (data) => { /** What a column holds: a number, words, damage dice, any other dice, a count spent and refilled, one word of a few. */ const KINDS = ['number', 'text', 'damage', 'dice', 'count', 'pick']; const LIMITS = { types: 10, columns: 20, options: 20, word: 30, text: 200, count: 1000, reload: 10, number: 1000000000, unit: 12 }; -const TYPE_KEYS = new Set(['id', 'label', 'one', 'columns', 'sold_at']); +const TYPE_KEYS = new Set(['id', 'label', 'one', 'columns', 'sold_at', 'on_sheet']); +/** + * Where a type's lines sit on the sheet's GEAR tab (G1; approved mockup docs/mockups/sheet-gear-layout.html, 2026-11-20): + * EQUIPPED (worn or wielded), USABLE (used up or used often: potions, ammo, kits) or PACK. Unsaid, PACK, as GEAR starts. + */ +const BANDS = ['equipped', 'usable', 'pack']; +const DEFAULT_BAND = 'pack'; +/** A type's band: what it says, else PACK. */ +const bandOf = (type) => (type && BANDS.includes(type.on_sheet) ? type.on_sheet : DEFAULT_BAND); const BASE = ['id', 'label', 'kind']; const COLUMN_KEYS = { number: new Set([...BASE, 'unit']), text: new Set(BASE), damage: new Set(BASE), dice: new Set(BASE), @@ -111,6 +119,8 @@ const checkTypes = (definition, problems, { text, keys, labelMost, itemIds = new text(t.label, `${where}, label`, labelMost, { required: true }); text(t.one, `${where}, one`, labelMost); // Where its lines are sold (8a7a2): a list of the kinds of shop, each once. + // Its band on the sheet (G1): one of the three. + if (t.on_sheet !== undefined && !BANDS.includes(t.on_sheet)) problems.push({ where: `${where}, on_sheet`, message: 'EQUIPPED, USABLE or PACK' }); if (t.sold_at !== undefined) { if (!Array.isArray(t.sold_at)) problems.push({ where: `${where}, sold_at`, message: 'A list of the kinds of shop that sell it' }); else t.sold_at.forEach((id, n) => { @@ -175,6 +185,8 @@ const typesShown = (definition, items = []) => { id: t.id, label: t.label || t.id, one: t.one || t.label || t.id, // The kinds of shop that sell it, the General Store where unsaid (8a7a2): the shop window's shelves follow it. sold_at: soldAt(t), + // Its band on the GEAR tab (G1), PACK where unsaid. + on_sheet: bandOf(t), columns: t.columns.map((c) => ({ id: c.id, label: c.label || c.id, kind: c.kind, ...(c.kind === 'number' && typeof c.unit === 'string' && c.unit.trim() ? { unit: c.unit } : {}), @@ -246,4 +258,4 @@ const lineColumns = (definition, line, items, names) => { return { type: type.id, ...(item ? { item: item.id } : {}), values, counts }; }; -module.exports = { PRICE_COLUMN, MOST_PRICE, isPrice, itemPrice, inShops, KINDS, LIMITS, GEAR, NAME, SHOP_TYPES, DEFAULT_SOLD_AT, soldAt, typeShelvesAt, linesOf, typesOf, ownTypes, typeNamed, valueProblem, checkTypes, checkItemType, typesShown, itemValues, lineColumns }; +module.exports = { BANDS, DEFAULT_BAND, bandOf, PRICE_COLUMN, MOST_PRICE, isPrice, itemPrice, inShops, KINDS, LIMITS, GEAR, NAME, SHOP_TYPES, DEFAULT_SOLD_AT, soldAt, typeShelvesAt, linesOf, typesOf, ownTypes, typeNamed, valueProblem, checkTypes, checkItemType, typesShown, itemValues, lineColumns }; diff --git a/e2e/COVERAGE.md b/e2e/COVERAGE.md index a9fff2fa..ecb6b7f6 100644 --- a/e2e/COVERAGE.md +++ b/e2e/COVERAGE.md @@ -35,6 +35,7 @@ panel), so a control that looks fine but does nothing is caught for all of them. | Shop catalogues by item type | a section per item type (8a7a1), its columns checked, blanks kept | `shop_catalogue_types`, `catalogueTypes` | `catalogue-types`, `shop-typed-lines` (bought at the General Store and given, landing typed, 8a7a2) | **AT THE TABLE** | | The shops under load | 1000+ lines on a shelf, 200 items, a full cart, a long gear list (8n3); a long shelf drawn 200 rows at a time | `shop_stress`, `ShopWindow` | `shop-stress` | **AT THE TABLE** | | An item type's SOLD AT | the kinds of shop that sell its lines (8a7a2), the General Store where unsaid; set in the builder in 8a7b | `shop_typed_lines`, `typedShelves` | `shop-typed-lines` (unsaid: the General Store) | **AT THE TABLE** unsaid; a kind of shop picked waits for 8a7b's box | +| An item type's ON THE SHEET band | EQUIPPED, USABLE or PACK (G1), PACK where unsaid; the sheet's GEAR bands come in G2 | `system_builder_item_types`, `itemTypes`, `ItemsPage` | `builder-item-types` (the WEAPON preset EQUIPPED) | **SET IN THE BUILDER**; at the table with G2 | | An item's PRICE and IN SHOPS | priced and IN SHOPS, it sells itself at its type's shops (8a7a3a); off, never sold, not even from a file, but bought back at its price by a shop of its type (8a7a3c2); a type's PRICE column read as its price; set on ITEMS under TYPE, NOT SOLD in the list, a new item's price asked for (8a7a3b1); in the ITEMS import and downloads, price and in shops columns (8a7a3b2) | `shop_items_on_sale`, `itemPrice`, `ItemsPage`, `system_builder_items_import`, `itemsImport` | `shop-items-on-sale` (a type's PRICE column; a ring turned off; sold back from the window at 50%), `builder-item-price` (set by clicks), `builder-items-import` (imported priced and IN SHOPS) | **AT THE TABLE** | | A catalogue file held against the game's items | an exact copy of an item left out, an item kept out of the shops left out, one of an item's name overruling it, ALSO ON SALE FROM ITEMS (8a7a3c1) | `shop_items_on_sale`, `CatalogueWindow` | `catalogue-and-items` | **AT THE TABLE** | | ADD NEW LINES TO ITEMS | a catalogue's new lines made items in the draft (8a7a4a), off to start; on PUBLISH the lines now exactly an item leave the file (8a7a4b) | `catalogue_into_items`, `CatalogueWindow`, `catalogueItems`, `BuilderScreen` | `catalogue-and-items` (the Hand Cannon into the draft, then out of the file once published) | **AT THE TABLE** | diff --git a/e2e/README.md b/e2e/README.md index f8bc8b58..004986e9 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -171,7 +171,7 @@ kept; the job itself stops at 30 (`timeout-minutes`), for a hang outside the tes | `tests/builder-item-price.spec.ts` | PRICE and IN SHOPS on the builder's ITEMS page (8a7a3b1). The Pistol's PRICE, kept in its WEAPONS type's PRICE column, shown once under TYPE and changed to 180; the Rope, of a type without one and NOT SOLD while unpriced, given its own 3; the Ring of Might switched out of the shops and tagged NOT SOLD; a new armor IN SHOPS, its price asked for until 40 is typed; saved, no problems. | | `tests/builder-items.spec.ts` | ITEMS (7e2b): + SLOT named ATTUNED with three each; + ITEM named Ring of Constitution, worded, needing WORN AND ATTUNED, with a feature Hardy giving +2 Con that STOPS AT 20, and no level, list or increase on it; saved with no problems as made, and kept after a reload. A second test (7e4b): + INSTALL made CYBERWARE costing against Strain, NEVER PAST @might (read in words), and a Cranial Jack INSTALLED AS CYBERWARE at a COST of 0.25, saved as made and there after a reload; on their tabs since 8aL1, each item made from + beside GEAR since 8aL2 | | `tests/builder-items-import.spec.ts` | Uploading items (8aL3b): on the ITEMS tab, DOWNLOAD EXAMPLE gives a file made from the system (WEAPONS with its DAMAGE and GRADE); edited (a Hand Crossbow named, a Bad Bow with a GRADE the column hasn't), pasted into IMPORT and PREVIEWed: the crossbow new, the bow skipped by its line; APPLY, the crossbow in WEAPONS, saved with no problems Since 8a7a3b2 the example has PRICE and IN SHOPS too, and the crossbow imported from it is priced 25 and IN SHOPS. | -| `tests/builder-item-types.spec.ts` | ITEM TYPES (8a2; on their tabs since 8aL1): GEAR said to start on TYPES, where the page opens; WEAPONS from its preset, opened beside it; its AMMO refilled by LONG REST and reloaded from Pistol Rounds; + COLUMN named GRADE, PICK ONE of LIGHT, HEAVY; + ITEM named Pistol, a WEAPON, its DAMAGE, RANGE, AMMO, WEIGHT and GRADE filled; saved with no problems, the types and items as made; after a reload the Pistol a WEAPON and WEAPONS beside GEAR; since 8aL2 the Pistol made from + WEAPON, its name focused to type over, and FIND narrowing the list to the rounds, 1 OF 2 | +| `tests/builder-item-types.spec.ts` | ITEM TYPES (8a2; on their tabs since 8aL1): GEAR said to start on TYPES, where the page opens; WEAPONS from its preset, opened beside it; its AMMO refilled by LONG REST and reloaded from Pistol Rounds; + COLUMN named GRADE, PICK ONE of LIGHT, HEAVY; + ITEM named Pistol, a WEAPON, its DAMAGE, RANGE, AMMO, WEIGHT and GRADE filled; saved with no problems, the types and items as made; after a reload the Pistol a WEAPON and WEAPONS beside GEAR; since 8aL2 the Pistol made from + WEAPON, its name focused to type over, and FIND narrowing the list to the rounds, 1 OF 2 Since G1 the WEAPON preset starts EQUIPPED, checked on its ON THE SHEET buttons and in the saved draft. | | `tests/builder-encumbrance.spec.ts` | ENCUMBRANCE on the builder's ITEMS page (8a5c): COUNT ENCUMBRANCE starting on GEAR's WEIGHT, CAN CARRY set to five times Might, the first band renamed UNBURDENED up to 40%, a third band HEAVY, the word past them CRUSHED, and the CYBERWARE install still weighing while installed; saved as made, there after a reload; and (8a5d2) ENCUMBERED saying "Speed -10 ft." and putting EXHAUSTED on, past them saying "Speed -20 ft.", kept after a reload | | `tests/builder-condition-modifiers.spec.ts` | A condition's modifiers on the builder's CONDITIONS page (8a5e2): SLOWED made by clicks with the SNAIL icon (8a5i), ITS MODIFIERS APPLIED, Speed TIMES 0.5 and Might less by `@speed / -10`; saved as made, APPLIED, its way and its formula there after a reload | | `tests/builder-condition-each-turn.spec.ts` | A condition's EACH TURN on the builder's CONDITIONS page (8a9b): BURNING made by clicks, ending after 3 rounds, + EACH TURN giving 1d4 damage at the start of its turn onto the token; POISONED a save at the end of its turn, d20 + @con_mod, off on 13, rolled by the player, its line in words saying Con mod; STUNNED ending AT THE END OF ITS NEXT TURN. Saved with nothing to fix, each as made after a reload | diff --git a/e2e/tests/builder-item-types.spec.ts b/e2e/tests/builder-item-types.spec.ts index 5ef6bdee..30b6a45d 100644 --- a/e2e/tests/builder-item-types.spec.ts +++ b/e2e/tests/builder-item-types.spec.ts @@ -27,6 +27,8 @@ test('ITEM TYPES: WEAPONS from its preset with AMMO and a GRADE, and a Pistol fi await types.getByRole('group', { name: 'Add an item type' }).getByRole('button', { name: 'WEAPON', exact: true }).click(); const weapons = page.getByRole('region', { name: 'WEAPONS type' }); await expect(types.getByRole('group', { name: 'The item types' }).getByRole('button', { name: 'WEAPONS' })).toHaveAttribute('aria-pressed', 'true'); + // ON THE SHEET (G1): the WEAPON preset starts EQUIPPED, worn or wielded. + await expect(weapons.getByRole('group', { name: 'WEAPONS band' }).getByRole('button', { name: 'EQUIPPED' })).toHaveAttribute('aria-pressed', 'true'); // AMMO: refilled by a long rest, reloaded from Pistol Rounds. await weapons.getByRole('combobox', { name: 'AMMO refilled by' }).selectOption({ label: 'LONG REST' }); @@ -70,7 +72,7 @@ test('ITEM TYPES: WEAPONS from its preset with AMMO and a GRADE, and a Pistol fi expect(saved.draft.items).toEqual({ types: [ { id: 'gear', label: 'GEAR', one: 'Gear', columns: [{ id: 'weight', label: 'WEIGHT', kind: 'number', unit: 'LB' }, { id: 'price', label: 'PRICE', kind: 'number' }] }, - { id: 'weapons', label: 'WEAPONS', one: 'Weapon', columns: [ + { id: 'weapons', label: 'WEAPONS', one: 'Weapon', on_sheet: 'equipped', columns: [ { id: 'damage', label: 'DAMAGE', kind: 'damage' }, { id: 'range', label: 'RANGE', kind: 'text' }, { id: 'ammo', label: 'AMMO', kind: 'count', button: 'FIRE', refill: 'long_rest', reload: ['rounds'] }, { id: 'weight', label: 'WEIGHT', kind: 'number', unit: 'LB' }, { id: 'price', label: 'PRICE', kind: 'number' }, diff --git a/frontend/src/components/ItemTypesSection.tsx b/frontend/src/components/ItemTypesSection.tsx index 5aaa3efc..d0542079 100644 --- a/frontend/src/components/ItemTypesSection.tsx +++ b/frontend/src/components/ItemTypesSection.tsx @@ -3,7 +3,7 @@ import type { Definition, systemsApi } from '../sheets/systemsApi'; import { itemTypes, ownTypes, typeOf, itemValues, withNewType, withType, withoutType, withDefaultType, withNewColumn, withColumn, withoutColumn, withItemType, withItemValue, wordsFrom, KINDS, PRESETS, LIMITS, type ItemColumn, type ItemType, type ColumnKind, - priceColumnOf, itemPriceOf, inShopsOf, priceNeeded, withItemPrice, withInShops, MOST_PRICE, + priceColumnOf, itemPriceOf, inShopsOf, priceNeeded, withItemPrice, withInShops, MOST_PRICE, BANDS, bandOf, } from '../sheets/itemTypes'; import { ToggleSwitch } from './ToggleSwitch'; import { itemList, type Item } from '../sheets/items'; @@ -183,6 +183,17 @@ export function ItemTypesSection({ definition, edit, place = 'items' }: Props & ONE edit(withType(definition, type.id, { one: e.target.value }))} /> + {/* Its band on the sheet's GEAR tab (G1; approved mockup sheet-gear-layout.html, 2026-11-20). */} + ON THE SHEET + + + {BANDS.map((b) => ( + + ))} + + {BANDS.find((b) => b.id === bandOf(type))!.why} +
diff --git a/frontend/src/components/__tests__/ItemsPage.test.tsx b/frontend/src/components/__tests__/ItemsPage.test.tsx index 349c6509..1333959a 100644 --- a/frontend/src/components/__tests__/ItemsPage.test.tsx +++ b/frontend/src/components/__tests__/ItemsPage.test.tsx @@ -462,7 +462,7 @@ describe('ITEM TYPES (8a2)', () => { }); it('every hint written', () => { - for (const k of ['items.types', 'items.typeName', 'items.one', 'items.column', 'items.kind', 'items.and', 'items.type']) expect(HINTS[k], k).toBeTruthy(); + for (const k of ['items.types', 'items.typeName', 'items.one', 'items.column', 'items.kind', 'items.and', 'items.type', 'items.onSheet']) expect(HINTS[k], k).toBeTruthy(); }); }); @@ -700,3 +700,20 @@ describe('an item\'s PRICE and IN SHOPS (8a7a3b1)', () => { for (const k of ['items.price', 'items.inShops'] as const) expect(HINTS[k], k).toBeTruthy(); }); }); + +describe('ON THE SHEET on a type (G1)', () => { + it('its band pressed, said what it means; another picked, stored; PACK stores nothing', async () => { + const TYPED = { ...WORN, items: { types: [{ id: 'gear', label: 'GEAR', columns: [] }, { id: 'arms', label: 'ARMS', one: 'Arm', columns: [], on_sheet: 'equipped' }], list: [] } } as unknown as Definition; + const last = open(TYPED, 'TYPES'); + const group = () => within(screen.getByRole('group', { name: 'GEAR band' })); + expect(group().getByRole('button', { name: 'PACK' }).getAttribute('aria-pressed')).toBe('true'); + expect(screen.getByText('PACK: everything else that is carried.')).toBeTruthy(); + await userEvent.click(group().getByRole('button', { name: 'USABLE' })); + expect((last().items as unknown as { types: { on_sheet?: string }[] }).types[0].on_sheet).toBe('usable'); + expect(screen.getByText('USABLE: used up or used often, like potions, ammo and kits.')).toBeTruthy(); + expect(group().getByRole('button', { name: 'USABLE' }).getAttribute('aria-pressed')).toBe('true'); + expect(group().getByRole('button', { name: 'PACK' }).getAttribute('aria-pressed')).toBe('false'); + await userEvent.click(group().getByRole('button', { name: 'PACK' })); + expect((last().items as unknown as { types: object[] }).types[0]).not.toHaveProperty('on_sheet'); + }); +}); diff --git a/frontend/src/sheets/__tests__/itemTypes.test.ts b/frontend/src/sheets/__tests__/itemTypes.test.ts index 2a5f16ac..d78c92ba 100644 --- a/frontend/src/sheets/__tests__/itemTypes.test.ts +++ b/frontend/src/sheets/__tests__/itemTypes.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest'; import { createRequire } from 'module'; import { GEAR, PRESETS, LIMITS, itemTypes, ownTypes, typeOf, itemValues, withNewType, withType, withoutType, withNewColumn, withColumn, - withoutColumn, withItemType, withItemValue, wordsFrom, withoutRefillBy, withoutReloadFrom, withDefaultType, type ItemType, + withoutColumn, withItemType, withItemValue, wordsFrom, withoutRefillBy, withoutReloadFrom, withDefaultType, BANDS, bandOf, type ItemType, } from '../itemTypes'; import { withoutItem } from '../items'; import { withNewRest, withoutRest } from '../rests'; @@ -251,3 +251,22 @@ describe('what goes with a rest or an item', () => { expect(withoutReloadFrom(armed, 'x')).toBe(armed); }); }); + +describe('a type\'s band on the sheet (G1)', () => { + it('the three bands as the server has them; each preset\'s, GEAR in PACK; unsaid, PACK', () => { + expect(BANDS.map((b) => b.id)).toEqual(server.BANDS); + expect(PRESETS.map((p) => `${p.id}:${bandOf(p.type)}`)).toEqual(['weapon:equipped', 'armor:equipped', 'gear:pack', 'consumable:usable', 'spell:usable']); + expect(bandOf({})).toBe('pack'); + expect(bandOf({ on_sheet: 'belt' })).toBe('pack'); + for (const t of [{}, { on_sheet: 'usable' }, { on_sheet: 'belt' }]) expect(bandOf(t), JSON.stringify(t)).toBe(server.bandOf(t)); + }); + + it('changed; PACK, as unsaid, stores nothing; sound each way', () => { + let def = withType(weapons(), 'weapons', { on_sheet: 'usable' }); + expect(typesIn(def)![1].on_sheet).toBe('usable'); + sound(def); + def = withType(def, 'weapons', { on_sheet: 'pack' }); + expect(typesIn(def)![1]).not.toHaveProperty('on_sheet'); + sound(def); + }); +}); diff --git a/frontend/src/sheets/builderHelp.ts b/frontend/src/sheets/builderHelp.ts index 6346a378..e16843b3 100644 --- a/frontend/src/sheets/builderHelp.ts +++ b/frontend/src/sheets/builderHelp.ts @@ -288,6 +288,7 @@ export const HINTS = { 'items.types': 'What kinds of thing your game has, each with columns of its own: WEAPONS with a DAMAGE and AMMO, ARMOR with a DEFENSE. Every system starts with GEAR, a WEIGHT and a PRICE; a sheet shows each type as its own table.', 'items.typeName': 'The type\'s name, as its table on a sheet is headed: WEAPONS.', 'items.one': 'What one of it is called, where the table says one thing: a Weapon.', + 'items.onSheet': 'Where its lines sit on the sheet\'s GEAR tab: EQUIPPED (worn or wielded) at the top, USABLE (used up or used often: potions, ammo, kits), or PACK for the rest. Only where it is drawn; what a line does is the same in any.', 'items.column': 'A column of the type\'s table, named as its head reads. Its name can change; what it is underneath stays, so the values filled in keep.', 'items.kind': 'What the column holds: a NUMBER, TEXT, DAMAGE (dice that are damage), DICE (any other roll, like healing), a COUNT spent and refilled, or PICK ONE of the words you list. A new kind clears what items had filled in for it.', 'items.and': 'What the kind needs besides: a NUMBER\'s unit (LB), a COUNT\'s button (FIRE), the rest that refills it and the items it reloads from (Pistol Rounds), PICK ONE\'s words with commas between.', diff --git a/frontend/src/sheets/gearTypes.ts b/frontend/src/sheets/gearTypes.ts index 8de3c77c..a04e9ce8 100644 --- a/frontend/src/sheets/gearTypes.ts +++ b/frontend/src/sheets/gearTypes.ts @@ -15,6 +15,8 @@ export interface TypeShown { id: string; label: string; one: string; columns: ColumnShown[]; /** The kinds of shop that sell its lines (8a7a2), as the server works them out: the General Store where the GM said none. */ sold_at?: string[]; + /** Its band on the GEAR tab (G1), as the server works it out: PACK where unsaid. */ + on_sheet?: 'equipped' | 'usable' | 'pack'; } export type Value = string | number; diff --git a/frontend/src/sheets/itemTypes.ts b/frontend/src/sheets/itemTypes.ts index 5768ee60..76a48662 100644 --- a/frontend/src/sheets/itemTypes.ts +++ b/frontend/src/sheets/itemTypes.ts @@ -17,7 +17,21 @@ const list = (v: unknown): unknown[] => (Array.isArray(v) ? v : []); export type ColumnKind = 'number' | 'text' | 'damage' | 'dice' | 'count' | 'pick'; /** A column: its name and kind, with what its kind has (a NUMBER's unit, a COUNT's button, rest and reloads, PICK ONE's words). */ export interface ItemColumn { id: string; label: string; kind: ColumnKind; unit?: string; button?: string; refill?: string; reload?: string[]; options?: string[] } -export interface ItemType { id: string; label: string; one?: string; columns: ItemColumn[] } +export interface ItemType { + id: string; label: string; one?: string; columns: ItemColumn[]; + /** Its band on the sheet's GEAR tab (G1): unsaid is PACK. */ + on_sheet?: Band; +} + +/** Where a type's lines sit on the sheet's GEAR tab (G1; approved mockup sheet-gear-layout.html), as the server checks them. */ +export type Band = 'equipped' | 'usable' | 'pack'; +export const BANDS: { id: Band; label: string; why: string }[] = [ + { id: 'equipped', label: 'EQUIPPED', why: 'EQUIPPED: worn or wielded, at the top of GEAR.' }, + { id: 'usable', label: 'USABLE', why: 'USABLE: used up or used often, like potions, ammo and kits.' }, + { id: 'pack', label: 'PACK', why: 'PACK: everything else that is carried.' }, +]; +/** A type's band: what it says, else PACK. */ +export const bandOf = (type: { on_sheet?: unknown }): Band => (BANDS.some((b) => b.id === type.on_sheet) ? type.on_sheet as Band : 'pack'); export const KINDS: { id: ColumnKind; label: string; why: string }[] = [ { id: 'number', label: 'NUMBER', why: 'NUMBER: a value, like a WEIGHT or an armor\'s DEFENSE, with a unit if you want one (LB).' }, @@ -40,15 +54,15 @@ export const GEAR: ItemType = { id: 'gear', label: 'GEAR', one: 'Gear', columns: export const PRESETS: { id: string; label: string; type: ItemType }[] = [ { id: 'weapon', label: 'WEAPON', type: { id: 'weapons', label: 'WEAPONS', one: 'Weapon', columns: [ { id: 'damage', label: 'DAMAGE', kind: 'damage' }, { id: 'range', label: 'RANGE', kind: 'text' }, - { id: 'ammo', label: 'AMMO', kind: 'count', button: 'FIRE' }, weight, price] } }, + { id: 'ammo', label: 'AMMO', kind: 'count', button: 'FIRE' }, weight, price], on_sheet: 'equipped' } }, { id: 'armor', label: 'ARMOR', type: { id: 'armor', label: 'ARMOR', one: 'Armor', columns: [ - { id: 'defense', label: 'DEFENSE', kind: 'number' }, { id: 'type', label: 'TYPE', kind: 'pick', options: ['LIGHT', 'MEDIUM', 'HEAVY'] }, weight, price] } }, + { id: 'defense', label: 'DEFENSE', kind: 'number' }, { id: 'type', label: 'TYPE', kind: 'pick', options: ['LIGHT', 'MEDIUM', 'HEAVY'] }, weight, price], on_sheet: 'equipped' } }, { id: 'gear', label: 'GEAR', type: GEAR }, { id: 'consumable', label: 'CONSUMABLE', type: { id: 'consumables', label: 'CONSUMABLES', one: 'Consumable', columns: [ - { id: 'uses', label: 'USES', kind: 'count', button: 'USE' }, { id: 'effect', label: 'EFFECT', kind: 'dice' }, weight, price] } }, + { id: 'uses', label: 'USES', kind: 'count', button: 'USE' }, { id: 'effect', label: 'EFFECT', kind: 'dice' }, weight, price], on_sheet: 'usable' } }, { id: 'spell', label: 'SPELL', type: { id: 'spells', label: 'SPELLS', one: 'Spell', columns: [ { id: 'level', label: 'LEVEL', kind: 'number' }, { id: 'range', label: 'RANGE', kind: 'text' }, { id: 'damage', label: 'DAMAGE', kind: 'damage' }, - { id: 'charges', label: 'CHARGES', kind: 'count', button: 'CAST', refill: 'long_rest' }] } }, + { id: 'charges', label: 'CHARGES', kind: 'count', button: 'CAST', refill: 'long_rest' }], on_sheet: 'usable' } }, ]; const copy = (v: T): T => JSON.parse(JSON.stringify(v)) as T; @@ -110,11 +124,13 @@ export const withNewType = (def: Definition, preset?: string): { definition: Def }; /** A type's name or what one of it is called; its id stays. A blank ONE stores nothing. */ -export const withType = (def: Definition, id: string, patch: { label?: string; one?: string }): Definition => +export const withType = (def: Definition, id: string, patch: { label?: string; one?: string; on_sheet?: Band }): Definition => withPart(def, itemTypes(def).map((t) => { if (t.id !== id) return t; const next: ItemType = { ...t, ...patch }; if (typeof next.one === 'string' && !next.one.trim()) delete next.one; + // PACK, as unsaid, stores nothing (G1). + if (next.on_sheet === 'pack') delete next.on_sheet; return next; }));