Skip to content

Migrate to TypeScript and Oxc; improve Food Guide usability - #87

Merged
bluehexagons merged 64 commits into
mainfrom
feature/typescript-migration
Oct 11, 2026
Merged

bluehexagons merged 64 commits into
mainfrom
feature/typescript-migration

Conversation

@bluehexagons

@bluehexagons bluehexagons commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Migrate the Food Guide's data, calculation logic, browser UI, and asset tooling to strict TypeScript, replace ESLint/Prettier with oxlint/oxfmt, and require Node.js 24 or newer. This also incorporates the usability, accessibility, analyzer, navigation, and personal-data improvements developed throughout the migration.

TypeScript, tooling, and maintainability

  • Move maintained browser sources into src/ and sprite tooling into tools/. Compile JavaScript and declarations into the existing html/ paths; generated output stays out of Git. Development, tests, deployment, and packaging build those files automatically.
  • Add explicit food/recipe, calculator, analyzer, table, and preference types. Extract reusable activation, filter, grouping, pagination, sorting, navigation, storage, and cookbook-preview modules from the controller. Dispose temporary tables, listeners, and canceled analyses reliably.
  • Preserve the library's JavaScript exports and add TypeScript declarations. Test the packed package with separate NodeNext and bundler consumers, including safe keyed data lookups and historical ingredient IDs.
  • Enforce the Node 24 baseline in installation and CI, adopt Oxc lint/format checks, and refresh development, data, deployment, and user documentation.

Ingredient picking and cooking views

  • Add ingredient grouping, responsive group cards that pack without large row gaps, and distinct Compact/Normal/Cozy layouts for named and icon displays.
  • Replace Default sorting with relevance-aware Auto sorting. Add All/Practical/Everyday cooking views to reduce redundant or uncommon inputs while retaining recipe-specific ingredients where appropriate; hidden search matches offer Show all recovery.
  • Make selected quantities and dimming clear. Show overlapping removal controls only on selected ingredients: the checkbox removes all copies, and minus subtracts one when there are multiple copies. Keep layout stable and preserve touch targets.
  • Support Enter to add, Shift+Enter to subtract, Ctrl/Cmd+Enter to remove all, arrow navigation, and picker dismissal/reopening. Stabilize localized errors above the selected ingredients while retaining the result count, and handle IME composition and canceled touch gestures.
  • Correct game-variant resolution, fish preparation data, fractional stat formatting, and character-adjusted calculations and sorting. Preserve applicable selections when changing game or character.

Browse the complete statistics dataset

  • Replace the first-500-combinations limitation with an overview of consecutive recipe runs, preserving the selected sort order. Expand each run to browse its combinations; sorting by Name gathers recipe results together.
  • Page the overview and expanded runs independently, with first/previous/next/last controls, direct page entry, and separate 10/25/50/100 page-size settings. Mark expanded regions visually and avoid rendering the entire dataset at once.
  • Load an analyzed combination directly into the Simulator by activating its ingredients. Browser Back returns to the analysis with filters, expansions, and paging intact.
  • Keep computation responsive with time-budgeted batches, checked-combination progress, pause/resume, cancellation, Refresh results during calculation, and an automatic final refresh that preserves browsing position.
  • Improve filter recovery, tied-outcome announcements, and gain reporting; show percentages only when their baseline supports them.

Navigation and personal data

  • Add static-hosting-compatible fragment routes for sections, game/DLC/character settings, and highlighted foods/recipes. Preserve Back/Forward and native new-tab links. Ordinary URLs omit inventories and crock pot selections.
  • Add explicit Share links for a pot or inventory snapshot. Shared inventories open as new named copies, and snapshot data is consumed out of the working URL.
  • Keep working pots and picker views per tab. Add named persistent inventories whose contents synchronize across tabs/windows, with coordinated delta updates, independent inventory selection, and create/rename/duplicate/delete controls.
  • Add a personal cookbook storing four ingredients, an optional name, and game/character context. Cards show ingredient icons and recompute the actual highest-priority recipe outcomes from current data, even when the saved dish has a custom name. Loading restores the saved context and pot.
  • Add validated JSON import/export for inventories and dishes. Imports make new copies; malformed or oversized backups are rejected without replacing existing records. Storage failures retain memory edits with a persistent export reminder, and malformed durable data is protected from automatic overwrite.
  • Place Share/My data actions in responsive navigation bars and synchronize theme/language while preserving independent tab work.

Accessibility and interface polish

  • Improve keyboard operation and focus restoration for tabs, dropdowns, pickers, sortable tables, column controls, dialogs, cookbook cards, and analyzer disclosures.
  • Strengthen winning-recipe highlights with consistent borders and a non-color cue; refine focus, hover, contrast, reduced-motion, and forced-color treatments in Chromium and Firefox.
  • Improve narrow screens, increased text spacing, zoom, and touch use. Refresh the Simulator/Discovery supporting sections, analyzer introduction and filters, inventory forms, dialogs, and cookbook layout, including useful empty states.
  • Update English, Spanish, and Chinese UI strings and validate translation keys, interpolation placeholders, and UI contracts. Food, recipe, game, and character names retain their established English names.

Compatibility and rollout

Source checkouts and deployments now require a build and Node 24+. Public module URLs and library entrypoints remain compatible, and legacy saved preferences/ingredient IDs are restored. Personal data stays in the browser's local profile; a share snapshot or JSON export is an explicit user action. Analyzer pagination bounds the rendered table; combination calculation remains combinatorial and retains its results in browser memory, with pause and refresh available during long runs.

The companion desktop PR #33 bundles this guide revision. Merge the guide first. If this PR is squash-merged or rebased, update the desktop submodule pin to the resulting commit on main before merging the desktop PR; a merge commit preserves the existing pin.

Validation

  • Format, oxlint, strict source/consumer type checks, and all 193 unit tests pass locally. Packed-library and server-deployment regression tests are included.
  • Full Chromium (59 pass) and Firefox (56 pass, 3 expected skips) browser suites pass in CI, covering cooking flows, analyzer paging/live refresh, cross-tab data, import/export, URL history, translations, keyboard/touch behavior, responsive layouts, and axe accessibility audits. Firefox explicitly skips the three Chromium CDP gesture tests; those run in Chromium.
  • Final review corrected a fractional-scroll assertion and waited for the dialog close event before asserting cookbook focus; both regression flows pass locally in Chromium and Firefox.
  • Dependency audit reports zero vulnerabilities. The local preview was rebuilt from the final commit and all 425 published artifacts verified against it.

Add non-color selection cues and preserve readable forced-color states. Show localized recovery messages for failed ingredient actions and clean up temporary feedback without animation listeners. Exclude summary rows when finding the highest cooking priority, with regressions for Meatballs and negative recipe priorities.
@bluehexagons
bluehexagons merged commit a9ea554 into main Oct 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant