@terrafirmagreg-team/recipe 1.2.31 → 1.2.32
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 +4 -4
- package/src/components/cards/slot-hitbox.tsx +1 -1
- package/src/components/views/browser/item-view/index.tsx +0 -2
- package/src/components/views/browser/item-view/tags.tsx +1 -7
- package/src/lib/client/recipe-categories.ts +6 -4
- package/src/lib/data/category/dto.ts +1 -0
- package/src/lib/data/dto.ts +2 -0
- package/src/lib/data/parse/layout.ts +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrafirmagreg-team/recipe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Recipe viewer and calculator",
|
|
6
6
|
"license": "LGPL-3.0-only",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@terrafirmagreg-team/data": "^1.2.14",
|
|
27
|
-
"@terrafirmagreg-team/dump": "^1.2.
|
|
27
|
+
"@terrafirmagreg-team/dump": "^1.2.25",
|
|
28
28
|
"@terrafirmagreg-team/game": "^1.2.14",
|
|
29
|
-
"@terrafirmagreg-team/kit": "^1.2.
|
|
29
|
+
"@terrafirmagreg-team/kit": "^1.2.31",
|
|
30
30
|
"@terrafirmagreg-team/mdx": "^1.2.14",
|
|
31
|
-
"@terrafirmagreg-team/preview": "^1.2.
|
|
31
|
+
"@terrafirmagreg-team/preview": "^1.2.12",
|
|
32
32
|
"@terrafirmagreg-team/sites": "^1.2.5",
|
|
33
33
|
"@terrafirmagreg-team/translate": "^1.2.14",
|
|
34
34
|
"@terrafirmagreg-team/ui": "^1.2.23",
|
|
@@ -123,7 +123,7 @@ export function SlotHitbox({
|
|
|
123
123
|
? widget.tagKind
|
|
124
124
|
: undefined
|
|
125
125
|
: widgetRefKind(widget);
|
|
126
|
-
const icon = (
|
|
126
|
+
const icon = widget.iconless ? null : (
|
|
127
127
|
<span className="pointer-events-none flex size-full items-center justify-center">
|
|
128
128
|
{alternatives && alternatives.length > 1 ? (
|
|
129
129
|
<span
|
|
@@ -5,25 +5,19 @@ import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-transl
|
|
|
5
5
|
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
6
6
|
import { EmptyState } from '@terrafirmagreg-team/ui/components/blocks/page/empty-state';
|
|
7
7
|
import { LinkPreview } from '@terrafirmagreg-team/ui/components/blocks/link/link-preview';
|
|
8
|
-
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
9
8
|
import { tagPseudoId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
10
9
|
import { recipeHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
11
10
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
12
|
-
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
13
11
|
import type { RecipeHrefOpts } from '@terrafirmagreg-team/recipe/types';
|
|
14
12
|
|
|
15
13
|
export function ItemTagGroups({
|
|
16
14
|
groups,
|
|
17
15
|
dataset,
|
|
18
|
-
lang,
|
|
19
|
-
names,
|
|
20
16
|
query,
|
|
21
17
|
nav,
|
|
22
18
|
}: {
|
|
23
19
|
groups: [string, string[]][];
|
|
24
20
|
dataset: DatasetRef;
|
|
25
|
-
lang: Lang;
|
|
26
|
-
names: Record<string, Record<string, string>>;
|
|
27
21
|
query: string;
|
|
28
22
|
nav: RecipeHrefOpts;
|
|
29
23
|
}) {
|
|
@@ -76,7 +70,7 @@ export function ItemTagGroups({
|
|
|
76
70
|
);
|
|
77
71
|
}}
|
|
78
72
|
>
|
|
79
|
-
{
|
|
73
|
+
{`#${bare}`}
|
|
80
74
|
</LinkPreview>
|
|
81
75
|
);
|
|
82
76
|
})}
|
|
@@ -6,9 +6,11 @@ export function clientRecipeLayout(
|
|
|
6
6
|
dataset: DatasetRef,
|
|
7
7
|
categoryId: string,
|
|
8
8
|
): Promise<DumpRecipeLayout | undefined> {
|
|
9
|
-
return loadDatasetRecipeCategories(dataset).then(
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
return loadDatasetRecipeCategories(dataset).then((categories) => {
|
|
10
|
+
const cat = categories.find((item) => item.id === categoryId);
|
|
11
|
+
return cat?.layout
|
|
12
|
+
? { ...cat.layout, workstations: cat.workstations }
|
|
13
|
+
: undefined;
|
|
14
|
+
});
|
|
13
15
|
}
|
|
14
16
|
|
package/src/lib/data/dto.ts
CHANGED
|
@@ -48,6 +48,7 @@ function recipeIo(
|
|
|
48
48
|
function positionedWidgets(
|
|
49
49
|
recipe: Pick<Recipe, 'slots'>,
|
|
50
50
|
covered: Set<string>,
|
|
51
|
+
workstationIds: Set<string>,
|
|
51
52
|
): RecipeWidget[] {
|
|
52
53
|
const out: RecipeWidget[] = [];
|
|
53
54
|
for (const [slotId, fill] of Object.entries(recipe.slots)) {
|
|
@@ -71,6 +72,9 @@ function positionedWidgets(
|
|
|
71
72
|
...(fill.alternatives?.length
|
|
72
73
|
? { alternatives: fill.alternatives.map(stackIdFromRef) }
|
|
73
74
|
: {}),
|
|
75
|
+
...(fill.type === 'catalyst' && workstationIds.has(fill.id)
|
|
76
|
+
? { iconless: true }
|
|
77
|
+
: {}),
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
80
|
return out;
|
|
@@ -79,6 +83,7 @@ function positionedWidgets(
|
|
|
79
83
|
function widgetsFromLayout(
|
|
80
84
|
recipe: Pick<Recipe, 'slots'>,
|
|
81
85
|
layout: DumpRecipeLayout,
|
|
86
|
+
workstationIds: Set<string>,
|
|
82
87
|
): RecipeWidget[] {
|
|
83
88
|
const out: RecipeWidget[] = [];
|
|
84
89
|
for (const slot of layout.slots) {
|
|
@@ -103,6 +108,9 @@ function widgetsFromLayout(
|
|
|
103
108
|
...(fill.alternatives?.length
|
|
104
109
|
? { alternatives: fill.alternatives.map(stackIdFromRef) }
|
|
105
110
|
: {}),
|
|
111
|
+
...(fill.type === 'catalyst' && workstationIds.has(fill.id)
|
|
112
|
+
? { iconless: true }
|
|
113
|
+
: {}),
|
|
106
114
|
});
|
|
107
115
|
}
|
|
108
116
|
return out;
|
|
@@ -110,16 +118,20 @@ function widgetsFromLayout(
|
|
|
110
118
|
|
|
111
119
|
export function hydrateRecipe(recipe: Recipe, layout?: DumpRecipeLayout): Recipe {
|
|
112
120
|
const io = recipeIo(recipe, layout);
|
|
121
|
+
const workstationIds = new Set(
|
|
122
|
+
(layout?.workstations ?? []).map((ref) => ref.id),
|
|
123
|
+
);
|
|
113
124
|
return {
|
|
114
125
|
...recipe,
|
|
115
126
|
type: recipe.category,
|
|
116
127
|
inputs: io.inputs,
|
|
117
128
|
outputs: io.outputs,
|
|
118
129
|
widgets: [
|
|
119
|
-
...(layout ? widgetsFromLayout(recipe, layout) : []),
|
|
130
|
+
...(layout ? widgetsFromLayout(recipe, layout, workstationIds) : []),
|
|
120
131
|
...positionedWidgets(
|
|
121
132
|
recipe,
|
|
122
133
|
new Set((layout?.slots ?? []).map((slot) => slot.id)),
|
|
134
|
+
workstationIds,
|
|
123
135
|
),
|
|
124
136
|
...(recipe.widgets as RecipeWidget[]).filter(
|
|
125
137
|
(widget) => widget.type !== 'slot',
|