@terrafirmagreg-team/recipe 1.2.18 → 1.2.20

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.18",
3
+ "version": "1.2.20",
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.6",
27
- "@terrafirmagreg-team/dump": "^1.2.13",
28
- "@terrafirmagreg-team/game": "^1.2.7",
29
- "@terrafirmagreg-team/kit": "^1.2.19",
30
- "@terrafirmagreg-team/mdx": "^1.2.9",
26
+ "@terrafirmagreg-team/data": "^1.2.10",
27
+ "@terrafirmagreg-team/dump": "^1.2.14",
28
+ "@terrafirmagreg-team/game": "^1.2.8",
29
+ "@terrafirmagreg-team/kit": "^1.2.22",
30
+ "@terrafirmagreg-team/mdx": "^1.2.11",
31
31
  "@terrafirmagreg-team/preview": "^1.2.5",
32
32
  "@terrafirmagreg-team/sites": "^1.2.3",
33
- "@terrafirmagreg-team/translate": "^1.2.10",
34
- "@terrafirmagreg-team/ui": "^1.2.13",
33
+ "@terrafirmagreg-team/translate": "^1.2.11",
34
+ "@terrafirmagreg-team/ui": "^1.2.16",
35
35
  "@types/pathfinding": "^0.1.0",
36
36
  "comlink": "^4.4.2",
37
37
  "fflate": "0.8.3",
@@ -70,7 +70,7 @@ export function IconPicker({
70
70
  placeholder={t('Search items', { note: 'recipe.search' })}
71
71
  className="h-7 px-2 text-xs"
72
72
  />
73
- <div className="mt-2 grid max-h-60 grid-cols-[repeat(auto-fill,minmax(2.5rem,1fr))] gap-1 overflow-y-auto">
73
+ <div className="mt-2 grid max-h-60 grid-cols-[repeat(auto-fill,minmax(2.5rem,1fr))] gap-1 overflow-x-clip overflow-y-auto">
74
74
  {results.map((item) => (
75
75
  <button
76
76
  key={`${item.kind}:${item.id}`}
@@ -78,7 +78,7 @@ export function CalcTrees({
78
78
  {t('Schemes', { note: 'recipe.calc.trees' })}
79
79
  </LeftSidebarFolderTrigger>
80
80
  <LeftSidebarFolderContent>
81
- <ul className="flex max-h-60 flex-col overflow-y-auto">
81
+ <ul className="flex max-h-60 flex-col overflow-x-clip overflow-y-auto">
82
82
  {tabs.map((tab) => (
83
83
  <TabRow
84
84
  key={tab.id}
@@ -1,5 +1,5 @@
1
1
  import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
2
- import { clientDumpJson } from '@terrafirmagreg-team/dump/lib/dump/client/dump';
2
+ import { clientRegistryNsEntries } from '@terrafirmagreg-team/dump/lib/dump/client/dump';
3
3
  import { loadClientTagMembers } from '@terrafirmagreg-team/dump/lib/dump/client/tags';
4
4
  import {
5
5
  asRecord,
@@ -27,29 +27,23 @@ const registrySliceCache = createDatasetCache(
27
27
  async (
28
28
  dataset: DatasetRef,
29
29
  kind: string,
30
+ ns: string,
30
31
  ): Promise<Record<string, Record<string, unknown>>> => {
31
32
  const field = registryField(kind);
32
- const raw = await clientDumpJson(dataset, `registry/${field}.json`, 'high');
33
+ const raw = await clientRegistryNsEntries(dataset, field, ns, 'high');
33
34
  const map = asRecord(raw);
34
35
  return map ? resolveEdgeRows(map) : {};
35
36
  },
36
- (dataset, kind) => `${dataset.id}/${dataset.version ?? ''} ${registryField(kind)}`,
37
37
  );
38
38
 
39
- function loadRegistryFile(
40
- dataset: DatasetRef,
41
- kind: string,
42
- ): Promise<Record<string, Record<string, unknown>>> {
43
- return registrySliceCache(dataset, kind);
44
- }
45
-
46
39
  export async function loadRegistryEntrySlice(
47
40
  dataset: DatasetRef,
48
41
  kind: string,
49
42
  id: string,
50
43
  ): Promise<Record<string, unknown> | undefined> {
51
44
  const base = stackIdBase(id);
52
- const map = await loadRegistryFile(dataset, kind);
45
+ const ns = base.includes(':') ? base.split(':', 1)[0] : 'minecraft';
46
+ const map = await registrySliceCache(dataset, kind, ns);
53
47
  return map[id] ?? map[base];
54
48
  }
55
49
 
@@ -60,7 +54,7 @@ const tagSliceCache = createDatasetCache(
60
54
  ns: string,
61
55
  ): Promise<Record<string, string[]>> => {
62
56
  const prefix = `${ns}:`;
63
- const map = await loadRegistryFile(dataset, kind);
57
+ const map = await registrySliceCache(dataset, kind, ns);
64
58
  const out: Record<string, string[]> = {};
65
59
  for (const [id, entry] of Object.entries(map)) {
66
60
  if (!id.startsWith(prefix)) continue;
package/src/lib/og.ts CHANGED
@@ -41,7 +41,7 @@ async function recipeOgContext(
41
41
  name: await ogStackName(dataset, id, kind, lang),
42
42
  id,
43
43
  },
44
- icon: await ogRefSprite(dataset, { kind, id }),
44
+ icon: () => ogRefSprite(dataset, { kind, id }),
45
45
  description: id,
46
46
  imageQuery: `${kind}=${encodeURIComponent(id)}`,
47
47
  };
@@ -61,10 +61,11 @@ async function recipeOgContext(
61
61
  return {
62
62
  entity: { kind: 'tag', name: `#${tagId || id}`, id },
63
63
  icon: first
64
- ? await ogRefSprite(dataset, {
65
- kind: tagKind as ReferenceKind,
66
- id: first,
67
- })
64
+ ? () =>
65
+ ogRefSprite(dataset, {
66
+ kind: tagKind as ReferenceKind,
67
+ id: first,
68
+ })
68
69
  : undefined,
69
70
  description:
70
71
  list != null
@@ -98,10 +99,11 @@ async function recipeOgContext(
98
99
  return {
99
100
  entity: { kind: 'recipe', name, id: recipe.id },
100
101
  icon: out
101
- ? await ogRefSprite(dataset, {
102
- kind: out.kind === 'tag' ? 'itemTag' : out.kind,
103
- id: out.id,
104
- })
102
+ ? () =>
103
+ ogRefSprite(dataset, {
104
+ kind: out.kind === 'tag' ? 'itemTag' : out.kind,
105
+ id: out.id,
106
+ })
105
107
  : undefined,
106
108
  description: catName ?? recipe.id,
107
109
  imageQuery: `id=${encodeURIComponent(id)}`,
@@ -118,7 +120,7 @@ async function recipeOgContext(
118
120
  ogLocalized(map, category.display?.name) ?? category.id;
119
121
  return {
120
122
  entity: { kind: 'category', ...ogName(localized), id: category.id },
121
- icon: await ogRefSprite(dataset, category.icon),
123
+ icon: () => ogRefSprite(dataset, category.icon),
122
124
  description: category.id,
123
125
  imageQuery: `type=${encodeURIComponent(type)}`,
124
126
  };