feat: add base multiplier support for recipe references

Add optional baseMultiplier field to ingredient and instruction references, allowing base recipes to be included at scaled amounts (e.g., 0.5 for half the recipe).

- Add baseMultiplier field to Recipe schema with default value of 1
- Update TypeScript types to include baseMultiplier
- Add multiplier input field to BaseRecipeSelector modal
- Apply baseMultiplier to ingredient amounts during flattening
- Combine baseMultiplier with recipe multiplier in links
- Display and allow editing baseMultiplier in recipe editor

The multiplier cascades through nested references and works alongside the standard recipe multiplier for compound scaling.
This commit is contained in:
2026-01-13 19:08:24 +01:00
parent db5d326fa2
commit b43b45dac2
7 changed files with 95 additions and 15 deletions

View File

@@ -128,6 +128,7 @@ function handleSelect(recipe: any, options: any) {
includeIngredients: options.includeIngredients,
showLabel: options.showLabel,
labelOverride: options.labelOverride || '',
baseMultiplier: options.baseMultiplier || 1,
itemsBefore: [],
itemsAfter: []
};
@@ -746,6 +747,18 @@ h3{
</div>
<div class="reference-badge">
📋 {t[lang].baseRecipe}: {list.name || t[lang].unnamed}
<div style="margin-top: 0.5em;">
<label style="font-size: 0.9em; display: flex; align-items: center; gap: 0.5em;">
{t[lang].baseMultiplier || 'Mengenfaktor'}:
<input
type="number"
bind:value={list.baseMultiplier}
min="0.1"
step="0.1"
style="width: 5em; padding: 0.25em 0.5em; border-radius: 5px; border: 1px solid var(--nord4);"
/>
</label>
</div>
</div>
<div class="mod_icons">
<button type="button" class="action_button button_subtle" onclick={() => removeReference(list_index)} aria-label={t[lang].removeReferenceAria}>