@terrafirmagreg-team/recipe 0.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -16
- package/src/components/button-copy.tsx +1 -0
- package/src/components/cards/card/index.tsx +5 -3
- package/src/components/cards/card/scene.tsx +4 -2
- package/src/components/cards/card/strip.tsx +4 -2
- package/src/components/cards/card/text.tsx +2 -1
- package/src/components/cards/card/tips.tsx +1 -0
- package/src/components/cards/default-item.tsx +6 -2
- package/src/components/cards/glare-filter.tsx +1 -0
- package/src/components/cards/paged-card.tsx +1 -0
- package/src/components/cards/slot-hitbox.tsx +4 -2
- package/src/components/cards/strip-card/buttons.tsx +7 -2
- package/src/components/cards/strip-card/index.tsx +3 -1
- package/src/components/cards/strip-card/member-cell.tsx +4 -2
- package/src/components/cards/strip-card/sprite.tsx +1 -0
- package/src/components/embed-card.tsx +44 -0
- package/src/components/mdx/recipe.tsx +34 -16
- package/src/components/tool-list.tsx +1 -0
- package/src/{lib/tree.ts → components/tree.tsx} +20 -12
- package/src/components/views/alloy/index.tsx +14 -7
- package/src/components/views/alloy/list.tsx +3 -2
- package/src/components/views/alloy/mix/index.tsx +1 -0
- package/src/components/views/alloy/mix/ratio.tsx +7 -6
- package/src/components/views/alloy/mix/rows.tsx +6 -7
- package/src/components/views/alloy/mix/status.tsx +8 -7
- package/src/components/views/alloy/mix/total.tsx +13 -12
- package/src/components/views/alloy/range-bar.tsx +2 -1
- package/src/components/views/alloy/stack-bar.tsx +4 -2
- package/src/components/views/browser/axis-switcher.tsx +13 -12
- package/src/components/views/browser/card-grid.tsx +2 -1
- package/src/components/views/browser/favorite-button.tsx +2 -1
- package/src/components/views/browser/frame.tsx +3 -2
- package/src/components/views/browser/index.tsx +20 -2
- package/src/components/views/browser/item-panel/index.tsx +11 -9
- package/src/components/views/browser/item-panel/skeleton.tsx +1 -0
- package/src/components/views/browser/item-panel-grid/cell.tsx +5 -3
- package/src/components/views/browser/item-panel-grid/favorite-cell.tsx +4 -2
- package/src/components/views/browser/item-panel-grid/index.tsx +4 -2
- package/src/components/views/browser/item-view/index.tsx +7 -12
- package/src/components/views/browser/item-view/tags.tsx +7 -5
- package/src/components/views/browser/item-view-header.tsx +10 -9
- package/src/components/views/browser/pane-tabs.tsx +1 -0
- package/src/components/views/browser/place-header.tsx +4 -3
- package/src/components/views/browser/query-controls.tsx +3 -1
- package/src/components/views/browser/recipe-item-header.tsx +5 -4
- package/src/components/views/browser/settings.tsx +4 -3
- package/src/components/views/browser/toolbar.tsx +3 -2
- package/src/components/views/browser/type-tabs.tsx +5 -3
- package/src/components/views/browser/type-view.tsx +7 -12
- package/src/components/views/browser/workstation-rail.tsx +4 -3
- package/src/components/views/calc/calculator/actions.tsx +4 -14
- package/src/components/views/calc/calculator/help.tsx +69 -28
- package/src/components/views/calc/calculator/index.tsx +34 -82
- package/src/components/views/calc/dot-overlay.tsx +1 -0
- package/src/components/views/calc/edge.tsx +134 -32
- package/src/components/views/calc/flow/index.tsx +92 -54
- package/src/components/views/calc/flow/picker-dialogs.tsx +84 -6
- package/src/components/views/calc/flow/toolbar.tsx +9 -21
- package/src/components/views/calc/flow/view-menu.tsx +16 -120
- package/src/components/views/calc/member-picker.tsx +8 -6
- package/src/components/views/calc/node-card/actions.tsx +28 -106
- package/src/components/views/calc/node-card/badges.tsx +10 -28
- package/src/components/views/calc/node-card/chips.tsx +8 -40
- package/src/components/views/calc/node-card/far.tsx +13 -65
- package/src/components/views/calc/node-card/full.tsx +133 -83
- package/src/components/views/calc/node-card/index.tsx +1 -0
- package/src/components/views/calc/node-card/menu.tsx +93 -22
- package/src/components/views/calc/node-card/port-cells.tsx +186 -0
- package/src/components/views/calc/node-card/port-rails.tsx +251 -0
- package/src/components/views/calc/node-card/ports.tsx +86 -0
- package/src/components/views/calc/recipe-picker/body.tsx +17 -14
- package/src/components/views/calc/recipe-picker/footer.tsx +5 -3
- package/src/components/views/calc/recipe-picker/index.tsx +5 -0
- package/src/components/views/calc/sidebar.tsx +19 -10
- package/src/components/views/calc/trees/icon-picker.tsx +3 -2
- package/src/components/views/calc/trees/index.tsx +5 -4
- package/src/components/views/calc/trees/label.tsx +6 -4
- package/src/components/views/calc/trees/rows.tsx +6 -5
- package/src/components/views/forge/gui.tsx +2 -1
- package/src/components/views/forge/index.tsx +14 -7
- package/src/components/views/forge/list.tsx +3 -2
- package/src/components/views/forge/workbench/controls.tsx +13 -6
- package/src/components/views/forge/workbench/index.tsx +3 -2
- package/src/components/views/forge/workbench/panel.tsx +1 -0
- package/src/components/views/forge/workbench/ruler.tsx +5 -4
- package/src/components/views/forge/workbench/status.tsx +6 -5
- package/src/components/views/forge/workbench/tape.tsx +5 -4
- package/src/hooks/alloy/use-fluid-colors.ts +12 -9
- package/src/hooks/alloy/use-mix-state.ts +3 -2
- package/src/hooks/calc/flow/use-engage.ts +129 -0
- package/src/hooks/calc/flow/use-handlers.ts +192 -0
- package/src/hooks/calc/flow/use-layout.ts +105 -0
- package/src/hooks/calc/flow/{mount.ts → use-mount.ts} +1 -0
- package/src/hooks/calc/flow/{nodes.ts → use-nodes.ts} +46 -37
- package/src/hooks/calc/flow/use-pickers.ts +57 -0
- package/src/hooks/calc/flow/{viewport.ts → use-viewport.ts} +13 -26
- package/src/hooks/calc/flow/{window.ts → use-window.ts} +1 -0
- package/src/hooks/calc/use-actions.ts +208 -229
- package/src/hooks/calc/use-amounts.ts +23 -60
- package/src/hooks/calc/use-data.ts +106 -192
- package/src/hooks/calc/use-defaults.ts +4 -2
- package/src/hooks/calc/use-far-mode.ts +1 -0
- package/src/hooks/calc/use-focus.ts +8 -7
- package/src/hooks/calc/use-maps.ts +1 -0
- package/src/hooks/calc/use-reset.ts +1 -0
- package/src/hooks/calc/use-resolver.ts +32 -196
- package/src/hooks/calc/use-session.ts +1 -0
- package/src/hooks/calc/use-share.ts +5 -2
- package/src/hooks/calc/use-storage.ts +5 -4
- package/src/hooks/calc/use-tier.ts +1 -0
- package/src/hooks/calc/use-view-mode.ts +1 -0
- package/src/hooks/calc/use-worker.ts +56 -121
- package/src/hooks/forge/use-anvil-gui.ts +4 -2
- package/src/hooks/forge/use-forge-state.ts +1 -0
- package/src/hooks/forge/use-ruler.ts +1 -0
- package/src/hooks/use-add-to-calc.ts +23 -19
- package/src/hooks/use-categories-by-id.ts +18 -0
- package/src/hooks/use-favorite-hotkey.ts +1 -0
- package/src/hooks/use-favorites.ts +1 -0
- package/src/hooks/use-group-outlines.ts +1 -0
- package/src/hooks/use-hide-unused.ts +2 -1
- package/src/hooks/use-index.ts +6 -2
- package/src/hooks/use-item-feeds.ts +3 -1
- package/src/hooks/use-item-pane.ts +6 -4
- package/src/hooks/use-item-press.ts +27 -23
- package/src/hooks/use-item-tag-groups.ts +4 -2
- package/src/hooks/use-item-tooltips.ts +3 -1
- package/src/hooks/use-left-sidebar-tree.ts +11 -3
- package/src/hooks/use-mod-names.ts +4 -2
- package/src/hooks/use-mount-limit.ts +1 -0
- package/src/hooks/use-panel-cells.ts +3 -1
- package/src/hooks/use-panel-page.ts +9 -6
- package/src/hooks/use-panel-tabs.ts +2 -1
- package/src/hooks/use-query.ts +8 -6
- package/src/hooks/use-session.ts +6 -2
- package/src/hooks/use-sidebar-group.ts +3 -7
- package/src/hooks/use-tag-members.ts +3 -1
- package/src/hooks/use-tool-recipes.ts +1 -0
- package/src/hooks/use-type-filter.ts +1 -0
- package/src/lib/alloy/mix.ts +1 -0
- package/src/lib/alloy/parse.ts +1 -0
- package/src/lib/calc/defaults.ts +6 -4
- package/src/lib/calc/flow.ts +143 -107
- package/src/lib/calc/focus.ts +1 -0
- package/src/lib/calc/meta.ts +3 -1
- package/src/lib/calc/pack.ts +47 -154
- package/src/lib/calc/ports.ts +43 -0
- package/src/lib/calc/resolve.ts +6 -38
- package/src/lib/calc/route/buckets.ts +1 -0
- package/src/lib/calc/route/geometry.ts +13 -24
- package/src/lib/calc/route/index.ts +1 -0
- package/src/lib/calc/route/polyline.ts +3 -3
- package/src/lib/calc/route/router.ts +181 -57
- package/src/lib/calc/scheme.ts +226 -0
- package/src/lib/calc/storage/entry.ts +27 -19
- package/src/lib/calc/storage/index.ts +2 -0
- package/src/lib/calc/storage/keys.ts +4 -8
- package/src/lib/calc/storage/store.ts +11 -36
- package/src/lib/calc/tree/index.ts +2 -16
- package/src/lib/calc/tree/materials.ts +1 -0
- package/src/lib/calc/tree/recipe.ts +1 -0
- package/src/lib/calc/tree/share.ts +86 -149
- package/src/lib/calc/worker/api.ts +3 -11
- package/src/lib/calc/worker/fetch.ts +1 -0
- package/src/lib/calc/worker/flush.ts +7 -20
- package/src/lib/calc/worker/index.ts +1 -1
- package/src/lib/calc/worker/protocol.ts +16 -13
- package/src/lib/calc/worker/resolve.ts +32 -84
- package/src/lib/calc/worker/state.ts +5 -6
- package/src/{components/cards/card/model.ts → lib/card-model.ts} +1 -0
- package/src/lib/client/recipe-categories.ts +11 -93
- package/src/lib/client/recipe.ts +13 -11
- package/src/lib/client-index/catalog.ts +33 -27
- package/src/lib/client-index/chrome.ts +30 -30
- package/src/lib/client-index/index.ts +1 -0
- package/src/lib/client-index/registry.ts +70 -59
- package/src/lib/client-index/rows.ts +63 -57
- package/src/lib/client-index/tooltips.ts +28 -34
- package/src/lib/config.ts +2 -1
- package/src/lib/data/category/dto.ts +4 -3
- package/src/lib/data/category/load.ts +9 -8
- package/src/lib/data/category/parse.ts +4 -3
- package/src/lib/data/dto.ts +4 -3
- package/src/lib/data/grid.ts +2 -1
- package/src/lib/data/parse/entry.ts +3 -2
- package/src/lib/data/parse/index.ts +1 -0
- package/src/lib/data/parse/layout.ts +5 -2
- package/src/lib/data/parse/slots.ts +3 -2
- package/src/lib/data/parse/widgets.ts +3 -2
- package/src/lib/data/scene.ts +1 -1
- package/src/lib/data/slot-io.ts +1 -0
- package/src/lib/dump.ts +4 -3
- package/src/lib/embed.ts +22 -0
- package/src/lib/favorite-hover.ts +1 -0
- package/src/lib/fluid-outputs.ts +10 -12
- package/src/lib/forge/actions.ts +2 -1
- package/src/lib/forge/data.ts +2 -1
- package/src/lib/forge/solve.ts +1 -0
- package/src/lib/group.ts +1 -0
- package/src/lib/index-store.ts +15 -9
- package/src/lib/links.ts +15 -9
- package/src/lib/lookup.ts +10 -8
- package/src/lib/panel-outline.ts +1 -0
- package/src/lib/panel.ts +3 -2
- package/src/lib/preview.ts +12 -8
- package/src/lib/recipe-slots.ts +1 -0
- package/src/lib/search.ts +1 -0
- package/src/lib/sidebar.ts +1 -0
- package/src/lib/used-items.ts +1 -0
- package/src/locales/en_us.json +170 -226
- package/src/locales/ru_ru.json +170 -226
- package/src/locales.ts +1 -0
- package/src/types/alloy.ts +1 -0
- package/src/{hooks/calc/flow/props.ts → types/calc-flow-props.ts} +18 -14
- package/src/types/calc.ts +41 -44
- package/src/types/forge.ts +1 -0
- package/src/types/index.ts +4 -2
- package/styles/calc.css +308 -47
- package/src/components/cards/fit-card.tsx +0 -26
- package/src/components/views/calc/target.tsx +0 -271
- package/src/hooks/calc/flow/engage.ts +0 -89
- package/src/hooks/calc/flow/handlers.ts +0 -115
- package/src/hooks/calc/flow/layout.ts +0 -149
- package/src/hooks/calc/flow/pickers.ts +0 -50
- package/src/hooks/calc/use-calc-fill.ts +0 -91
- package/src/hooks/calc/use-density.ts +0 -28
- package/src/hooks/calc/use-derived.ts +0 -258
- package/src/hooks/calc/use-direction.ts +0 -23
- package/src/hooks/calc/use-edge-style.ts +0 -40
- package/src/hooks/calc/use-fill.ts +0 -213
- package/src/lib/alloy/alloy.test.ts +0 -186
- package/src/lib/calc/tree/build.ts +0 -196
- package/src/lib/calc/tree/context.ts +0 -42
- package/src/lib/calc/tree/goal.ts +0 -64
- package/src/lib/calc/tree/ideal.ts +0 -36
- package/src/lib/calc/tree/pick.ts +0 -68
- package/src/lib/calc/tree/tree.test.ts +0 -169
- package/src/lib/calc/worker/fill.ts +0 -123
- package/src/lib/client-index/cache.ts +0 -13
- package/src/lib/forge/forge.test.ts +0 -123
package/src/lib/links.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { encodeQueryValue, withLang } from '@terrafirmagreg-team/translate/lib/url';
|
|
2
2
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
type DatasetRef,
|
|
5
|
+
sectionUrl,
|
|
6
|
+
} from '@terrafirmagreg-team/sites/location';
|
|
7
|
+
import { dumpRelPublicUrl, splitDumpId, tagPseudoId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
5
8
|
import type { RecipeHrefOpts, RecipePlace } from '@terrafirmagreg-team/recipe/types';
|
|
6
9
|
|
|
7
10
|
export type { RecipeHrefOpts, RecipePlace } from '@terrafirmagreg-team/recipe/types';
|
|
@@ -17,8 +20,8 @@ function recipeQuery(
|
|
|
17
20
|
return parts.join('&');
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
export function recipeBasePath(dataset:
|
|
21
|
-
return sectionUrl('recipe', dataset);
|
|
23
|
+
export function recipeBasePath(dataset: DatasetRef): string {
|
|
24
|
+
return sectionUrl('recipe', dataset.id);
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
export const RECIPE_ALL_TYPE = 'all';
|
|
@@ -44,7 +47,7 @@ export function recipePlaceOpts(
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
export function recipeHref(
|
|
47
|
-
dataset:
|
|
50
|
+
dataset: DatasetRef,
|
|
48
51
|
lang: Lang | undefined,
|
|
49
52
|
opts?: RecipeHrefOpts,
|
|
50
53
|
): string {
|
|
@@ -64,6 +67,7 @@ export function recipeHref(
|
|
|
64
67
|
'rpage',
|
|
65
68
|
opts?.rpage && opts.rpage > 1 ? Math.floor(opts.rpage) : undefined,
|
|
66
69
|
],
|
|
70
|
+
['version', dataset.version],
|
|
67
71
|
]);
|
|
68
72
|
const base = recipeBasePath(dataset);
|
|
69
73
|
const href = query ? `${base}?${query}` : base;
|
|
@@ -71,20 +75,21 @@ export function recipeHref(
|
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
export function recipeCalcHref(
|
|
74
|
-
dataset:
|
|
78
|
+
dataset: DatasetRef,
|
|
75
79
|
lang: Lang | undefined,
|
|
76
80
|
tree?: string,
|
|
77
81
|
): string {
|
|
78
82
|
const query = recipeQuery([
|
|
79
83
|
['tool', 'calc'],
|
|
80
84
|
['tree', tree],
|
|
85
|
+
['version', dataset.version],
|
|
81
86
|
]);
|
|
82
87
|
const href = `${recipeBasePath(dataset)}?${query}`;
|
|
83
88
|
return lang ? withLang(href, lang) : href;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
export function recipeStackHref(
|
|
87
|
-
dataset:
|
|
92
|
+
dataset: DatasetRef,
|
|
88
93
|
lang: Lang,
|
|
89
94
|
id: string,
|
|
90
95
|
opts?: Pick<RecipeHrefOpts, 'tab' | 'search'> & {
|
|
@@ -110,10 +115,10 @@ export function recipeStackHref(
|
|
|
110
115
|
: recipeHref(dataset, lang, { item: id, ...kept });
|
|
111
116
|
}
|
|
112
117
|
|
|
113
|
-
export { recipeImageUrl } from '@terrafirmagreg-team/
|
|
118
|
+
export { recipeImageUrl } from '@terrafirmagreg-team/dump/lib/dump/assets/urls';
|
|
114
119
|
|
|
115
120
|
export function recipeCardImageUrl(
|
|
116
|
-
dataset:
|
|
121
|
+
dataset: DatasetRef,
|
|
117
122
|
recipeId: string | undefined,
|
|
118
123
|
): string | undefined {
|
|
119
124
|
const parts = recipeId ? splitDumpId(recipeId) : undefined;
|
|
@@ -123,3 +128,4 @@ export function recipeCardImageUrl(
|
|
|
123
128
|
`assets/${parts.ns}/textures/recipe/${parts.path}.webp`,
|
|
124
129
|
);
|
|
125
130
|
}
|
|
131
|
+
|
package/src/lib/lookup.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
2
|
+
import { asStringList } from '@terrafirmagreg-team/dump/lib/dump/contract/read';
|
|
2
3
|
import type { RecipeCompactIndex, RecipeCompactRow } from '@terrafirmagreg-team/recipe/types';
|
|
3
|
-
import { registryId, splitDumpId } from '@terrafirmagreg-team/
|
|
4
|
-
import { resolveClientTag } from '@terrafirmagreg-team/
|
|
4
|
+
import { registryId, splitDumpId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
5
|
+
import { resolveClientTag } from '@terrafirmagreg-team/dump/lib/dump/client/tags';
|
|
5
6
|
import {
|
|
6
7
|
loadRegistryEntrySlice,
|
|
7
8
|
loadTagSlice,
|
|
8
9
|
loadTypeRows,
|
|
9
10
|
resolveRecipeRows,
|
|
10
11
|
} from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
11
|
-
import { stackIdFromRef } from '@terrafirmagreg-team/
|
|
12
|
+
import { stackIdFromRef } from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
12
13
|
import { loadFluidIoIndex } from '@terrafirmagreg-team/recipe/lib/fluid-outputs';
|
|
13
14
|
|
|
14
|
-
export { registryId, tagPseudoId } from '@terrafirmagreg-team/
|
|
15
|
+
export { registryId, tagPseudoId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
15
16
|
|
|
16
17
|
function uniqueRows(rows: RecipeCompactRow[]): RecipeCompactRow[] {
|
|
17
18
|
const seen = new Set<string>();
|
|
@@ -25,7 +26,7 @@ function uniqueRows(rows: RecipeCompactRow[]): RecipeCompactRow[] {
|
|
|
25
26
|
const ALL_KINDS = ['item', 'block', 'fluid', 'entity'];
|
|
26
27
|
|
|
27
28
|
async function entryEdges(
|
|
28
|
-
dataset:
|
|
29
|
+
dataset: DatasetRef,
|
|
29
30
|
kinds: string[],
|
|
30
31
|
id: string,
|
|
31
32
|
field: 'usedBy' | 'producedBy',
|
|
@@ -41,7 +42,7 @@ async function entryEdges(
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export async function recipesForOutput(
|
|
44
|
-
dataset:
|
|
45
|
+
dataset: DatasetRef,
|
|
45
46
|
index: RecipeCompactIndex,
|
|
46
47
|
item: string,
|
|
47
48
|
opts?: { includeTagRows?: boolean },
|
|
@@ -59,7 +60,7 @@ export async function recipesForOutput(
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
export async function usesForInput(
|
|
62
|
-
dataset:
|
|
63
|
+
dataset: DatasetRef,
|
|
63
64
|
index: RecipeCompactIndex,
|
|
64
65
|
item: string,
|
|
65
66
|
kind: string = 'item',
|
|
@@ -115,3 +116,4 @@ export async function usesForInput(
|
|
|
115
116
|
...stationRows.flat(),
|
|
116
117
|
]);
|
|
117
118
|
}
|
|
119
|
+
|
package/src/lib/panel-outline.ts
CHANGED
package/src/lib/panel.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
stackIdFromRef,
|
|
3
3
|
type TaggedReference,
|
|
4
|
-
} from '@terrafirmagreg-team/
|
|
5
|
-
import { registryId } from '@terrafirmagreg-team/
|
|
4
|
+
} from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
5
|
+
import { registryId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
6
6
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
7
7
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
8
8
|
import type {
|
|
@@ -102,3 +102,4 @@ export function panelTabRows(
|
|
|
102
102
|
}
|
|
103
103
|
return rows;
|
|
104
104
|
}
|
|
105
|
+
|
package/src/lib/preview.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { registerPreviewResolver } from '@terrafirmagreg-team/
|
|
2
|
-
import { clientDumpLang } from '@terrafirmagreg-team/
|
|
3
|
-
import {
|
|
4
|
-
import { langString } from '@terrafirmagreg-team/
|
|
1
|
+
import { registerPreviewResolver } from '@terrafirmagreg-team/preview/lib';
|
|
2
|
+
import { clientDumpLang } from '@terrafirmagreg-team/dump/lib/dump/client/dump';
|
|
3
|
+
import { loadDatasetRecipeCategories } from '@terrafirmagreg-team/recipe/lib/data/category/load';
|
|
4
|
+
import { langString } from '@terrafirmagreg-team/dump/lib/dump/assets/lang/names';
|
|
5
5
|
import { entryPreviewIcon } from '@terrafirmagreg-team/game/lib/preview';
|
|
6
|
-
import type { PreviewResolverCtx } from '@terrafirmagreg-team/
|
|
6
|
+
import type { PreviewResolverCtx } from '@terrafirmagreg-team/preview/lib';
|
|
7
7
|
import type { PagePreviewData } from '@terrafirmagreg-team/ui/types/preview';
|
|
8
8
|
|
|
9
9
|
export async function recipeLinkPreview({
|
|
@@ -11,11 +11,14 @@ export async function recipeLinkPreview({
|
|
|
11
11
|
query,
|
|
12
12
|
langMap,
|
|
13
13
|
}: PreviewResolverCtx): Promise<PagePreviewData | undefined> {
|
|
14
|
-
const dataset =
|
|
15
|
-
|
|
14
|
+
const dataset = {
|
|
15
|
+
id: parts[1] ?? '',
|
|
16
|
+
version: query.get('version') ?? undefined,
|
|
17
|
+
};
|
|
18
|
+
if (!dataset.id) return undefined;
|
|
16
19
|
const type = query.get('type');
|
|
17
20
|
if (!type) return { title: 'Recipes' };
|
|
18
|
-
const categories = await
|
|
21
|
+
const categories = await loadDatasetRecipeCategories(dataset);
|
|
19
22
|
const row = categories.find((category) => category.id === type);
|
|
20
23
|
if (!row) return { title: type };
|
|
21
24
|
return {
|
|
@@ -26,3 +29,4 @@ export async function recipeLinkPreview({
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
registerPreviewResolver('recipe', recipeLinkPreview, { langMap: clientDumpLang });
|
|
32
|
+
|
package/src/lib/recipe-slots.ts
CHANGED
package/src/lib/search.ts
CHANGED
package/src/lib/sidebar.ts
CHANGED
package/src/lib/used-items.ts
CHANGED