From de3b70dab93372548be85f32fb02e88126ec81a6 Mon Sep 17 00:00:00 2001 From: Developer Date: Sat, 21 Nov 2026 23:51:04 -0600 Subject: [PATCH 1/3] feat: FIND on GEAR, always shown, keeping only the lines that match as you type (name, type, a value or a column, every word), each band counted and open while it has words, its own x and Esc to clear --- CHANGELOG.md | 1 + README.md | 10 ++-- e2e/README.md | 2 +- e2e/tests/sheet-gear-bands.spec.ts | 12 ++++ frontend/src/App.css | 6 ++ frontend/src/components/GearTypeTables.tsx | 36 +++++++++--- .../__tests__/GearTypeTables.test.tsx | 56 +++++++++++++++++++ .../src/sheets/__tests__/gearTypes.test.ts | 36 +++++++++++- frontend/src/sheets/gearTypes.ts | 21 +++++++ 9 files changed, 166 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d16e222..cdcee664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added +- **FIND on GEAR.** A find box at the top of the sheet's GEAR tab, always there, keeps only the things that match as you type: a name, a type (GUNS), a value (2d6, 30 m) or a column (AMMO), in any case, every word somewhere on the line. Each band counts its matches and opens while you search, so nothing in a closed STASH is missed; clear it with its × or Esc and the bands are as you left them. When nothing matches, it says so. SHEET.EXE and the sheet's own tab are the same. - **GEAR in bands.** The sheet's GEAR tab now sorts what you carry into EQUIPPED, USABLE and PACK, by each item type's ON THE SHEET, with a count on each band and what's in hand first. A fourth band, STASH, holds everything left in the stash whatever its type, and says each one's type; it starts closed. Click a band's head to close or open it, and the sheet remembers. The + buttons for adding a thing by hand sit in one row at the top, and the band it lands in opens. SHEET.EXE and the sheet's own tab are the same. - **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. - **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. diff --git a/README.md b/README.md index feb6534f..4e1ced7e 100644 --- a/README.md +++ b/README.md @@ -796,7 +796,7 @@ CITY_NET/ │ │ │ ├── SystemPicker.tsx # GAME tab's system picker: a searchable dropdown, BUILT-IN then YOUR SYSTEMS, portalled into the theme, asking before it switches the game for everyone │ │ │ ├── systemPickerRules.ts # The picker's rules on their own: grouping and order, search, arrow-key movement, what the button says │ │ │ ├── InventorySection.tsx # The inventory table, on every system. Its own file because SheetRenderer is long enough, and generic: which rows carry an extra button, and what pressing it does, is supplied from outside - so a drug offers CONSUME and a skillplug offers LOAD without either knowing about the other A custom system's items (7e3b): the slot counters over it, and WEAR and ATTUNE under a line of an item's name (GearItemLine); an installed item's line locked, named and in place, until REMOVE (7e4c); a custom system with item types gets a table per type instead (8a3a, GearTypeTables.tsx); tells GEAR's bands which lines are worn, attuned or installed, from what the server worked out (G3) -│ │ │ ├── GearTypeTables.tsx # The GEAR tab as a table per item type (8a3a; approved mockup item-types, 2026-11-14): each type's lines under its own column heads, units said; a line's own value over its item's, shown faint until typed over; + a type's one to add a line of it by hand; name, quantity, where and location as the one list has them; ROLL beside each DAMAGE and DICE (8a3b), read only or not, where the viewer may roll; since 8a3c1 a compact line per thing (name, QTY, WHERE, ✎, ×; only the columns it has as words under it, its item's faint, ROLL beside DAMAGE and DICE, a stashed one's place), ✎ opening every column as a box, one line at a time, a line made by hand opened; under ✎ a DAMAGE or DICE with eˣ (8a3c2): what it reads on this character, a name the system hasn't got flagged, SHAPE and INSERT; a COUNT as "AMMO 4 / 6" with its button (FIRE) and RELOAD beside it (8a4b), held while the server answers, RELOAD FROM asking which carried line where there are several, a refusal said on the line; in bands (G2): EQUIPPED, USABLE and PACK by each type's ON THE SHEET, a group per type with lines, in hand first, and STASH, closed to start, each line's type said; a band's head closes it, remembered; a row of + at the top adds a thing of any type by hand, opening its band; one line a thing (G3): its name, how many, its columns as words with ROLL, FIRE and RELOAD, where it is carried, ✎ at its end (or a click on the line) opening its card (NAME, HOW MANY, every column, LOCATION, DONE, REMOVE), FILL IN where nothing at all is filled in opening the card at its first box, a PICK ONE box as wide as its words; a closed band something lands in (worn, bought, given) pulses three times and stays lit in the theme's own color until opened (G3) +│ │ │ ├── GearTypeTables.tsx # The GEAR tab as a table per item type (8a3a; approved mockup item-types, 2026-11-14): each type's lines under its own column heads, units said; a line's own value over its item's, shown faint until typed over; + a type's one to add a line of it by hand; name, quantity, where and location as the one list has them; ROLL beside each DAMAGE and DICE (8a3b), read only or not, where the viewer may roll; since 8a3c1 a compact line per thing (name, QTY, WHERE, ✎, ×; only the columns it has as words under it, its item's faint, ROLL beside DAMAGE and DICE, a stashed one's place), ✎ opening every column as a box, one line at a time, a line made by hand opened; under ✎ a DAMAGE or DICE with eˣ (8a3c2): what it reads on this character, a name the system hasn't got flagged, SHAPE and INSERT; a COUNT as "AMMO 4 / 6" with its button (FIRE) and RELOAD beside it (8a4b), held while the server answers, RELOAD FROM asking which carried line where there are several, a refusal said on the line; in bands (G2): EQUIPPED, USABLE and PACK by each type's ON THE SHEET, a group per type with lines, in hand first, and STASH, closed to start, each line's type said; a band's head closes it, remembered; a row of + at the top adds a thing of any type by hand, opening its band; one line a thing (G3): its name, how many, its columns as words with ROLL, FIRE and RELOAD, where it is carried, ✎ at its end (or a click on the line) opening its card (NAME, HOW MANY, every column, LOCATION, DONE, REMOVE), FILL IN where nothing at all is filled in opening the card at its first box, a PICK ONE box as wide as its words; a closed band something lands in (worn, bought, given) pulses three times and stays lit in the theme's own color until opened (G3); FIND at the top, always shown (G4): only the lines it matches, each band counted by its matches and open while it has words, heads readable but not toggling, its own × and Esc to clear, "Nothing on this sheet matches" when nothing does │ │ │ ├── GearItemLine.tsx # A system's item on its GEAR line (7e3b): its NEEDS tag, WEAR or WORN · TAKE OFF, ATTUNE (ATTUNED · END, the GM's ATTUNE ANYWAY), what it is doing, and its features' uses; the slot counters over the gear (ATTUNED 2 OF 3, amber when full) with the GM's box for one character's own count; and each install's counter, amber at its limit (7e4c) │ │ │ ├── PharmaSection.tsx # What is currently in the bloodstream, drawn in the sheet HEADER rather than a tab: a drug that wears off at the end of a scene and bills System Strain for it is not something to hide behind a tab somebody might not open. Draws nothing at all while a character is on nothing │ │ │ ├── XpWindow.tsx # AWARD_EXPERIENCE — points each rather than a pot to divide, with LEVEL_UP and LEVEL_DOWN for correcting a level on purpose; in a game that spends XP, given to spend, with no level buttons where there are no levels (7f2c2) @@ -1083,7 +1083,7 @@ CITY_NET/ │ │ │ ├── SheetCyberware.test.tsx # The sheet showing what the chrome does, so a correct effects layer is actually read │ │ │ ├── InventorySection.test.tsx # The inventory table editing one field cleanly, though every keystroke rewrites the whole list │ │ │ ├── GearItemLine.test.tsx # WEAR and ATTUNE on GEAR (7e3b): the counter, an item's line under its own row, what pressing asks, a full slot disabled and why, the GM's ATTUNE ANYWAY and own count, read-only, uses ticking, a refusal said, a system without items unchanged; installs (7e4c): the counter, an installed line locked, REMOVE and INSTALL asked, a player's disabled past the limit, the GM's anyway, amber when full -│ │ │ ├── GearTypeTables.test.tsx # The GEAR tab as a table per type (8a3a): each type's lines and heads, an empty type its heading and + only, an item's values faint until typed over, + a type's one by hand staying in its table, read only, a system without types keeping the one list; ROLL beside DAMAGE sending its line and column, nothing to roll nothing to press, read only still there (8a3b); compact lines (8a3c1): only the columns a line has, ✎ one at a time with "none" where it has none, a hand-made line opened, read only without ✎; a DAMAGE under ✎ read on this character, a bad name flagged, never an older text's words, eˣ SHAPE and INSERT (8a3c2); a COUNT's "4 / 6" with FIRE and RELOAD, held while waiting, none left or full, USE by default, RELOAD FROM asked and CANCEL, a refusal on its line (8a4b); in bands (G2): the four in order and counted, in hand first, STASH closed, a head closing and opening its band remembered, the STASH saying each type, an empty band saying so, a thing made by hand opening its band; one line a thing (G3): a click on the line opening its card but not on ROLL or where it is carried, one card at a time, ✎ opening and closing it (none read only), FILL IN only where nothing is filled in, naming the columns and opening at the first (a DAMAGE too), none where something is or a type has no columns, UNNAMED, a PICK ONE box as wide as its words; a worn Cutlass of a PACK type in EQUIPPED, back in PACK taken off; a closed band lit when the server puts something in it, not on opening the sheet, not an open band, cleared when opened, not when the player opens it by hand +│ │ │ ├── GearTypeTables.test.tsx # The GEAR tab as a table per type (8a3a): each type's lines and heads, an empty type its heading and + only, an item's values faint until typed over, + a type's one by hand staying in its table, read only, a system without types keeping the one list; ROLL beside DAMAGE sending its line and column, nothing to roll nothing to press, read only still there (8a3b); compact lines (8a3c1): only the columns a line has, ✎ one at a time with "none" where it has none, a hand-made line opened, read only without ✎; a DAMAGE under ✎ read on this character, a bad name flagged, never an older text's words, eˣ SHAPE and INSERT (8a3c2); a COUNT's "4 / 6" with FIRE and RELOAD, held while waiting, none left or full, USE by default, RELOAD FROM asked and CANCEL, a refusal on its line (8a4b); in bands (G2): the four in order and counted, in hand first, STASH closed, a head closing and opening its band remembered, the STASH saying each type, an empty band saying so, a thing made by hand opening its band; one line a thing (G3): a click on the line opening its card but not on ROLL or where it is carried, one card at a time, ✎ opening and closing it (none read only), FILL IN only where nothing is filled in, naming the columns and opening at the first (a DAMAGE too), none where something is or a type has no columns, UNNAMED, a PICK ONE box as wide as its words; a worn Cutlass of a PACK type in EQUIPPED, back in PACK taken off; a closed band lit when the server puts something in it, not on opening the sheet, not an open band, cleared when opened, not when the player opens it by hand; FIND (G4): as you type, counted, every band open, heads not toggling, × and Esc clearing, as left once cleared and nothing lit, a value and a column, nothing found, read only too │ │ │ ├── conditionNote.test.tsx # The conditions on the token under the number they change (8a5e3): SLOWED: Speed ×0.5 · typed 30 with the halved Speed the big number, clicked to edit what is typed, a skill's line, two on one number, a system with no picks or items, none on the token │ │ │ ├── PharmaSection.test.tsx # Taking a dose from a Readied inventory row, and what is running shown in the sheet header │ │ │ ├── Skillplugs.test.tsx # LOAD on a Readied plug, the granted skill on SKILLS, and what is loaded in the header @@ -1289,7 +1289,7 @@ CITY_NET/ │ │ │ ├── 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) -│ │ │ ├── gearTypes.ts # The GEAR tab's tables as logic (8a3a): the types from the render copy, what fits each column, a line's type (its own, its item's, the first) and its cells (its own value over its item's, the item's only on a line of its type), the tables in the system's order, a value typed, a new line of a type; mirrors the server's lineColumns; shownCells and cellWords, what a compact line shows (8a3c1); countOf, a COUNT left as the server counts it, and "4 / 6" in words (8a4b); gearBands, the GEAR tab's bands (G2): each type's lines in its ON THE SHEET band, in hand first, groups only for types with lines, and every stashed line in STASH; a line worn, attuned or installed in EQUIPPED whatever its type's band (G3); landedIn, the closed bands something landed in between two drawings (G3) +│ │ │ ├── gearTypes.ts # The GEAR tab's tables as logic (8a3a): the types from the render copy, what fits each column, a line's type (its own, its item's, the first) and its cells (its own value over its item's, the item's only on a line of its type), the tables in the system's order, a value typed, a new line of a type; mirrors the server's lineColumns; shownCells and cellWords, what a compact line shows (8a3c1); countOf, a COUNT left as the server counts it, and "4 / 6" in words (8a4b); gearBands, the GEAR tab's bands (G2): each type's lines in its ON THE SHEET band, in hand first, groups only for types with lines, and every stashed line in STASH; a line worn, attuned or installed in EQUIPPED whatever its type's band (G3); landedIn, the closed bands something landed in between two drawings (G3); lineWords and foundIn, FIND on GEAR (G4): a line found by its name, type, band, where it is carried and is, and each column with its words, every word typed somewhere on it │ │ │ ├── gearDice.ts # A gear line's DAMAGE or DICE in words (8a3c2): ON THIS CHARACTER with each name's value and the range, or what is wrong; the eˣ shapes and INSERT at the cursor │ │ │ ├── rollTotal.ts # A roll line's final total, found for the dice history to bold: after the last = in its first [ ], or the lone number; never what follows a · │ │ │ ├── catalogueItems.ts # A system's items in the shops' catalogues (7e3c): the preview's lines read against the items (named as one, landing as gear or not; nearly named, the closest said), the shelf a starter file uses (the gear's, or the first landing as gear), and the starter file itself, prices left blank; with types of its own, DOWNLOAD ITEMS puts each item in its type's section with its columns, and a type's section counts as gear in the preview (8a7a1); ITEMS_ADDED_EVENT and withAddedItems, a catalogue's new items merged into a draft by id (8a7a4a) @@ -1343,7 +1343,7 @@ CITY_NET/ │ │ │ ├── encumbrance.test.ts # The builder's ENCUMBRANCE as logic (8a5c): written tidy with the items kept, what it can count, how it starts held to the server's check, COUNTED BY's unit, the bands, the names formulas read held to the server's; a band's words and condition kept through every edit (8a5d1); blank words and NONE kept as nothing, cut at 200, held to the server's check (8a5d2) │ │ │ ├── ranks.test.ts # Ranks as logic (7f1b): each preset sound as the server checks it, copies never the preset, lists and ranks changed, moved and removed with AT START following, HOLDS and AT START │ │ │ ├── gearItems.test.ts # Items on GEAR as logic (7e3b): the line each item draws on, what a save worked out read safely, the slot's verb, every state's buttons and words for player, GM and read-only, the counters, the GM's box, uses; installs (7e4c): room each way with rounding, every state's buttons and words, the counters, the names installed -│ │ │ ├── gearTypes.test.ts # The GEAR tab's tables as logic (8a3a): the types read, what fits each kind as the server's check, each line's type and values as the server's lineColumns on the same lines, the tables, values typed, a line's type, values and counts kept on the sheet and on the server, bought one more of; a COUNT left held to the server's lineColumns on the same lines (8a4b); gearBands (G2): each band's lines and count, in hand first then as listed, no group for a type with none there, an unknown band as PACK, stashed lines in STASH whatever the type; a line on you in EQUIPPED in a group of its type, the rest by type, stashed still the STASH, no empty group for an EQUIPPED type whose lines are all stashed (G3); landedIn: a closed band whose count went up, not an open one or one that fell, nothing before the first drawing (G3) +│ │ │ ├── gearTypes.test.ts # The GEAR tab's tables as logic (8a3a): the types read, what fits each kind as the server's check, each line's type and values as the server's lineColumns on the same lines, the tables, values typed, a line's type, values and counts kept on the sheet and on the server, bought one more of; a COUNT left held to the server's lineColumns on the same lines (8a4b); gearBands (G2): each band's lines and count, in hand first then as listed, no group for a type with none there, an unknown band as PACK, stashed lines in STASH whatever the type; a line on you in EQUIPPED in a group of its type, the rest by type, stashed still the STASH, no empty group for an EQUIPPED type whose lines are all stashed (G3); landedIn: a closed band whose count went up, not an open one or one that fell, nothing before the first drawing (G3); foundIn (G4): by name, type, band, place, a column and its words, any case, every word, no group for a type with nothing found, blank as they are │ │ │ ├── rollTotal.test.ts # A roll line's final total: the new and old forms, the tray's own, symbols, a later [ ] or · passed over, the line put back unchanged │ │ │ ├── catalogueItems.test.ts # Items in catalogues (7e3c): how far apart two names are, a line named as an item, one landing in its own rows, near misses by marks or a letter or two, the closest named, nothing without items, the starter file on the gear's shelf or the next │ │ │ ├── levels.test.ts # The table held to the server's, the ranges staying joined, adding and taking one off, typing over, what the boxes show, how they advance, the word @@ -1545,7 +1545,7 @@ CITY_NET/ │ ├── sheet-bonus-ways.spec.ts # The ways a bonus counts at the table (7e1): two +2s each stopping at 20, the cut one named on the badge; an AT LEAST lifts what they leave │ ├── sheet-worn-items.spec.ts # Items at the table (7e3b): WEAR and ATTUNE on GEAR, the ring's +2 CON once attuned and the slot full, a second worn with nothing to press, the GM's ATTUNE ANYWAY and own count, END, taken off still attuned; GIVE.EXE's ITEMS handing the ring to a player, who wears it; TERMINATE_SESSION closing GIVE.EXE at once │ ├── sheet-item-types.spec.ts # The GEAR tab as a table per type (8a3a): a stick made by hand with its own DAMAGE and GRADE, a line named like the Pistol showing its values faint, RANGE typed over, a rope in GEAR, saved as made, each in its table after a reload; compact lines with ✎ and DONE, and nothing on the GEAR tab scrolling sideways in SHEET.EXE (8a3c1); the Pistol's DAMAGE read on this character under ✎, a bad name flagged, eˣ INSERT (8a3c2); in bands (G2), PACK saying "Nothing here." and things added from the row of + at the top; the Pistol's card opened by a click on its name (G3) -│ ├── sheet-gear-bands.spec.ts # The GEAR tab in bands (G2): a Sword, a Draught and a Rope added by hand land in EQUIPPED, USABLE and PACK, counted; the Sword stashed moves to STASH, which opens and says WEAPONS; USABLE closed by its head stays closed on the next visit; the Draught's blank HEALS filled from FILL IN, its card opened at that box (G3); a Cloak of GEAR worn into EQUIPPED and taken off back into PACK, EQUIPPED closed first and lit when the Cloak is worn +│ ├── sheet-gear-bands.spec.ts # The GEAR tab in bands (G2): a Sword, a Draught and a Rope added by hand land in EQUIPPED, USABLE and PACK, counted; the Sword stashed moves to STASH, which opens and says WEAPONS; USABLE closed by its head stays closed on the next visit; the Draught's blank HEALS filled from FILL IN, its card opened at that box (G3); a Cloak of GEAR worn into EQUIPPED and taken off back into PACK, EQUIPPED closed first and lit when the Cloak is worn; FIND 2d4 showing the Draught in a closed USABLE, nothing for lantern, cleared and USABLE closed again (G4) │ ├── sheet-gear-counts.spec.ts # A gear line's COUNT at the table (8a4): the Pistol's AMMO 2 / 6, FIRE spending one, RELOAD asking between Pistol Rounds and AP Rounds and using the AP Rounds up, then full from the Pistol Rounds; the Wand's CHARGES filled by a short rest from the sheet │ ├── sheet-standalone-tab.spec.ts # The sheet in a new tab (8s1a): opened with ⧉, in the theme, WEAR there works and SHEET.EXE says so, a weapon's DAMAGE rolled from it; the roll from the tab opening the main app's dice tray (8s1b); a character being made: CREATING · CONTINUE on the tab opening NEW_CHARACTER.EXE there (8s1c); Cash on the tab opening BANK.EXE in the main window, and with that window closed the tab saying to open it (8s1d); gear added from the row of + at the top of GEAR (G2) │ ├── sheet-vitals.spec.ts # The vitals strip (8s3b): DAMAGE in SHEET.EXE and HEAL on the ⧉ tab moving the token and both sheets; the HP bar opening HEALTH in place on the tab; a condition put on in SHEET.EXE shown on the tab and taken off there, and a long rest taken from the tab's REST ▾ (8s3c); two tracks: STUN picked, damage past its maximum spilling into PHYSICAL, said (8s3d1); the GM taking damage off a player from the box in their view of the sheet, the player's SHEET.EXE following (8s3d2) diff --git a/e2e/README.md b/e2e/README.md index 5bdeadfb..1ac8a627 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -206,7 +206,7 @@ kept; the job itself stops at 30 (`timeout-minutes`), for a hang outside the tes | `tests/sheet-ranks-start.spec.ts` | Ranks making a character (7f1c2): a player in NEW CHARACTER types Grit, finds Lore under RANKS with UP TO TRAINED TO START and EXPERT off, picks TRAINED, and the server keeps the step 1 with Lore worth 2 | | `tests/sheet-worn-items.spec.ts` | Items at the table (7e3b): two GEAR lines named like items get WEAR and ATTUNE; the ring worn does nothing yet, attuned it is WORKING, ATTUNED 1 OF 1, CON 14 → 16; the cloak worn with no slot free says so and can't attune; the GM, on the player's sheet, ATTUNES it ANYWAY (2 OF 1) and gives them 2 of their own; END frees the ring's slot and its +2 goes; the cloak taken off stays attuned and does nothing. A second test: the GM's GIVE.EXE lists the ring under ITEMS with NEEDS ATTUNED and its words, gives it to the player as a stowed gear line, the player is told and WEARS it; TERMINATE_SESSION closes GIVE.EXE while the session is still ending | | `tests/sheet-item-types.spec.ts` | The GEAR tab as a table per item type (8a3a): a player's sheet with WEAPONS and GEAR tables, each empty with its +; + WEAPON made A stick with DAMAGE 1d4 and GRADE HEAVY; a second line named Pistol showing 2d6 + @might faint, its RANGE typed over to 50 m; + GEAR made Rope at 10 lb; saved as made, each in its table after a reload; since 8a3b the stick's DAMAGE rolled with ROLL, "rolled A stick DAMAGE 1d4" in the dice tray's history; and (8a3c1) as compact lines: a line made by hand opened under ✎, DONE showing its words with ROLL, the Pistol's RANGE read as words after the reload, and no box on the GEAR tab scrolling sideways in SHEET.EXE; and (8a3c2) the Pistol's DAMAGE under ✎ said ON THIS CHARACTER: 2d6 + Might (12): 14 to 24, @strength flagged as not the system's, eˣ INSERT putting in @might; and (G2) in bands: PACK says "Nothing here." with no WEAPONS group before anything is carried, and things are added from the row of + at the top; and (G3) the Pistol's card opened by a click on its name | -| `tests/sheet-gear-bands.spec.ts` | The GEAR tab in bands (G2): a game with WEAPONS EQUIPPED, POTIONS USABLE and GEAR unsaid; a player adds a Sword, a Draught and a Rope from the row of + at the top, each in its band and counted (EQUIPPED · 1, USABLE · 1, PACK · 1, STASH · 0 closed), saved as made; the Sword moved to the stash goes to STASH, which opens and says WEAPONS, EQUIPPED left at 0; USABLE closed by its head, and on the next visit USABLE is still closed and PACK open; and (G3) one line a thing: the Draught's HEALS blank, so FILL IN, which opens its card at that box, ready to type; 2d4 typed, DONE, the line says HEALS 2d4 and FILL IN is gone, saved; a Cloak, GEAR, made by hand sits in PACK, WEAR puts it in EQUIPPED (EQUIPPED · 1), taken off it is back in PACK; with EQUIPPED closed, WEAR lights its head (▸ EQUIPPED · 1), opened it is plain again | +| `tests/sheet-gear-bands.spec.ts` | The GEAR tab in bands (G2): a game with WEAPONS EQUIPPED, POTIONS USABLE and GEAR unsaid; a player adds a Sword, a Draught and a Rope from the row of + at the top, each in its band and counted (EQUIPPED · 1, USABLE · 1, PACK · 1, STASH · 0 closed), saved as made; the Sword moved to the stash goes to STASH, which opens and says WEAPONS, EQUIPPED left at 0; USABLE closed by its head, and on the next visit USABLE is still closed and PACK open; and (G3) one line a thing: the Draught's HEALS blank, so FILL IN, which opens its card at that box, ready to type; 2d4 typed, DONE, the line says HEALS 2d4 and FILL IN is gone, saved; a Cloak, GEAR, made by hand sits in PACK, WEAR puts it in EQUIPPED (EQUIPPED · 1), taken off it is back in PACK; with EQUIPPED closed, WEAR lights its head (▸ EQUIPPED · 1), opened it is plain again; and (G4) FIND: 2d4 shows the Draught in USABLE, closed, opened while it shows (PACK · 0), lantern says nothing matches, cleared USABLE is closed again | | `tests/sheet-gear-counts.spec.ts` | A gear line's COUNT at the table (8a4): a player's Pistol at AMMO 2 / 6 spends one with FIRE; RELOAD, with Pistol Rounds and AP Rounds both carried, asks which and takes all 3 AP Rounds, their line gone; RELOAD again takes 2 of the Pistol Rounds alone, full, RELOAD held; the Wand's CHARGES, with no RELOAD, filled by a SHORT REST from the sheet | | `tests/sheet-standalone-tab.spec.ts` | The sheet in a new tab is the window (8s1a): a player makes two gear lines in SHEET.EXE, opens the tab with ⧉ (a `.crt-container`, so in the theme), WEARs the boots there and SHEET.EXE says WORKING too, and rolls the club's DAMAGE from the tab, said on it once the dice land; since 8s1b the roll from the tab opens DICE_TRAY.EXE in the main app's window; and (8s1c) a character being made: the flow left, SHEET.EXE says CREATING · CONTINUE, the tab says it too and opens NEW_CHARACTER.EXE on itself; and (8s1d) Cash on the tab opens BANK.EXE in the main window and the tab says so, then with the main window closed the tab says to open it; and (G2) gear added from the row of + at the top of GEAR | | `tests/sheet-vitals.spec.ts` | The vitals strip (8s3b): a player with a token takes 5 with DAMAGE in SHEET.EXE (the token and the bar at 15/20), opens the ⧉ tab and HEALs 3 there (18/20 on the token, the tab and SHEET.EXE), then clicks the tab's HP bar and HEALTH's own panel opens in place; and (8s3c) PRONE put on under the box in SHEET.EXE, shown on the tab as a chip and taken off there, then REST ▾ on the tab taking a LONG REST, asked first, the stat it refills set; the box's HIT POINTS ▾ wholly under the numbers with the slash centered over it, and the conditions list as wide as the box; and CWN in SHEET.EXE: MELEE AC and RANGED AC shown, no two of HEAL, DAMAGE, STIM, HIT POINTS, + CONDITION, the AC and REST overlapping, and every button's words inside it; the AC centered between + CONDITION and REST; and (8s3d1) a two-track system: STUN MAX set on the sheet, STUN picked above the box, 6 damage filling it with 2 spilling into PHYSICAL (18/20 on the token), STUN FULL · 2 SPILLED INTO PHYSICAL said; and (8s3d2) the GM opens a player's sheet (GLOBAL_CHAT, VIEW_PLAYER_INFO, OPEN_SHEET) and takes 5 with the box there: the token at 15, the GM's box and the player's own SHEET.EXE saying 15. Since 8a6c the chip is clicked open, as wide as the box, and taken off with TAKE OFF | diff --git a/e2e/tests/sheet-gear-bands.spec.ts b/e2e/tests/sheet-gear-bands.spec.ts index b0436dee..16efa372 100644 --- a/e2e/tests/sheet-gear-bands.spec.ts +++ b/e2e/tests/sheet-gear-bands.spec.ts @@ -81,6 +81,18 @@ test('GEAR in bands: EQUIPPED, USABLE, PACK by type, a sword stashed into the ST await expect(head('USABLE')).toHaveAttribute('aria-expanded', 'false'); await expect(head('PACK')).toHaveAttribute('aria-expanded', 'true'); + // FIND (G4): always there; 2d4 finds the Draught in USABLE, closed, opened while it shows; cleared, USABLE closed again. + const find = mine.getByRole('searchbox', { name: 'Find in your gear' }); + await find.fill('2d4'); + await expect(head('USABLE')).toHaveText('▾ USABLE · 1'); + await expect(band('USABLE').getByRole('button', { name: 'Draught, item 2', exact: true })).toBeVisible(); + await expect(head('PACK')).toHaveText('▾ PACK · 0'); + await find.fill('lantern'); + await expect(mine.getByRole('status', { name: 'What FIND found' })).toHaveText('Nothing on this sheet matches “lantern”.'); + await find.fill(''); + await expect(head('USABLE')).toHaveAttribute('aria-expanded', 'false'); + await expect(head('USABLE')).toHaveText('▸ USABLE · 1'); + // A Cloak, GEAR, in PACK; worn, EQUIPPED; taken off, PACK again (G3: "my Cutlass is worn, should it be in EQUIPPED?"). await add.getByRole('button', { name: 'Add a Gear by hand' }).click(); await mine.getByLabel('Item 4 name', { exact: true }).fill('Cloak'); diff --git a/frontend/src/App.css b/frontend/src/App.css index ef12836f..4307c646 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -1371,6 +1371,12 @@ button.choice-off:disabled { .gear-band-news { animation: none; } } +/* FIND on GEAR (G4) has its own × in the theme; the browser's is blue whatever the theme. */ +.gear-find::-webkit-search-cancel-button { + -webkit-appearance: none; + appearance: none; +} + .login-panel h1 { letter-spacing: 10px; margin-bottom: 5px; diff --git a/frontend/src/components/GearTypeTables.tsx b/frontend/src/components/GearTypeTables.tsx index 1decbf55..cd1129b3 100644 --- a/frontend/src/components/GearTypeTables.tsx +++ b/frontend/src/components/GearTypeTables.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useEffectEvent, useRef, useState } from 'react'; import { CARRY_STATES, type InventoryItem } from '../sheets/inventory'; import type { ItemsShown } from '../sheets/gearItems'; -import { gearTables, gearBands, valueText, withLineValue, newLineOf, shownCells, cellWords, countOf, type Cell, type CountAnswer, type CountKind, type TableRow, type TypeShown } from '../sheets/gearTypes'; +import { gearTables, gearBands, foundIn, valueText, withLineValue, newLineOf, shownCells, cellWords, countOf, type Cell, type CountAnswer, type CountKind, type TableRow, type TypeShown } from '../sheets/gearTypes'; import { useGearBands } from '../hooks/useGearBands'; import { diceWords, SHAPES, shapeText, insertName, type GearDiceRead } from '../sheets/gearDice'; import { FormulaIcon } from './FormulaIcon'; @@ -17,7 +17,8 @@ import { FormulaIcon } from './FormulaIcon'; // docs/mockups/sheet-gear-layout.html, layout A): EQUIPPED, USABLE and PACK by each type's ON THE SHEET, a group per type, // in hand first; STASH, closed to start, whatever the type; a band's head closes it and the sheet remembers. A thing is // made by hand from the row of + buttons at the top; a closed band something lands in pulses, then stays bright until -// opened; a thing worn, attuned or installed is in EQUIPPED whatever its type. One line a thing (G3; the same mockup, decision 3): its name, how many, +// opened; FIND at the top, always shown, keeps only the lines it matches, every band open while it has words (G4); +// a thing worn, attuned or installed is in EQUIPPED whatever its type. One line a thing (G3; the same mockup, decision 3): its name, how many, // the columns it has as words with ROLL, FIRE and RELOAD, where it is carried; a click on it opens the card, every column a // box with NAME, HOW MANY, LOCATION and REMOVE, one card at a time; ✎ at the end of every line opens it too. A line with // nothing filled in at all, on it or its item, says FILL IN, which opens the card at its first box: a column blank beside @@ -177,7 +178,13 @@ export function GearTypeTables({ items, itemsShown, readOnly, write, locked, on, }); }; const bands = gearBands(itemsShown, items, on); + // The counts of everything, not of what FIND shows: clearing it is nothing landing anywhere. const { shut, toggle, openBand, news } = useGearBands(Object.fromEntries(bands.map((b) => [b.band, b.count]))); + // FIND (G4): as typed, not kept; while it has words every band is open and shows only its matches. + const [find, setFind] = useState(''); + const finding = find.trim() !== ''; + const shown = foundIn(bands, find); + const found = shown.reduce((n, b) => n + b.count, 0); const bandOfType = (type: TypeShown) => (type.on_sheet === 'equipped' || type.on_sheet === 'usable' ? type.on_sheet : 'pack'); /** One line a thing (G3), by its place; a click opens its card. `tagged`, in the STASH, says its type. */ const lineView = ({ index: i, line, columns: lc }: TableRow, type: TypeShown, tagged = false) => { @@ -307,6 +314,17 @@ export function GearTypeTables({ items, itemsShown, readOnly, write, locked, on, }; return (
+ {/* The box, and its own × in the theme (the browser's is blue in every theme): Esc clears it too. */} + + setFind(e.target.value)} onKeyDown={(e) => { if (e.key === 'Escape') setFind(''); }} style={{ ...input, flex: 1 }} /> + {find !== '' && ( + + )} + + {finding && found === 0 && ( + Nothing on this sheet matches “{find.trim()}”. + )} {/* A thing made by hand, of any type (G2): it opens under ✎ in its type's band, opened if closed. */} {!readOnly && (
@@ -316,20 +334,24 @@ export function GearTypeTables({ items, itemsShown, readOnly, write, locked, on, ))}
)} - {bands.map((b) => { - const closed = shut.has(b.band); + {!(finding && found === 0) && shown.map((b) => { + // While FIND has words, every band open to show what it matched; as left once cleared. + const closed = !finding && shut.has(b.band); // Something landed in it while closed (G3): a short pulse, then bright until opened (opening clears it). const fresh = news.has(b.band); return (
- {!closed && (b.count === 0 - ? Nothing here. + // While finding, a band with no match says so by its · 0 alone. + ? (finding ? null : Nothing here.) : <> {b.groups.map(({ type, rows }) => (
diff --git a/frontend/src/components/__tests__/GearTypeTables.test.tsx b/frontend/src/components/__tests__/GearTypeTables.test.tsx index b4948295..3bc06f75 100644 --- a/frontend/src/components/__tests__/GearTypeTables.test.tsx +++ b/frontend/src/components/__tests__/GearTypeTables.test.tsx @@ -490,3 +490,59 @@ describe('one line a thing, its card on a click (G3)', () => { expect((screen.getByLabelText('Item 1 RANGE') as HTMLInputElement).style.width).toBe('100%'); }); }); + +describe('FIND on GEAR (G4)', () => { + const TYPES: ItemsShown = { + slots: [], list: [], + types: [ + { id: 'weapons', label: 'WEAPONS', one: 'Weapon', on_sheet: 'equipped', columns: [{ id: 'damage', label: 'DAMAGE', kind: 'damage' }] }, + { id: 'gear', label: 'GEAR', one: 'Gear', columns: [] }, + ], + }; + const lines = [line('Sword', { type: 'weapons', values: { damage: '1d8' } }), line('Rope', { type: 'gear' }), line('Spare Sword', { type: 'weapons', carry: 'stash', values: { damage: '1d8' } })]; + const box = () => screen.getByRole('searchbox', { name: 'Find in your gear' }) as HTMLInputElement; + const band = (label: string) => screen.getByRole('region', { name: `${label} band` }); + const head = (label: string) => within(band(label)).getByRole('button', { name: new RegExp(`^[▸▾] ${label} · \\d+$`) }); + + it('always there; as you type only what matches, counted, every band open; cleared, as left', async () => { + show(lines, { items: TYPES }); + expect(box().placeholder).toBe('Find on your sheet: a name, a type, 2d6, AMMO…'); + expect(head('STASH').textContent).toBe('▸ STASH · 1'); + await userEvent.type(box(), 'sword'); + expect(screen.getAllByRole('button', { name: /^[▸▾] [A-Z]+ · \d+$/ }).map((b) => b.textContent)).toEqual(['▾ EQUIPPED · 1', '▾ USABLE · 0', '▾ PACK · 0', '▾ STASH · 1']); + expect(within(band('STASH')).getByRole('button', { name: 'Spare Sword, item 3' })).toBeTruthy(); + expect(screen.queryByRole('button', { name: 'Rope, item 2' })).toBeNull(); + // A band with no match: its · 0 alone, no "Nothing here." under it. + expect(within(band('PACK')).queryByText('Nothing here.')).toBeNull(); + // Heads can't open or close while it shows what it found, but stay readable (not disabled, which is drawn faint). + expect(head('STASH').getAttribute('aria-disabled')).toBe('true'); + expect((head('STASH') as HTMLButtonElement).disabled).toBe(false); + expect(head('STASH').title).toBe('Showing what FIND matched: clear it to open or close bands'); + await userEvent.click(head('STASH')); + // Its own × clears it. + await userEvent.click(screen.getByRole('button', { name: 'Clear FIND' })); + expect(box().value).toBe(''); + expect(screen.queryByRole('button', { name: 'Clear FIND' })).toBeNull(); + // As left: the click while finding changed nothing. + expect(head('STASH').textContent).toBe('▸ STASH · 1'); + expect(head('STASH').getAttribute('aria-disabled')).toBeNull(); + expect(within(band('USABLE')).getByText('Nothing here.')).toBeTruthy(); + // Esc clears it too. + await userEvent.type(box(), 'rope{Escape}'); + expect(box().value).toBe(''); + expect(screen.getByRole('button', { name: 'Rope, item 2' })).toBeTruthy(); + // Cleared, nothing lit: nothing landed anywhere. + expect(screen.getAllByRole('button', { name: /^[▸▾] [A-Z]+ · \d+$/ }).filter((b) => b.className)).toEqual([]); + }); + + it('by a value and a column; nothing found says so, with no bands; read only too', async () => { + show(lines, { items: TYPES, readOnly: true }); + await userEvent.type(box(), 'damage 1d8'); + expect(head('EQUIPPED').textContent).toBe('▾ EQUIPPED · 1'); + expect(head('STASH').textContent).toBe('▾ STASH · 1'); + await userEvent.clear(box()); + await userEvent.type(box(), 'lantern'); + expect(screen.getByRole('status', { name: 'What FIND found' }).textContent).toBe('Nothing on this sheet matches \u201clantern\u201d.'); + expect(screen.queryByRole('region', { name: /band$/ })).toBeNull(); + }); +}); diff --git a/frontend/src/sheets/__tests__/gearTypes.test.ts b/frontend/src/sheets/__tests__/gearTypes.test.ts index 4810c80e..98f29c1d 100644 --- a/frontend/src/sheets/__tests__/gearTypes.test.ts +++ b/frontend/src/sheets/__tests__/gearTypes.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect } from 'vitest'; import { createRequire } from 'module'; -import { typesOf, fits, itemOfLine, lineColumns, gearTables, valueText, withLineValue, newLineOf, countOf, cellWords, LIMITS, type ColumnShown , gearBands, landedIn } from '../gearTypes'; +import { typesOf, fits, itemOfLine, lineColumns, gearTables, valueText, withLineValue, newLineOf, countOf, cellWords, LIMITS, type ColumnShown , gearBands, landedIn, foundIn } from '../gearTypes'; import { normaliseItem, readInventory, type InventoryItem } from '../inventory'; import type { ItemsShown } from '../gearItems'; @@ -224,3 +224,37 @@ describe('what landed in a closed band (G3)', () => { expect(landedIn(null, { equipped: 1, usable: 1, pack: 1, stash: 1 }, shut as never)).toEqual([]); }); }); + +describe('FIND on GEAR (G4)', () => { + const SHOWN = { + slots: [], list: [{ id: 'pistol', label: 'Pistol', needs: 'carried', features: [], type: 'guns', values: { damage: '2d6', ammo: 6 } }], + types: [ + { id: 'guns', label: 'GUNS', one: 'Gun', on_sheet: 'equipped', columns: [{ id: 'damage', label: 'DAMAGE', kind: 'damage' }, { id: 'ammo', label: 'AMMO', kind: 'count' }] }, + { id: 'gear', label: 'GEAR', one: 'Gear', columns: [{ id: 'weight', label: 'WEIGHT', kind: 'number', unit: 'LB' }] }, + ], + } as never; + const at = (name: string, type: string, more = {}) => ({ name, qty: 1, enc: '', bundled: false, carry: 'stowed', location: '', type, ...more }) as never; + const lines = [at('Pistol', 'guns'), at('Rope', 'gear', { values: { weight: 5 } }), at('Old Rifle', 'guns', { carry: 'stash', location: 'the van', values: { damage: '2d8' } })]; + const names = (text: string) => foundIn(gearBands(SHOWN, lines), text).map((b) => [b.band, b.count, [...b.groups.flatMap((g) => g.rows), ...b.loose.map((l) => l.row)].map((r) => r.line.name)]); + + it('by name, type, band, where it is, a column and its words, in any case; every word somewhere on the line', () => { + expect(names('pistol')).toEqual([['equipped', 1, ['Pistol']], ['usable', 0, []], ['pack', 0, []], ['stash', 0, []]]); + expect(names('GUNS').map(([, n]) => n)).toEqual([1, 0, 0, 1]); + expect(names('2d6').map(([, n]) => n)).toEqual([1, 0, 0, 0]); + expect(names('ammo 6 / 6')).toEqual(names('pistol')); + expect(names('weight 5').map(([, n]) => n)).toEqual([0, 0, 1, 0]); + expect(names('pack').map(([, n]) => n)).toEqual([0, 0, 1, 0]); + expect(names('van').map(([, n]) => n)).toEqual([0, 0, 0, 1]); + expect(names('stash 2d8').map(([, n]) => n)).toEqual([0, 0, 0, 1]); + // Both words, not either. + expect(names('pistol rope').map(([, n]) => n)).toEqual([0, 0, 0, 0]); + // A type with nothing found has no group. + expect(foundIn(gearBands(SHOWN, lines), 'rope')[0].groups).toEqual([]); + }); + + it('blank or spaces: the bands as they are', () => { + const bands = gearBands(SHOWN, lines); + expect(foundIn(bands, '')).toBe(bands); + expect(foundIn(bands, ' ')).toBe(bands); + }); +}); diff --git a/frontend/src/sheets/gearTypes.ts b/frontend/src/sheets/gearTypes.ts index 1f442833..fdbb0d4e 100644 --- a/frontend/src/sheets/gearTypes.ts +++ b/frontend/src/sheets/gearTypes.ts @@ -128,6 +128,27 @@ export const gearBands = (shown: ItemsShown | null | undefined, lines: Inventory export const landedIn = (before: Partial> | null, after: Partial>, shut: Set): GearBand[] => before ? GEAR_BANDS.map((b) => b.id).filter((id) => shut.has(id) && (after[id] ?? 0) > (before[id] ?? 0)) : []; +/** + * FIND on the GEAR tab (G4; approved mockup docs/mockups/sheet-gear-layout.html, decision 4, "as you type"; always shown, + * the user 2026-11-22). A line is found by its name, its type, its band, where it is carried and where it is, and each + * column it has with its words ("AMMO 4 / 6", "DAMAGE 2d6"), in any case; every word typed must be somewhere on it. + */ +export const lineWords = (row: TableRow, type: TypeShown, band: string): string => + [row.line.name, type.label, type.one, band, row.line.carry === 'stash' ? 'stash' : row.line.carry, row.line.location, + ...shownCells(row.columns).map((c) => `${c.column.label} ${cellWords(c, row.line)}`)].join(' ').toLowerCase(); + +/** The bands showing only what FIND matches, each counted by its matches; blank, the bands as they are. */ +export const foundIn = (bands: BandShown[], text: string): BandShown[] => { + const words = text.toLowerCase().split(/\s+/).filter(Boolean); + if (!words.length) return bands; + const hit = (row: TableRow, type: TypeShown, band: string) => { const on = lineWords(row, type, band); return words.every((w) => on.includes(w)); }; + return bands.map((b) => { + const groups = b.groups.map((g) => ({ type: g.type, rows: g.rows.filter((r) => hit(r, g.type, b.label)) })).filter((g) => g.rows.length > 0); + const loose = b.loose.filter(({ type, row }) => hit(row, type, b.label)); + return { ...b, groups, loose, count: groups.reduce((n, g) => n + g.rows.length, 0) + loose.length }; + }); +}; + /** A value as a box shows it. */ export const valueText = (v: Value | undefined): string => (v === undefined ? '' : String(v)); From 7c11f089a23ec6f5e7ad65b53b4244913438d7de Mon Sep 17 00:00:00 2001 From: Developer Date: Sat, 21 Nov 2026 23:53:54 -0600 Subject: [PATCH 2/3] style: 8px between GEAR's counters and FIND on a typed GEAR tab, as inside it --- frontend/src/components/InventorySection.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/InventorySection.tsx b/frontend/src/components/InventorySection.tsx index 6ad1516e..95c28e0d 100644 --- a/frontend/src/components/InventorySection.tsx +++ b/frontend/src/components/InventorySection.tsx @@ -130,7 +130,8 @@ export function InventorySection({ section, data, readOnly, onFieldChange, rowAc ].join(' '); return ( -
+ // Typed GEAR keeps 8px between its parts, as inside it: the counters, then FIND (G4; the user found them too close). +
{/* Scrollable: an inventory grows, and the tab strip below should not move every time somebody picks up a rope. */} From f2bf7c11a190fcd3a2755c07f3b7c79e78b7f1a4 Mon Sep 17 00:00:00 2001 From: Developer Date: Sun, 22 Nov 2026 00:16:17 -0600 Subject: [PATCH 3/3] feat: slot and install counters on GEAR only where something on the sheet uses them, worn, carried or stashed, or still counted against --- CHANGELOG.md | 1 + README.md | 10 ++++----- e2e/README.md | 2 +- e2e/tests/sheet-worn-items.spec.ts | 2 ++ frontend/src/components/InventorySection.tsx | 8 ++++--- .../__tests__/GearTypeTables.test.tsx | 21 +++++++++++++++++++ .../src/sheets/__tests__/gearItems.test.ts | 19 ++++++++++++++++- frontend/src/sheets/gearItems.ts | 12 +++++++++++ 8 files changed, 65 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdcee664..7443e2e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -800,6 +800,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed +- **Slot and install counters only where they are used.** On GEAR, a counter like ATTUNED 0 OF 3 or CYBERWARE · STRAIN 0 OF 2 shows only once something on that sheet needs it, worn, carried or stashed, or while anything is still counted against it. A character with no cyberware no longer sees STRAIN 0 OF 0. - **One line a thing on GEAR.** Each thing on the sheet's GEAR tab is now a single line: its name, how many, its values with ROLL, FIRE and RELOAD beside them, and where it is carried, still changed with one click. The ✎ at the end of each line opens its card (a click on the line does too), with NAME, HOW MANY, every column, LOCATION, DONE and REMOVE; one card is open at a time. A line with nothing filled in at all shows a dashed FILL IN, which opens the card at its first box, ready to type; a column left blank beside others means it doesn't apply, so it says nothing. A pick-one box such as GRADE is now as wide as its words, not the whole card. Anything worn, attuned or installed now sits in EQUIPPED, whatever band its type is in, and goes back when taken off. When something lands in a closed band (worn, bought or given), its header pulses briefly and stays lit until you open it; with reduced motion turned on, it is only lit. SHEET.EXE and the sheet's own tab are the same. - **Long shop shelves stay quick.** A shelf with hundreds of lines now shows 200 at a time, with more as you scroll down, or press SHOW MORE. A line says how many there are, and filtering and sorting still cover every line. Typing in the filter no longer waits for the list to redraw. On a 1000-line shelf, sorting went from about 0.4 s to 0.15 s, and opening it from 0.6 s to 0.26 s. Saving a big catalogue is about five times faster. - **The initiative tracker for a GM running several fights.** The tracker window now opens beside the INITIATIVE menu instead of on top of it, so ACTIVE COMBATS stays in view and the GM can jump from fight to fight with the tracker open. The menu's ACTIVE COMBATS, each COMBAT #n and the scene name on the tracker were drawn in the theme's border colour and could hardly be read in any theme; they now use its text colour. Jumping to a fight whose building has lost its battle map says NO_BATTLE_MAP_FOR_THAT_SCENE instead of doing nothing. Whose turn it is is also announced to screen readers. All found by new browser journeys: one fight with two players from START to END, two fights at once with the GM jumping between them, and one fight spread over two scenes. diff --git a/README.md b/README.md index 4e1ced7e..4a4b4f30 100644 --- a/README.md +++ b/README.md @@ -795,7 +795,7 @@ CITY_NET/ │ │ │ ├── AdminPanel.tsx # GM dashboard — CITY / EXPORT / GAME / PLAYERS tabs (GAME has GIVE_ITEM beside PAY_PLAYERS, and SHOP_CATALOGUES wherever there are shops or GIVE ITEM); CITY_GENERATOR delegates to cityGen/ and exposes LAYOUT, DRAG_RECT/DRAW_AREA bounds, OVERPASS_DENSITY, WATER, PARK_PONDS, an optional SEED and REGENERATE; CUSTOM type integrates into NEXT_STYLE cycle using cross-map custom_structure_library; data-driven HouseRulesPanel for CP:R, CWN, and SR6; SR6 Edge replenishment (reset all / give 1 to player); a built-in game's own CONDITIONS for the main admin (TableConditionsPanel); a custom game's RESTS for the GM and editors (GameRestsPanel), with the NPCs on the map being viewed; a custom game's own house rules beside the shared ones in HOUSE RULES, one APPLY for all, following the game when it changes. The GAME tab's RESTS and BANK are folders of its own (R2b, GameFolder.tsx), RESTS out of TTRPG_SYSTEM, a line before what the GM hands out; AWARD_EXPERIENCE where XP is spent (7f2c2); AdminPanel itself only picks the battle map's panel or the city's (CityAdminPanel), two components so their hooks never mix; HOUSE RULES offers a custom system's SHOW ENCUMBRANCE, BAND CONDITIONS and APPLY CONDITION MODIFIERS where it has what each switches (8a6b) │ │ │ ├── SystemPicker.tsx # GAME tab's system picker: a searchable dropdown, BUILT-IN then YOUR SYSTEMS, portalled into the theme, asking before it switches the game for everyone │ │ │ ├── systemPickerRules.ts # The picker's rules on their own: grouping and order, search, arrow-key movement, what the button says -│ │ │ ├── InventorySection.tsx # The inventory table, on every system. Its own file because SheetRenderer is long enough, and generic: which rows carry an extra button, and what pressing it does, is supplied from outside - so a drug offers CONSUME and a skillplug offers LOAD without either knowing about the other A custom system's items (7e3b): the slot counters over it, and WEAR and ATTUNE under a line of an item's name (GearItemLine); an installed item's line locked, named and in place, until REMOVE (7e4c); a custom system with item types gets a table per type instead (8a3a, GearTypeTables.tsx); tells GEAR's bands which lines are worn, attuned or installed, from what the server worked out (G3) +│ │ │ ├── InventorySection.tsx # The inventory table, on every system. Its own file because SheetRenderer is long enough, and generic: which rows carry an extra button, and what pressing it does, is supplied from outside - so a drug offers CONSUME and a skillplug offers LOAD without either knowing about the other A custom system's items (7e3b): the slot counters over it, and WEAR and ATTUNE under a line of an item's name (GearItemLine); an installed item's line locked, named and in place, until REMOVE (7e4c); a custom system with item types gets a table per type instead (8a3a, GearTypeTables.tsx); tells GEAR's bands which lines are worn, attuned or installed, from what the server worked out (G3); only the slot and install counters something on the sheet uses, 8px apart from FIND on a typed GEAR tab │ │ │ ├── GearTypeTables.tsx # The GEAR tab as a table per item type (8a3a; approved mockup item-types, 2026-11-14): each type's lines under its own column heads, units said; a line's own value over its item's, shown faint until typed over; + a type's one to add a line of it by hand; name, quantity, where and location as the one list has them; ROLL beside each DAMAGE and DICE (8a3b), read only or not, where the viewer may roll; since 8a3c1 a compact line per thing (name, QTY, WHERE, ✎, ×; only the columns it has as words under it, its item's faint, ROLL beside DAMAGE and DICE, a stashed one's place), ✎ opening every column as a box, one line at a time, a line made by hand opened; under ✎ a DAMAGE or DICE with eˣ (8a3c2): what it reads on this character, a name the system hasn't got flagged, SHAPE and INSERT; a COUNT as "AMMO 4 / 6" with its button (FIRE) and RELOAD beside it (8a4b), held while the server answers, RELOAD FROM asking which carried line where there are several, a refusal said on the line; in bands (G2): EQUIPPED, USABLE and PACK by each type's ON THE SHEET, a group per type with lines, in hand first, and STASH, closed to start, each line's type said; a band's head closes it, remembered; a row of + at the top adds a thing of any type by hand, opening its band; one line a thing (G3): its name, how many, its columns as words with ROLL, FIRE and RELOAD, where it is carried, ✎ at its end (or a click on the line) opening its card (NAME, HOW MANY, every column, LOCATION, DONE, REMOVE), FILL IN where nothing at all is filled in opening the card at its first box, a PICK ONE box as wide as its words; a closed band something lands in (worn, bought, given) pulses three times and stays lit in the theme's own color until opened (G3); FIND at the top, always shown (G4): only the lines it matches, each band counted by its matches and open while it has words, heads readable but not toggling, its own × and Esc to clear, "Nothing on this sheet matches" when nothing does │ │ │ ├── GearItemLine.tsx # A system's item on its GEAR line (7e3b): its NEEDS tag, WEAR or WORN · TAKE OFF, ATTUNE (ATTUNED · END, the GM's ATTUNE ANYWAY), what it is doing, and its features' uses; the slot counters over the gear (ATTUNED 2 OF 3, amber when full) with the GM's box for one character's own count; and each install's counter, amber at its limit (7e4c) │ │ │ ├── PharmaSection.tsx # What is currently in the bloodstream, drawn in the sheet HEADER rather than a tab: a drug that wears off at the end of a scene and bills System Strain for it is not something to hide behind a tab somebody might not open. Draws nothing at all while a character is on nothing @@ -1083,7 +1083,7 @@ CITY_NET/ │ │ │ ├── SheetCyberware.test.tsx # The sheet showing what the chrome does, so a correct effects layer is actually read │ │ │ ├── InventorySection.test.tsx # The inventory table editing one field cleanly, though every keystroke rewrites the whole list │ │ │ ├── GearItemLine.test.tsx # WEAR and ATTUNE on GEAR (7e3b): the counter, an item's line under its own row, what pressing asks, a full slot disabled and why, the GM's ATTUNE ANYWAY and own count, read-only, uses ticking, a refusal said, a system without items unchanged; installs (7e4c): the counter, an installed line locked, REMOVE and INSTALL asked, a player's disabled past the limit, the GM's anyway, amber when full -│ │ │ ├── GearTypeTables.test.tsx # The GEAR tab as a table per type (8a3a): each type's lines and heads, an empty type its heading and + only, an item's values faint until typed over, + a type's one by hand staying in its table, read only, a system without types keeping the one list; ROLL beside DAMAGE sending its line and column, nothing to roll nothing to press, read only still there (8a3b); compact lines (8a3c1): only the columns a line has, ✎ one at a time with "none" where it has none, a hand-made line opened, read only without ✎; a DAMAGE under ✎ read on this character, a bad name flagged, never an older text's words, eˣ SHAPE and INSERT (8a3c2); a COUNT's "4 / 6" with FIRE and RELOAD, held while waiting, none left or full, USE by default, RELOAD FROM asked and CANCEL, a refusal on its line (8a4b); in bands (G2): the four in order and counted, in hand first, STASH closed, a head closing and opening its band remembered, the STASH saying each type, an empty band saying so, a thing made by hand opening its band; one line a thing (G3): a click on the line opening its card but not on ROLL or where it is carried, one card at a time, ✎ opening and closing it (none read only), FILL IN only where nothing is filled in, naming the columns and opening at the first (a DAMAGE too), none where something is or a type has no columns, UNNAMED, a PICK ONE box as wide as its words; a worn Cutlass of a PACK type in EQUIPPED, back in PACK taken off; a closed band lit when the server puts something in it, not on opening the sheet, not an open band, cleared when opened, not when the player opens it by hand; FIND (G4): as you type, counted, every band open, heads not toggling, × and Esc clearing, as left once cleared and nothing lit, a value and a column, nothing found, read only too +│ │ │ ├── GearTypeTables.test.tsx # The GEAR tab as a table per type (8a3a): each type's lines and heads, an empty type its heading and + only, an item's values faint until typed over, + a type's one by hand staying in its table, read only, a system without types keeping the one list; ROLL beside DAMAGE sending its line and column, nothing to roll nothing to press, read only still there (8a3b); compact lines (8a3c1): only the columns a line has, ✎ one at a time with "none" where it has none, a hand-made line opened, read only without ✎; a DAMAGE under ✎ read on this character, a bad name flagged, never an older text's words, eˣ SHAPE and INSERT (8a3c2); a COUNT's "4 / 6" with FIRE and RELOAD, held while waiting, none left or full, USE by default, RELOAD FROM asked and CANCEL, a refusal on its line (8a4b); in bands (G2): the four in order and counted, in hand first, STASH closed, a head closing and opening its band remembered, the STASH saying each type, an empty band saying so, a thing made by hand opening its band; one line a thing (G3): a click on the line opening its card but not on ROLL or where it is carried, one card at a time, ✎ opening and closing it (none read only), FILL IN only where nothing is filled in, naming the columns and opening at the first (a DAMAGE too), none where something is or a type has no columns, UNNAMED, a PICK ONE box as wide as its words; a worn Cutlass of a PACK type in EQUIPPED, back in PACK taken off; a closed band lit when the server puts something in it, not on opening the sheet, not an open band, cleared when opened, not when the player opens it by hand; FIND (G4): as you type, counted, every band open, heads not toggling, × and Esc clearing, as left once cleared and nothing lit, a value and a column, nothing found, read only too; the slot and install counters only where something uses them │ │ │ ├── conditionNote.test.tsx # The conditions on the token under the number they change (8a5e3): SLOWED: Speed ×0.5 · typed 30 with the halved Speed the big number, clicked to edit what is typed, a skill's line, two on one number, a system with no picks or items, none on the token │ │ │ ├── PharmaSection.test.tsx # Taking a dose from a Readied inventory row, and what is running shown in the sheet header │ │ │ ├── Skillplugs.test.tsx # LOAD on a Readied plug, the granted skill on SKILLS, and what is loaded in the header @@ -1288,7 +1288,7 @@ CITY_NET/ │ │ │ ├── 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) +│ │ │ ├── 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); countersInUse (2026-11-22): the slots and installs a sheet has a use for, one an item on a line needs or one with something still counted against it │ │ │ ├── gearTypes.ts # The GEAR tab's tables as logic (8a3a): the types from the render copy, what fits each column, a line's type (its own, its item's, the first) and its cells (its own value over its item's, the item's only on a line of its type), the tables in the system's order, a value typed, a new line of a type; mirrors the server's lineColumns; shownCells and cellWords, what a compact line shows (8a3c1); countOf, a COUNT left as the server counts it, and "4 / 6" in words (8a4b); gearBands, the GEAR tab's bands (G2): each type's lines in its ON THE SHEET band, in hand first, groups only for types with lines, and every stashed line in STASH; a line worn, attuned or installed in EQUIPPED whatever its type's band (G3); landedIn, the closed bands something landed in between two drawings (G3); lineWords and foundIn, FIND on GEAR (G4): a line found by its name, type, band, where it is carried and is, and each column with its words, every word typed somewhere on it │ │ │ ├── gearDice.ts # A gear line's DAMAGE or DICE in words (8a3c2): ON THIS CHARACTER with each name's value and the range, or what is wrong; the eˣ shapes and INSERT at the cursor │ │ │ ├── rollTotal.ts # A roll line's final total, found for the dice history to bold: after the last = in its first [ ], or the lone number; never what follows a · @@ -1342,7 +1342,7 @@ CITY_NET/ │ │ │ ├── itemTypes.test.ts # ITEM TYPES as logic (8a2): GEAR and the limits as the server's, each preset sound, blank, none past the most, names, removal, columns of each kind, PICK ONE's words, an item's type and values, a rest or item deleted, each step held to the server's checks; the DEFAULT moved, nobody changing type (8aL1) │ │ │ ├── encumbrance.test.ts # The builder's ENCUMBRANCE as logic (8a5c): written tidy with the items kept, what it can count, how it starts held to the server's check, COUNTED BY's unit, the bands, the names formulas read held to the server's; a band's words and condition kept through every edit (8a5d1); blank words and NONE kept as nothing, cut at 200, held to the server's check (8a5d2) │ │ │ ├── ranks.test.ts # Ranks as logic (7f1b): each preset sound as the server checks it, copies never the preset, lists and ranks changed, moved and removed with AT START following, HOLDS and AT START -│ │ │ ├── gearItems.test.ts # Items on GEAR as logic (7e3b): the line each item draws on, what a save worked out read safely, the slot's verb, every state's buttons and words for player, GM and read-only, the counters, the GM's box, uses; installs (7e4c): room each way with rounding, every state's buttons and words, the counters, the names installed +│ │ │ ├── gearItems.test.ts # Items on GEAR as logic (7e3b): the line each item draws on, what a save worked out read safely, the slot's verb, every state's buttons and words for player, GM and read-only, the counters, the GM's box, uses; installs (7e4c): room each way with rounding, every state's buttons and words, the counters, the names installed; countersInUse: a slot or install an item on a line needs, or still counted against with its line gone, not one nothing uses │ │ │ ├── gearTypes.test.ts # The GEAR tab's tables as logic (8a3a): the types read, what fits each kind as the server's check, each line's type and values as the server's lineColumns on the same lines, the tables, values typed, a line's type, values and counts kept on the sheet and on the server, bought one more of; a COUNT left held to the server's lineColumns on the same lines (8a4b); gearBands (G2): each band's lines and count, in hand first then as listed, no group for a type with none there, an unknown band as PACK, stashed lines in STASH whatever the type; a line on you in EQUIPPED in a group of its type, the rest by type, stashed still the STASH, no empty group for an EQUIPPED type whose lines are all stashed (G3); landedIn: a closed band whose count went up, not an open one or one that fell, nothing before the first drawing (G3); foundIn (G4): by name, type, band, place, a column and its words, any case, every word, no group for a type with nothing found, blank as they are │ │ │ ├── rollTotal.test.ts # A roll line's final total: the new and old forms, the tray's own, symbols, a later [ ] or · passed over, the line put back unchanged │ │ │ ├── catalogueItems.test.ts # Items in catalogues (7e3c): how far apart two names are, a line named as an item, one landing in its own rows, near misses by marks or a letter or two, the closest named, nothing without items, the starter file on the gear's shelf or the next @@ -1543,7 +1543,7 @@ CITY_NET/ │ ├── sheet-health-levels.spec.ts # MAX HEALTH: PER LEVEL (7d5a): level 1's full die, a level up's average and EACH LEVEL ADDS on the token, a stat recounting every level; ROLL kept, cleared by the GM, rolled again and finished (7d5b); REROLL ALL to a new maximum or +1 (7d5c); ROLL TO BEAT, a pool and a die per level (7d5d) │ ├── sheet-increases.spec.ts # Ability increases at the table (7d6b2): points spread in ABILITY INCREASE within what it allows, named on the stat's badge, taken off by LEVEL_DOWN; a Feat taken instead, under the feature and on the badge (7d6c2) │ ├── sheet-bonus-ways.spec.ts # The ways a bonus counts at the table (7e1): two +2s each stopping at 20, the cut one named on the badge; an AT LEAST lifts what they leave -│ ├── sheet-worn-items.spec.ts # Items at the table (7e3b): WEAR and ATTUNE on GEAR, the ring's +2 CON once attuned and the slot full, a second worn with nothing to press, the GM's ATTUNE ANYWAY and own count, END, taken off still attuned; GIVE.EXE's ITEMS handing the ring to a player, who wears it; TERMINATE_SESSION closing GIVE.EXE at once +│ ├── sheet-worn-items.spec.ts # Items at the table (7e3b): WEAR and ATTUNE on GEAR, the ring's +2 CON once attuned and the slot full, a second worn with nothing to press, the GM's ATTUNE ANYWAY and own count, END, taken off still attuned; GIVE.EXE's ITEMS handing the ring to a player, who wears it; TERMINATE_SESSION closing GIVE.EXE at once; no ATTUNED bar until a line needing the slot is on the sheet │ ├── sheet-item-types.spec.ts # The GEAR tab as a table per type (8a3a): a stick made by hand with its own DAMAGE and GRADE, a line named like the Pistol showing its values faint, RANGE typed over, a rope in GEAR, saved as made, each in its table after a reload; compact lines with ✎ and DONE, and nothing on the GEAR tab scrolling sideways in SHEET.EXE (8a3c1); the Pistol's DAMAGE read on this character under ✎, a bad name flagged, eˣ INSERT (8a3c2); in bands (G2), PACK saying "Nothing here." and things added from the row of + at the top; the Pistol's card opened by a click on its name (G3) │ ├── sheet-gear-bands.spec.ts # The GEAR tab in bands (G2): a Sword, a Draught and a Rope added by hand land in EQUIPPED, USABLE and PACK, counted; the Sword stashed moves to STASH, which opens and says WEAPONS; USABLE closed by its head stays closed on the next visit; the Draught's blank HEALS filled from FILL IN, its card opened at that box (G3); a Cloak of GEAR worn into EQUIPPED and taken off back into PACK, EQUIPPED closed first and lit when the Cloak is worn; FIND 2d4 showing the Draught in a closed USABLE, nothing for lantern, cleared and USABLE closed again (G4) │ ├── sheet-gear-counts.spec.ts # A gear line's COUNT at the table (8a4): the Pistol's AMMO 2 / 6, FIRE spending one, RELOAD asking between Pistol Rounds and AP Rounds and using the AP Rounds up, then full from the Pistol Rounds; the Wand's CHARGES filled by a short rest from the sheet diff --git a/e2e/README.md b/e2e/README.md index 1ac8a627..dde9f103 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -204,7 +204,7 @@ kept; the job itself stops at 30 (`timeout-minutes`), for a hang outside the tes | `tests/sheet-bonus-ways.spec.ts` | The ways a bonus counts at the table (7e1): CON 18, a Tough +2 and a Ring +2 each STOPS AT 20, Tough taking it to 20 and the Ring then named as cut, (+2, stops at 20) +0; an Amulet's AT LEAST 19 doing nothing at 20, then lifting a CON of 12 (16 with the two +2s) to 19, named Amulet → 19 | | `tests/sheet-ranks.spec.ts` | A rank on the sheet (7f1c1): a player with Level 3 sees Athletics as a picker of UNTRAINED, TRAINED and EXPERT, picks EXPERT, its worth = 7 shows beside it, the formula Climb reading it shows 8, and the server keeps the step 2 with Athletics 7 and Climb 8 | | `tests/sheet-ranks-start.spec.ts` | Ranks making a character (7f1c2): a player in NEW CHARACTER types Grit, finds Lore under RANKS with UP TO TRAINED TO START and EXPERT off, picks TRAINED, and the server keeps the step 1 with Lore worth 2 | -| `tests/sheet-worn-items.spec.ts` | Items at the table (7e3b): two GEAR lines named like items get WEAR and ATTUNE; the ring worn does nothing yet, attuned it is WORKING, ATTUNED 1 OF 1, CON 14 → 16; the cloak worn with no slot free says so and can't attune; the GM, on the player's sheet, ATTUNES it ANYWAY (2 OF 1) and gives them 2 of their own; END frees the ring's slot and its +2 goes; the cloak taken off stays attuned and does nothing. A second test: the GM's GIVE.EXE lists the ring under ITEMS with NEEDS ATTUNED and its words, gives it to the player as a stowed gear line, the player is told and WEARS it; TERMINATE_SESSION closes GIVE.EXE while the session is still ending | +| `tests/sheet-worn-items.spec.ts` | Items at the table (7e3b): two GEAR lines named like items get WEAR and ATTUNE; the ring worn does nothing yet, attuned it is WORKING, ATTUNED 1 OF 1, CON 14 → 16; the cloak worn with no slot free says so and can't attune; the GM, on the player's sheet, ATTUNES it ANYWAY (2 OF 1) and gives them 2 of their own; END frees the ring's slot and its +2 goes; the cloak taken off stays attuned and does nothing. A second test: the GM's GIVE.EXE lists the ring under ITEMS with NEEDS ATTUNED and its words, gives it to the player as a stowed gear line, the player is told and WEARS it; TERMINATE_SESSION closes GIVE.EXE while the session is still ending; and (2026-11-22) no ATTUNED bar on GEAR until the Ring's line is there | | `tests/sheet-item-types.spec.ts` | The GEAR tab as a table per item type (8a3a): a player's sheet with WEAPONS and GEAR tables, each empty with its +; + WEAPON made A stick with DAMAGE 1d4 and GRADE HEAVY; a second line named Pistol showing 2d6 + @might faint, its RANGE typed over to 50 m; + GEAR made Rope at 10 lb; saved as made, each in its table after a reload; since 8a3b the stick's DAMAGE rolled with ROLL, "rolled A stick DAMAGE 1d4" in the dice tray's history; and (8a3c1) as compact lines: a line made by hand opened under ✎, DONE showing its words with ROLL, the Pistol's RANGE read as words after the reload, and no box on the GEAR tab scrolling sideways in SHEET.EXE; and (8a3c2) the Pistol's DAMAGE under ✎ said ON THIS CHARACTER: 2d6 + Might (12): 14 to 24, @strength flagged as not the system's, eˣ INSERT putting in @might; and (G2) in bands: PACK says "Nothing here." with no WEAPONS group before anything is carried, and things are added from the row of + at the top; and (G3) the Pistol's card opened by a click on its name | | `tests/sheet-gear-bands.spec.ts` | The GEAR tab in bands (G2): a game with WEAPONS EQUIPPED, POTIONS USABLE and GEAR unsaid; a player adds a Sword, a Draught and a Rope from the row of + at the top, each in its band and counted (EQUIPPED · 1, USABLE · 1, PACK · 1, STASH · 0 closed), saved as made; the Sword moved to the stash goes to STASH, which opens and says WEAPONS, EQUIPPED left at 0; USABLE closed by its head, and on the next visit USABLE is still closed and PACK open; and (G3) one line a thing: the Draught's HEALS blank, so FILL IN, which opens its card at that box, ready to type; 2d4 typed, DONE, the line says HEALS 2d4 and FILL IN is gone, saved; a Cloak, GEAR, made by hand sits in PACK, WEAR puts it in EQUIPPED (EQUIPPED · 1), taken off it is back in PACK; with EQUIPPED closed, WEAR lights its head (▸ EQUIPPED · 1), opened it is plain again; and (G4) FIND: 2d4 shows the Draught in USABLE, closed, opened while it shows (PACK · 0), lantern says nothing matches, cleared USABLE is closed again | | `tests/sheet-gear-counts.spec.ts` | A gear line's COUNT at the table (8a4): a player's Pistol at AMMO 2 / 6 spends one with FIRE; RELOAD, with Pistol Rounds and AP Rounds both carried, asks which and takes all 3 AP Rounds, their line gone; RELOAD again takes 2 of the Pistol Rounds alone, full, RELOAD held; the Wand's CHARGES, with no RELOAD, filled by a SHORT REST from the sheet | diff --git a/e2e/tests/sheet-worn-items.spec.ts b/e2e/tests/sheet-worn-items.spec.ts index 30d355a8..e55cbdc0 100644 --- a/e2e/tests/sheet-worn-items.spec.ts +++ b/e2e/tests/sheet-worn-items.spec.ts @@ -35,6 +35,8 @@ test('WEAR and ATTUNE on GEAR: the ring counts once attuned, a full slot is the // Two lines named like the items, stowed: carried. await sheetTab(mine, 'GEAR'); + // No ATTUNED bar while nothing on the sheet needs a slot (2026-11-22); it comes with the Ring's line. + await expect(mine.getByRole('group', { name: 'ATTUNED slots' })).toHaveCount(0); for (const [n, name] of [[1, 'Ring of Might'], [2, 'Cloak of Warding']] as const) { await mine.getByRole('button', { name: '+ ITEM', exact: true }).click(); await mine.getByLabel(`Item ${n} name`, { exact: true }).fill(name); diff --git a/frontend/src/components/InventorySection.tsx b/frontend/src/components/InventorySection.tsx index 95c28e0d..c9ab167e 100644 --- a/frontend/src/components/InventorySection.tsx +++ b/frontend/src/components/InventorySection.tsx @@ -4,7 +4,7 @@ import { INVENTORY_FIELD, CARRY_STATES, readInventory, writeInventory, blankItem, itemEnc, type InventoryItem, } from '../sheets/inventory'; -import { itemLines, itemsWorkedOn, gearRow, slotCounters, installCounters, itemUses, type ItemsShown, type ItemAction } from '../sheets/gearItems'; +import { itemLines, itemsWorkedOn, gearRow, slotCounters, installCounters, countersInUse, itemUses, type ItemsShown, type ItemAction } from '../sheets/gearItems'; import { workedOn, type ChoicesAction } from '../sheets/choicesShown'; import { GearItemLine, GearSlots } from './GearItemLine'; import { GearTypeTables } from './GearTypeTables'; @@ -87,8 +87,10 @@ export function InventorySection({ section, data, readOnly, onFieldChange, rowAc const lineItems = itemLines(itemsShown, items); const worked = itemsWorkedOn(data as Record); const uses = lineItems.size ? workedOn(data as Record).uses : {}; - const counters = slotCounters(itemsShown, worked); - const installs = installCounters(itemsShown, worked); + // Only the slots and installs something on this sheet uses (2026-11-22): no STRAIN on a sorcerer with no cyberware. + const using = countersInUse(lineItems, worked); + const counters = slotCounters(itemsShown, worked).filter((c) => using.has(c.id)); + const installs = installCounters(itemsShown, worked).filter((c) => using.has(c.id)); /** Whether a line is an item installed (7e4c): kept as it is, named and in place, until REMOVE. */ const locked = (i: number) => lineItems.has(i) && !!worked.items.find((w) => w.id === lineItems.get(i)!.id)?.installed; /** Whether a line is an item worn, attuned or installed: on you, so EQUIPPED on GEAR's bands (G3). */ diff --git a/frontend/src/components/__tests__/GearTypeTables.test.tsx b/frontend/src/components/__tests__/GearTypeTables.test.tsx index 3bc06f75..dd9799e0 100644 --- a/frontend/src/components/__tests__/GearTypeTables.test.tsx +++ b/frontend/src/components/__tests__/GearTypeTables.test.tsx @@ -546,3 +546,24 @@ describe('FIND on GEAR (G4)', () => { expect(screen.queryByRole('region', { name: /band$/ })).toBeNull(); }); }); + +describe('the slot and install counters (2026-11-22)', () => { + const COUNTED: ItemsShown = { + slots: [{ id: 'attuned', label: 'Attuned', count: 3 }], + installs: [{ id: 'cyberware', label: 'Cyberware', against: 'Strain', way: 'adds' }], + list: [{ id: 'ring', label: 'Ring', needs: 'attuned', features: [], type: 'gear' }, { id: 'jack', label: 'Jack', needs: 'cyberware', features: [], type: 'gear' }], + types: [{ id: 'gear', label: 'GEAR', one: 'Gear', columns: [] }], + }; + const counters = () => [...screen.queryAllByRole('group', { name: / slots$/ }), ...screen.queryAllByRole('group', { name: / installs$/ })].map((g) => g.getAttribute('aria-label')); + + it('only those something on the sheet uses: none for a sheet of rope, the slot with a ring, the install with a jack', () => { + show([line('Rope', { type: 'gear' })], { items: COUNTED }); + expect(counters()).toEqual([]); + cleanup(); + show([line('Rope', { type: 'gear' }), line('Ring', { type: 'gear' })], { items: COUNTED }); + expect(counters()).toEqual(['ATTUNED slots']); + cleanup(); + show([line('Jack', { type: 'gear' })], { items: COUNTED, worked: { items: [], slots: [], installs: [{ id: 'cyberware', used: 0, value: 0, limit: 2 }] } }); + expect(counters()).toEqual(['CYBERWARE installs']); + }); +}); diff --git a/frontend/src/sheets/__tests__/gearItems.test.ts b/frontend/src/sheets/__tests__/gearItems.test.ts index b1279b5e..e6ce295b 100644 --- a/frontend/src/sheets/__tests__/gearItems.test.ts +++ b/frontend/src/sheets/__tests__/gearItems.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { itemsWorkedOn, itemLines, slotVerb, gearRow, slotCounters, slotCountAsked, itemUses, fits, installCounters, installedNames, amount, type ItemsShown, type ItemWorked } from '../gearItems'; +import { itemsWorkedOn, itemLines, slotVerb, gearRow, slotCounters, slotCountAsked, itemUses, fits, installCounters, installedNames, countersInUse, amount, type ItemsShown, type ItemWorked } from '../gearItems'; import { blankItem, type InventoryItem } from '../inventory'; /** @@ -229,3 +229,20 @@ describe('installed items (7e4c)', () => { expect(installedNames(undefined, { items: [{ id: 'jack', needs: 'cyber', installed: true }] })).toEqual(new Set()); }); }); + +describe('the counters a sheet has a use for (2026-11-22)', () => { + const ring = { id: 'ring', label: 'Ring', needs: 'attuned', features: [] }; + const jack = { id: 'jack', label: 'Jack', needs: 'cyberware', features: [] }; + const rope = { id: 'rope', label: 'Rope', needs: 'carried', features: [] }; + + it('a slot or install an item on a line needs, or one with something still counted against it; not one nothing uses', () => { + const none = { slots: [{ id: 'attuned', count: 3, used: 0 }], installs: [{ id: 'cyberware', used: 0, value: 0, limit: 0 }] }; + expect([...countersInUse(new Map([[0, rope]]), none)].sort()).toEqual(['carried']); + expect(countersInUse(new Map([[0, ring]]), none).has('attuned')).toBe(true); + expect(countersInUse(new Map([[0, ring]]), none).has('cyberware')).toBe(false); + expect(countersInUse(new Map([[1, jack]]), none).has('cyberware')).toBe(true); + // Its line gone, still counted: shown, so the count isn't hidden while it is spent. + expect(countersInUse(new Map(), { slots: [{ id: 'attuned', count: 3, used: 1 }], installs: [{ id: 'cyberware', used: 2, value: 2, limit: 4 }] })).toEqual(new Set(['attuned', 'cyberware'])); + expect(countersInUse(new Map(), { slots: [] })).toEqual(new Set()); + }); +}); diff --git a/frontend/src/sheets/gearItems.ts b/frontend/src/sheets/gearItems.ts index 4b2bd235..9e15a86f 100644 --- a/frontend/src/sheets/gearItems.ts +++ b/frontend/src/sheets/gearItems.ts @@ -181,6 +181,18 @@ export const installCounters = (items: ItemsShown | undefined, worked: { install return { id: s.id, label: L, text: s.way === 'takes' ? `${L} · ${what} ${value}, NEVER BELOW ${limit}` : `${L} · ${what} ${value} OF ${limit}`, full }; }); +/** + * The slots and installs this sheet has a use for (the user, 2026-11-22, of a sorcerer's sheet saying CYBERWARE · STRAIN + * 0 OF 0: "can I disable it?", then "that would be awesome!"): one an item on a gear line needs, or one with anything still + * counted against it. A counter for none of its things is noise; it comes back with the first item that needs it. + */ +export const countersInUse = (lineItems: Map, worked: { slots: SlotWorked[]; installs?: InstallWorked[] }): Set => { + const ids = new Set([...lineItems.values()].map((i) => i.needs)); + for (const s of worked.slots) if (s.used > 0) ids.add(s.id); + for (const s of worked.installs ?? []) if (s.used > 0) ids.add(s.id); + return ids; +}; + /** The names of the items installed, lowercased (7e4c): their lines are locked, and a shop won't buy one. */ export const installedNames = (items: ItemsShown | undefined, worked: { items: ItemWorked[] }): Set => { const installed = new Set(worked.items.filter((i) => i.installed).map((i) => i.id));