@terrafirmagreg-team/recipe 1.2.35 → 1.2.37

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terrafirmagreg-team/recipe",
3
- "version": "1.2.35",
3
+ "version": "1.2.37",
4
4
  "type": "module",
5
5
  "description": "Recipe viewer and calculator",
6
6
  "license": "LGPL-3.0-only",
@@ -26,12 +26,12 @@
26
26
  "@terrafirmagreg-team/data": "^1.2.14",
27
27
  "@terrafirmagreg-team/dump": "^1.2.25",
28
28
  "@terrafirmagreg-team/game": "^1.2.15",
29
- "@terrafirmagreg-team/kit": "^1.2.34",
29
+ "@terrafirmagreg-team/kit": "^1.2.36",
30
30
  "@terrafirmagreg-team/mdx": "^1.2.14",
31
31
  "@terrafirmagreg-team/preview": "^1.2.12",
32
32
  "@terrafirmagreg-team/sites": "^1.2.5",
33
33
  "@terrafirmagreg-team/translate": "^1.2.14",
34
- "@terrafirmagreg-team/ui": "^1.2.26",
34
+ "@terrafirmagreg-team/ui": "^1.2.28",
35
35
  "@types/pathfinding": "^0.1.0",
36
36
  "comlink": "^4.4.2",
37
37
  "fflate": "0.8.3",
@@ -27,7 +27,7 @@ export function CardText({
27
27
  if (!content) return null;
28
28
  const wrap = widget.type === 'paragraph';
29
29
  const rgb = (widget.color ?? 0xffffff) & 0xffffff;
30
- const ink = rgb === 0xffffff ? 0x000000 : rgb;
30
+ const shadowRgb = ((rgb & 0xfcfcfc) >> 2) & 0xffffff;
31
31
  return (
32
32
  <span
33
33
  className={`font-mc pointer-events-none absolute leading-none ${wrap ? 'whitespace-pre-wrap' : 'whitespace-pre'}`}
@@ -45,7 +45,12 @@ export function CardText({
45
45
  ...(wrap ? { width: widget.w * scale } : {}),
46
46
  }),
47
47
  fontSize: size ?? 8 * scale,
48
- color: `#${ink.toString(16).padStart(6, '0')}`,
48
+ color: `#${rgb.toString(16).padStart(6, '0')}`,
49
+ ...(widget.shadow === true
50
+ ? {
51
+ textShadow: `${scale}px ${scale}px 0 #${shadowRgb.toString(16).padStart(6, '0')}`,
52
+ }
53
+ : {}),
49
54
  }}
50
55
  >
51
56
  <McText text={content} surface="light" />
@@ -61,7 +61,8 @@ export function RecipeTypeTabs({
61
61
  help: category?.display?.name
62
62
  ? creativeTabName(langMap ?? {}, category.display.name)
63
63
  : recipeItemName(names, lang, id),
64
- helpKey: category?.display?.name ?? id,
64
+ helpMod:
65
+ index?.mods?.[id.split(':', 2)[0] ?? ''] ?? id.split(':', 2)[0],
65
66
  };
66
67
  });
67
68
  }, [index, ids, lang, names, dataset, langMap]);
@@ -216,8 +216,8 @@ export const CalcNodeCardFull = memo(function CalcNodeCardFull({
216
216
  </button>
217
217
  <input
218
218
  key={node.crafts}
219
- type="number"
220
- min={1}
219
+ type="text"
220
+ inputMode="numeric"
221
221
  defaultValue={node.crafts}
222
222
  title={t('Crafts', { note: 'recipe.calc.crafts.title' })}
223
223
  aria-label={t('Crafts', { note: 'recipe.calc.crafts.title' })}
@@ -118,8 +118,9 @@ export function usePanelCells({
118
118
  dIndex?.groups,
119
119
  expandedGroups,
120
120
  fluidIds,
121
+ dNames[dLang] ?? dNames.en_us,
121
122
  );
122
- }, [deferredFiltered, dIndex, mode, expandedGroups, favorites.entries]);
123
+ }, [deferredFiltered, dIndex, mode, expandedGroups, favorites.entries, dNames, dLang]);
123
124
 
124
125
  return {
125
126
  cells,
@@ -26,6 +26,7 @@ export function usePanelTabs(
26
26
  kind: 'item',
27
27
  size: 'lg',
28
28
  href: false,
29
+ tooltip: false,
29
30
  }),
30
31
  help: t('All items', { note: 'recipe.all_items' }),
31
32
  },
@@ -37,9 +38,10 @@ export function usePanelTabs(
37
38
  : { id: row.icon, kind: 'item' as const }),
38
39
  size: 'lg',
39
40
  href: false,
41
+ tooltip: false,
40
42
  }),
41
43
  help: row.help,
42
- helpKey: row.helpKey,
44
+ helpMod: row.helpMod,
43
45
  })),
44
46
  ],
45
47
  [index, lang, names, t, used],
@@ -3,7 +3,12 @@ import {
3
3
  type TaggedReference,
4
4
  } from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
5
5
  import { registryId } from '@terrafirmagreg-team/dump/lib/dump/paths';
6
- import { creativeTabName } from '@terrafirmagreg-team/dump/lib/dump/assets/lang/names';
6
+ import {
7
+ creativeTabName,
8
+ humanizeKey,
9
+ langString,
10
+ stripMcFormat,
11
+ } from '@terrafirmagreg-team/dump/lib/dump/assets/lang/names';
7
12
  import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
8
13
  import {
9
14
  filterUsedIds,
@@ -29,9 +34,22 @@ type ItemPanelTabRow = {
29
34
  icon: string;
30
35
  iconRef?: TaggedReference;
31
36
  help: string;
32
- helpKey?: string;
37
+ helpMod?: string;
33
38
  };
34
39
 
40
+ function stackGroupLabel(
41
+ map: Record<string, string>,
42
+ id: string,
43
+ ): string {
44
+ const [ns, path] = id.split(':', 2);
45
+ const flat = path?.replaceAll('/', '.') ?? id;
46
+ for (const candidate of [ns, 'c', 'forge']) {
47
+ const value = langString(map, `tag.item.${candidate}.${flat}`);
48
+ if (value !== undefined) return stripMcFormat(value);
49
+ }
50
+ return humanizeKey(id);
51
+ }
52
+
35
53
  export function panelPool(
36
54
  mode: ItemPanelMode,
37
55
  favoriteIds: string[],
@@ -47,6 +65,7 @@ export function buildPanelCells(
47
65
  groups: RecipeStackGroup[] | undefined,
48
66
  expandedGroups: ReadonlySet<string>,
49
67
  fluidIds?: ReadonlySet<string>,
68
+ langMap?: Record<string, string>,
50
69
  ): ItemPanelCell[] {
51
70
  const cell = (id: string): ItemPanelCell =>
52
71
  fluidIds?.has(registryId(id))
@@ -86,7 +105,10 @@ export function buildPanelCells(
86
105
  out.push({
87
106
  kind: 'group',
88
107
  id: group.id,
89
- label: group.name ?? group.id,
108
+ label:
109
+ group.name && group.name !== group.id
110
+ ? group.name
111
+ : stackGroupLabel(langMap ?? {}, group.id),
90
112
  members,
91
113
  expanded,
92
114
  ...(fluid ? { ref: 'fluid' as const } : {}),
@@ -129,7 +151,9 @@ export function panelTabRows(
129
151
  help: row.display?.name
130
152
  ? creativeTabName(names[lang] ?? names.en_us ?? {}, row.display.name)
131
153
  : recipeItemName(names, lang, row.id),
132
- helpKey: row.display?.name ?? row.id,
154
+ helpMod:
155
+ index?.mods?.[row.id.split(':', 2)[0] ?? ''] ??
156
+ row.id.split(':', 2)[0],
133
157
  });
134
158
  }
135
159
  return rows;