@jgengine/assets 0.9.0 → 0.11.0
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/CHANGELOG.md +34 -3
- package/README.md +103 -50
- package/dist/aliases.d.ts +5 -0
- package/dist/aliases.js +28 -9
- package/dist/catalogs/build.js +9 -0
- package/dist/catalogs/buildSprites.d.ts +10 -0
- package/dist/catalogs/buildSprites.js +15 -0
- package/dist/catalogs/starter.d.ts +5 -0
- package/dist/catalogs/starter.js +10 -1
- package/dist/cli/paths.d.ts +9 -1
- package/dist/cli/paths.js +11 -1
- package/dist/cli/pull.d.ts +12 -0
- package/dist/cli/pull.js +210 -15
- package/dist/download.d.ts +46 -3
- package/dist/download.js +158 -9
- package/dist/find.d.ts +20 -1
- package/dist/find.js +52 -2
- package/dist/generated/index.js +18 -6
- package/dist/generated/kaykit-adventurers.json +674 -0
- package/dist/generated/kaykit-city-builder.json +863 -0
- package/dist/generated/kaykit-dungeon.json +4265 -0
- package/dist/generated/kaykit-furniture.json +1115 -0
- package/dist/generated/kaykit-skeletons.json +410 -0
- package/dist/generated/kaykit-space-base.json +1199 -0
- package/dist/generated/quaternius-medieval-village.json +3698 -0
- package/dist/generated/quaternius-modular-scifi.json +4013 -0
- package/dist/generated/quaternius-stylized-nature.json +1430 -0
- package/dist/generated-sprites/index.d.ts +5 -0
- package/dist/generated-sprites/index.js +4 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +9 -2
- package/dist/indexGen.js +7 -5
- package/dist/manifest.d.ts +12 -1
- package/dist/materials.d.ts +61 -0
- package/dist/materials.js +98 -0
- package/dist/packs/starter.d.ts +46 -0
- package/dist/packs/starter.js +248 -0
- package/dist/provisioning.d.ts +88 -0
- package/dist/provisioning.js +74 -0
- package/dist/registry-catalog.json +40 -0
- package/dist/snippet.d.ts +4 -0
- package/dist/snippet.js +27 -0
- package/dist/sources/ambientcg.d.ts +5 -0
- package/dist/sources/ambientcg.js +64 -0
- package/dist/sources/gameicons.d.ts +10 -0
- package/dist/sources/gameicons.js +21 -0
- package/dist/sources/index.d.ts +9 -2
- package/dist/sources/index.js +11 -3
- package/dist/sources/kaykit.js +55 -6
- package/dist/sources/quaternius.js +60 -9
- package/dist/spriteIndexGen.d.ts +17 -0
- package/dist/spriteIndexGen.js +108 -0
- package/dist/verify.d.ts +1 -0
- package/dist/verify.js +38 -1
- package/package.json +4 -4
- package/skills/jgengine/SKILL.md +51 -0
- package/skills/jgengine/api.md +434 -0
- package/skills/jgengine/capabilities.md +29 -0
- package/skills/jgengine/reference-cartridge.md +72 -0
- package/skills/jgengine-assets/SKILL.md +41 -0
- package/skills/jgengine-assets/api.md +273 -0
- package/skills/jgengine-assets/capabilities.md +13 -0
- package/dist/generated/kenney-blaster.json +0 -362
- package/dist/generated/kenney-nature.json +0 -3292
- package/dist/generated/kenney-space.json +0 -1532
- package/dist/sources/kenney.d.ts +0 -2
- package/dist/sources/kenney.js +0 -36
- package/llms.txt +0 -997
package/dist/find.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AssetKind = "model" | "pack" | "component" | "icon";
|
|
1
|
+
export type AssetKind = "model" | "pack" | "material" | "component" | "icon" | "sprite" | "spritePack";
|
|
2
2
|
export type AssetMatch = {
|
|
3
3
|
kind: "model";
|
|
4
4
|
id: string;
|
|
@@ -10,6 +10,11 @@ export type AssetMatch = {
|
|
|
10
10
|
source: string;
|
|
11
11
|
title: string;
|
|
12
12
|
categories: readonly string[];
|
|
13
|
+
} | {
|
|
14
|
+
kind: "material";
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
categories: readonly string[];
|
|
13
18
|
} | {
|
|
14
19
|
kind: "component";
|
|
15
20
|
name: string;
|
|
@@ -18,6 +23,20 @@ export type AssetMatch = {
|
|
|
18
23
|
} | {
|
|
19
24
|
kind: "icon";
|
|
20
25
|
name: string;
|
|
26
|
+
}
|
|
27
|
+
/** One already-indexed file inside a pulled sprite/icon pack, e.g. `gameicons-icons/sword`. */
|
|
28
|
+
| {
|
|
29
|
+
kind: "sprite";
|
|
30
|
+
id: string;
|
|
31
|
+
source: string;
|
|
32
|
+
via: "index";
|
|
33
|
+
}
|
|
34
|
+
/** A whole sprite/icon pack, not yet resolved to individual files — same role as `pack` for models. */
|
|
35
|
+
| {
|
|
36
|
+
kind: "spritePack";
|
|
37
|
+
source: string;
|
|
38
|
+
title: string;
|
|
39
|
+
categories: readonly string[];
|
|
21
40
|
};
|
|
22
41
|
export interface FindOptions {
|
|
23
42
|
/** Restrict results to one kind. */
|
package/dist/find.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { aliases } from "./aliases.js";
|
|
2
2
|
import { generatedIndex } from "./generated/index.js";
|
|
3
|
+
import { generatedSpriteIndex } from "./generated-sprites/index.js";
|
|
3
4
|
import { keyFromFile } from "./indexGen.js";
|
|
5
|
+
import { materialAliases } from "./materials.js";
|
|
4
6
|
import { registryCatalog } from "./registry.js";
|
|
5
7
|
import { singles } from "./singles.js";
|
|
6
|
-
import {
|
|
8
|
+
import { materialSources, modelSources, spriteSources } from "./sources/index.js";
|
|
9
|
+
import { keyFromSpriteFile } from "./spriteIndexGen.js";
|
|
7
10
|
function normalize(value) {
|
|
8
11
|
return value.toLowerCase().replace(/[\s_/-]+/g, " ").trim();
|
|
9
12
|
}
|
|
@@ -92,7 +95,7 @@ export function rankAssets(query, options = {}) {
|
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
if (options.kind === undefined || options.kind === "pack") {
|
|
95
|
-
for (const source of
|
|
98
|
+
for (const source of modelSources) {
|
|
96
99
|
push(best(q, source.id, source.title, source.provider, ...source.categories), {
|
|
97
100
|
kind: "pack",
|
|
98
101
|
source: source.id,
|
|
@@ -101,6 +104,27 @@ export function rankAssets(query, options = {}) {
|
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
106
|
}
|
|
107
|
+
if (options.kind === undefined || options.kind === "material") {
|
|
108
|
+
for (const source of materialSources) {
|
|
109
|
+
push(best(q, source.id, source.title, ...source.categories), {
|
|
110
|
+
kind: "material",
|
|
111
|
+
id: source.id,
|
|
112
|
+
title: source.title,
|
|
113
|
+
categories: source.categories,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
for (const alias of materialAliases) {
|
|
117
|
+
const target = materialSources.find((source) => source.id === alias.target);
|
|
118
|
+
if (target === undefined)
|
|
119
|
+
continue;
|
|
120
|
+
push(best(q, alias.key, alias.target), {
|
|
121
|
+
kind: "material",
|
|
122
|
+
id: target.id,
|
|
123
|
+
title: target.title,
|
|
124
|
+
categories: target.categories,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
104
128
|
if (options.kind === undefined || options.kind === "component") {
|
|
105
129
|
for (const component of registryCatalog.components) {
|
|
106
130
|
push(best(q, component.name, component.title, component.description), {
|
|
@@ -116,6 +140,26 @@ export function rankAssets(query, options = {}) {
|
|
|
116
140
|
push(best(q, icon), { kind: "icon", name: icon });
|
|
117
141
|
}
|
|
118
142
|
}
|
|
143
|
+
if (options.kind === undefined || options.kind === "sprite") {
|
|
144
|
+
for (const entry of generatedSpriteIndex) {
|
|
145
|
+
push(best(q, entry.id, keyFromSpriteFile(entry.file), ...entry.categories), {
|
|
146
|
+
kind: "sprite",
|
|
147
|
+
id: entry.id,
|
|
148
|
+
source: entry.source,
|
|
149
|
+
via: "index",
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (options.kind === undefined || options.kind === "spritePack") {
|
|
154
|
+
for (const source of spriteSources) {
|
|
155
|
+
push(best(q, source.id, source.title, source.provider, ...source.categories), {
|
|
156
|
+
kind: "spritePack",
|
|
157
|
+
source: source.id,
|
|
158
|
+
title: source.title,
|
|
159
|
+
categories: source.categories,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
119
163
|
ranked.sort((a, b) => b.score - a.score || matchKey(a.match).localeCompare(matchKey(b.match)));
|
|
120
164
|
return dedupe(ranked).slice(0, options.limit ?? 12);
|
|
121
165
|
}
|
|
@@ -125,6 +169,12 @@ function matchKey(match) {
|
|
|
125
169
|
return `model:${match.id}`;
|
|
126
170
|
case "pack":
|
|
127
171
|
return `pack:${match.source}`;
|
|
172
|
+
case "material":
|
|
173
|
+
return `material:${match.id}`;
|
|
174
|
+
case "sprite":
|
|
175
|
+
return `sprite:${match.id}`;
|
|
176
|
+
case "spritePack":
|
|
177
|
+
return `spritePack:${match.source}`;
|
|
128
178
|
default:
|
|
129
179
|
return `${match.kind}:${match.name}`;
|
|
130
180
|
}
|
package/dist/generated/index.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import s_kaykit_adventurers from "./kaykit-adventurers.json" with { type: "json" };
|
|
2
|
+
import s_kaykit_city_builder from "./kaykit-city-builder.json" with { type: "json" };
|
|
3
|
+
import s_kaykit_dungeon from "./kaykit-dungeon.json" with { type: "json" };
|
|
4
|
+
import s_kaykit_furniture from "./kaykit-furniture.json" with { type: "json" };
|
|
5
|
+
import s_kaykit_skeletons from "./kaykit-skeletons.json" with { type: "json" };
|
|
6
|
+
import s_kaykit_space_base from "./kaykit-space-base.json" with { type: "json" };
|
|
7
|
+
import s_quaternius_medieval_village from "./quaternius-medieval-village.json" with { type: "json" };
|
|
8
|
+
import s_quaternius_modular_scifi from "./quaternius-modular-scifi.json" with { type: "json" };
|
|
9
|
+
import s_quaternius_stylized_nature from "./quaternius-stylized-nature.json" with { type: "json" };
|
|
4
10
|
export const generatedBySource = {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
11
|
+
"kaykit-adventurers": s_kaykit_adventurers,
|
|
12
|
+
"kaykit-city-builder": s_kaykit_city_builder,
|
|
13
|
+
"kaykit-dungeon": s_kaykit_dungeon,
|
|
14
|
+
"kaykit-furniture": s_kaykit_furniture,
|
|
15
|
+
"kaykit-skeletons": s_kaykit_skeletons,
|
|
16
|
+
"kaykit-space-base": s_kaykit_space_base,
|
|
17
|
+
"quaternius-medieval-village": s_quaternius_medieval_village,
|
|
18
|
+
"quaternius-modular-scifi": s_quaternius_modular_scifi,
|
|
19
|
+
"quaternius-stylized-nature": s_quaternius_stylized_nature,
|
|
8
20
|
};
|
|
9
21
|
export const generatedIndex = Object.values(generatedBySource).flat();
|