@terrafirmagreg-team/recipe 1.2.23 → 1.2.25
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 +8 -8
- package/src/components/cards/paged-card.tsx +1 -1
- package/src/components/cards/slot-hitbox.tsx +1 -19
- package/src/components/views/browser/card-grid.tsx +1 -1
- package/src/components/views/layout.tsx +7 -11
- package/src/hooks/use-index.ts +19 -10
- package/src/lib/client-index/chrome.ts +5 -2
- package/src/lib/routes.ts +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrafirmagreg-team/recipe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Recipe viewer and calculator",
|
|
6
6
|
"license": "LGPL-3.0-only",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"./styles.css": "./styles.css"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@terrafirmagreg-team/data": "^1.2.
|
|
27
|
-
"@terrafirmagreg-team/dump": "^1.2.
|
|
28
|
-
"@terrafirmagreg-team/game": "^1.2.
|
|
29
|
-
"@terrafirmagreg-team/kit": "^1.2.
|
|
26
|
+
"@terrafirmagreg-team/data": "^1.2.12",
|
|
27
|
+
"@terrafirmagreg-team/dump": "^1.2.19",
|
|
28
|
+
"@terrafirmagreg-team/game": "^1.2.10",
|
|
29
|
+
"@terrafirmagreg-team/kit": "^1.2.27",
|
|
30
30
|
"@terrafirmagreg-team/mdx": "^1.2.12",
|
|
31
31
|
"@terrafirmagreg-team/preview": "^1.2.7",
|
|
32
|
-
"@terrafirmagreg-team/sites": "^1.2.
|
|
33
|
-
"@terrafirmagreg-team/translate": "^1.2.
|
|
34
|
-
"@terrafirmagreg-team/ui": "^1.2.
|
|
32
|
+
"@terrafirmagreg-team/sites": "^1.2.4",
|
|
33
|
+
"@terrafirmagreg-team/translate": "^1.2.12",
|
|
34
|
+
"@terrafirmagreg-team/ui": "^1.2.18",
|
|
35
35
|
"@types/pathfinding": "^0.1.0",
|
|
36
36
|
"comlink": "^4.4.2",
|
|
37
37
|
"fflate": "0.8.3",
|
|
@@ -25,7 +25,7 @@ export function PagedCard({
|
|
|
25
25
|
const { recipe, naturalH, naturalW, src, title, onFail } = props;
|
|
26
26
|
const scale = recipe.scale ?? 2;
|
|
27
27
|
const margin = recipe.margin ?? 0;
|
|
28
|
-
const natural = naturalH ?? 0;
|
|
28
|
+
const natural = naturalH ?? recipe.h ?? 0;
|
|
29
29
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
30
30
|
const observedInView = useInView(rootRef);
|
|
31
31
|
const inView = props.eager || observedInView;
|
|
@@ -11,7 +11,6 @@ import { useCycleIndex } from '@terrafirmagreg-team/ui/hooks/use-cycle-index';
|
|
|
11
11
|
import { stackDisplayName } from '@terrafirmagreg-team/game/lib/entry/display';
|
|
12
12
|
import { entryHref } from '@terrafirmagreg-team/game/lib/entry/href';
|
|
13
13
|
import { loadStackDisplay } from '@terrafirmagreg-team/game/lib/entry/tooltip';
|
|
14
|
-
import { texturePublicUrl } from '@terrafirmagreg-team/dump/lib/dump/assets/urls';
|
|
15
14
|
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
16
15
|
import { useAsyncResult } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
17
16
|
import type { ReferenceKind } from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
@@ -115,11 +114,6 @@ export function SlotHitbox({
|
|
|
115
114
|
? widget.tagKind
|
|
116
115
|
: undefined
|
|
117
116
|
: widgetRefKind(widget);
|
|
118
|
-
const chanceUrl =
|
|
119
|
-
dataset && (alternatives?.length ?? 0) > 1
|
|
120
|
-
? texturePublicUrl(dataset, 'emi:textures/gui/widgets.png')
|
|
121
|
-
: undefined;
|
|
122
|
-
const chance = widget.w >= 26 ? { u: 19, v: 27 } : { u: 1, v: 19 };
|
|
123
117
|
const icon = (
|
|
124
118
|
<span className="pointer-events-none flex size-full items-center justify-center">
|
|
125
119
|
{alternatives && alternatives.length > 1 ? (
|
|
@@ -127,19 +121,7 @@ export function SlotHitbox({
|
|
|
127
121
|
aria-hidden
|
|
128
122
|
className="absolute bg-mc-inset"
|
|
129
123
|
style={{ inset: scale }}
|
|
130
|
-
|
|
131
|
-
{chanceUrl ? (
|
|
132
|
-
<span
|
|
133
|
-
className="absolute inset-0 block"
|
|
134
|
-
style={{
|
|
135
|
-
backgroundImage: `url(${chanceUrl})`,
|
|
136
|
-
backgroundSize: `${256 * scale}px ${256 * scale}px`,
|
|
137
|
-
backgroundPosition: `-${chance.u * scale}px -${chance.v * scale}px`,
|
|
138
|
-
imageRendering: 'pixelated',
|
|
139
|
-
}}
|
|
140
|
-
/>
|
|
141
|
-
) : null}
|
|
142
|
-
</span>
|
|
124
|
+
/>
|
|
143
125
|
) : null}
|
|
144
126
|
<EntryIcon
|
|
145
127
|
id={iconId}
|
|
@@ -268,7 +268,7 @@ export function RecipeCardGrid({
|
|
|
268
268
|
<div
|
|
269
269
|
ref={boxRef}
|
|
270
270
|
{...swipe}
|
|
271
|
-
className="flex min-h-0 flex-1 flex-col items-center justify-start gap-2 overflow-x-auto"
|
|
271
|
+
className="flex min-h-0 flex-1 flex-col items-center justify-start gap-2 overflow-x-auto overflow-y-clip"
|
|
272
272
|
>
|
|
273
273
|
{body}
|
|
274
274
|
</div>
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import type { TreeFeatureProps } from '@terrafirmagreg-team/kit/types';
|
|
4
4
|
import { useRecipeLeftSidebarTree } from '@terrafirmagreg-team/recipe/hooks/use-left-sidebar-tree';
|
|
5
5
|
|
|
6
|
-
export function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
useTree={useRecipeLeftSidebarTree}
|
|
11
|
-
sidebar={{ feature: RecipeAxisSwitcher }}
|
|
12
|
-
/>
|
|
13
|
-
);
|
|
6
|
+
export function RecipeTreeFeature({ input, dataset, onTree }: TreeFeatureProps) {
|
|
7
|
+
const tree = useRecipeLeftSidebarTree(input, dataset);
|
|
8
|
+
useEffect(() => onTree({ input, tree }), [input, tree, onTree]);
|
|
9
|
+
return null;
|
|
14
10
|
}
|
package/src/hooks/use-index.ts
CHANGED
|
@@ -54,15 +54,21 @@ export function useRecipeIndex(dataset: DatasetRef | undefined, lang: string) {
|
|
|
54
54
|
setLastFull(index);
|
|
55
55
|
});
|
|
56
56
|
publishRecipeIndex(dataset, lang, index);
|
|
57
|
-
const entityNames = await loadRecipeEntityNames(
|
|
57
|
+
const entityNames = await loadRecipeEntityNames(
|
|
58
|
+
dataset,
|
|
59
|
+
chrome,
|
|
60
|
+
lang,
|
|
61
|
+
).catch(() => null);
|
|
58
62
|
if (isCancelled()) return;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
if (entityNames) {
|
|
64
|
+
publishRecipeIndex(dataset, lang, {
|
|
65
|
+
...index,
|
|
66
|
+
names: {
|
|
67
|
+
...index.names,
|
|
68
|
+
[lang]: { ...entityNames, ...index.names[lang] },
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
66
72
|
setWarmKey(key);
|
|
67
73
|
}, [dataset, lang, nonce, key]);
|
|
68
74
|
|
|
@@ -71,9 +77,12 @@ export function useRecipeIndex(dataset: DatasetRef | undefined, lang: string) {
|
|
|
71
77
|
for (const entry of locales.filter((item) => item !== lang)) {
|
|
72
78
|
await idle();
|
|
73
79
|
if (isCancelled()) return;
|
|
74
|
-
const other = await loadRecipeChromeClient(dataset, entry)
|
|
80
|
+
const other = await loadRecipeChromeClient(dataset, entry).catch(
|
|
81
|
+
() => null,
|
|
82
|
+
);
|
|
75
83
|
if (isCancelled()) return;
|
|
76
|
-
|
|
84
|
+
if (!other) continue;
|
|
85
|
+
await loadRecipeCompactIndex(dataset, other).catch(() => null);
|
|
77
86
|
}
|
|
78
87
|
}, [dataset, lang, locales, warmKey, key]);
|
|
79
88
|
|
|
@@ -19,7 +19,10 @@ import { loadClientTabs } from '@terrafirmagreg-team/dump/lib/dump/client/tabs';
|
|
|
19
19
|
import { loadDatasetRecipeCategories } from '@terrafirmagreg-team/recipe/lib/data/category/load';
|
|
20
20
|
import { loadClientRegistryGroups } from '@terrafirmagreg-team/dump/lib/dump/client/groups';
|
|
21
21
|
import { loadClientModNames } from '@terrafirmagreg-team/dump/lib/dump/client/mods';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
stackIdBase,
|
|
24
|
+
stackIdFromRef,
|
|
25
|
+
} from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
23
26
|
import { createDatasetCache } from '@terrafirmagreg-team/dump/lib/dump/reader';
|
|
24
27
|
|
|
25
28
|
async function clientEntityNames(
|
|
@@ -29,7 +32,7 @@ async function clientEntityNames(
|
|
|
29
32
|
): Promise<Record<string, string>> {
|
|
30
33
|
const table = await clientDumpNames(dataset, lang);
|
|
31
34
|
for (const id of ids) {
|
|
32
|
-
if (table[id] === undefined) {
|
|
35
|
+
if (table[id] === undefined && table[stackIdBase(id)] === undefined) {
|
|
33
36
|
throw new Error(
|
|
34
37
|
`dump names missing id "${id}" for ${dataset.id} lang=${lang}`,
|
|
35
38
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createSectionRoutes } from '@terrafirmagreg-team/kit/components/views/routes';
|
|
2
|
+
import { ogDeepLink } from '@terrafirmagreg-team/preview/server';
|
|
3
|
+
import { RecipeTreeFeature } from '@terrafirmagreg-team/recipe/components/views/layout';
|
|
4
|
+
import { RecipeAxisSwitcher } from '@terrafirmagreg-team/recipe/components/views/browser/axis-switcher';
|
|
5
|
+
import { recipeLanding } from '@terrafirmagreg-team/recipe/components/views/landing';
|
|
6
|
+
import { recipeTrees } from '@terrafirmagreg-team/recipe/components/tree';
|
|
7
|
+
import { getRecipeSource } from '@terrafirmagreg-team/recipe/lib/source';
|
|
8
|
+
import '@terrafirmagreg-team/recipe/lib/og';
|
|
9
|
+
|
|
10
|
+
export function recipeRoutes() {
|
|
11
|
+
return createSectionRoutes({
|
|
12
|
+
section: 'recipe',
|
|
13
|
+
trees: recipeTrees,
|
|
14
|
+
source: { getSource: getRecipeSource },
|
|
15
|
+
layout: {
|
|
16
|
+
treeFeature: RecipeTreeFeature,
|
|
17
|
+
sidebar: { feature: RecipeAxisSwitcher },
|
|
18
|
+
},
|
|
19
|
+
landing: recipeLanding,
|
|
20
|
+
deepLink: ogDeepLink('recipe'),
|
|
21
|
+
});
|
|
22
|
+
}
|