pixelkiln 0.139.3 → 0.141.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/README.md +1 -1
- package/dist/cli.js +989 -74
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +117 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1019 -43
- package/dist/index.d.ts +1019 -43
- package/dist/index.js +113 -2
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +25 -0
- package/docs/MANIFEST.md +53 -0
- package/docs/PARALLAX.md +130 -30
- package/docs/README.md +2 -2
- package/docs/RESEARCH_PARALLAX.md +51 -31
- package/package.json +1 -1
- package/schema/manifest.schema.json +168 -0
- package/skills/pixelkiln/SKILL.md +3 -2
- package/skills/pixelkiln/references/parallax.md +32 -4
package/dist/index.cjs
CHANGED
|
@@ -136,6 +136,10 @@ __export(index_exports, {
|
|
|
136
136
|
PIXEL_ART_FIXER_REVISION: () => PIXEL_ART_FIXER_REVISION,
|
|
137
137
|
PIXEL_ART_FIXER_URL: () => PIXEL_ART_FIXER_URL,
|
|
138
138
|
PRO_TIER_PRICES: () => PRO_TIER_PRICES,
|
|
139
|
+
ParallaxLayerSchema: () => ParallaxLayerSchema,
|
|
140
|
+
ParallaxRunSpriteSchema: () => ParallaxRunSpriteSchema,
|
|
141
|
+
ParallaxSetIdSchema: () => ParallaxSetIdSchema,
|
|
142
|
+
ParallaxSetSchema: () => ParallaxSetSchema,
|
|
139
143
|
PixelKilnError: () => PixelKilnError,
|
|
140
144
|
PixelLabClient: () => PixelLabClient,
|
|
141
145
|
PixelLabError: () => PixelLabError,
|
|
@@ -2243,6 +2247,88 @@ var AssetSchema = import_zod.z.object({
|
|
|
2243
2247
|
});
|
|
2244
2248
|
var DEFAULT_HISTORY_LIMIT = 5;
|
|
2245
2249
|
var HistoryLimitSchema = import_zod.z.number().int().min(0).max(100);
|
|
2250
|
+
var ParallaxRunSpriteSchema = import_zod.z.object({
|
|
2251
|
+
asset: import_zod.z.string().min(1).optional(),
|
|
2252
|
+
/** The style the asset was generated under, when it was generated under more than one. */
|
|
2253
|
+
style: import_zod.z.string().min(1).optional(),
|
|
2254
|
+
file: import_zod.z.string().min(1).optional()
|
|
2255
|
+
}).strict().superRefine((sprite, ctx) => {
|
|
2256
|
+
if (sprite.asset === void 0 === (sprite.file === void 0)) {
|
|
2257
|
+
ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, message: "a run sprite needs exactly one of asset or file" });
|
|
2258
|
+
}
|
|
2259
|
+
if (sprite.style !== void 0 && sprite.asset === void 0) {
|
|
2260
|
+
ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: ["style"], message: "style only applies to an asset sprite" });
|
|
2261
|
+
}
|
|
2262
|
+
});
|
|
2263
|
+
var RUN_ONLY = ["seed", "step", "gap", "jitter", "width"];
|
|
2264
|
+
var ParallaxLayerSchema = import_zod.z.object({
|
|
2265
|
+
/** Names the layer in exports; defaults to the asset id, the file name, or "sky". */
|
|
2266
|
+
name: import_zod.z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "letters, digits, - and _, starting with a letter").optional(),
|
|
2267
|
+
/** A manifest asset, read from the lockfile once generated. */
|
|
2268
|
+
asset: import_zod.z.string().min(1).optional(),
|
|
2269
|
+
/** The style the asset was generated under, when it was generated under more than one. */
|
|
2270
|
+
style: import_zod.z.string().min(1).optional(),
|
|
2271
|
+
/** A picture on disk, relative to the manifest: a layer finished by hand or by script. */
|
|
2272
|
+
file: import_zod.z.string().min(1).optional(),
|
|
2273
|
+
/** Flat colour bands, top to bottom, with a dithered step between neighbours. */
|
|
2274
|
+
sky: import_zod.z.array(HexColorSchema).min(1).max(64).optional(),
|
|
2275
|
+
/**
|
|
2276
|
+
* Isolated silhouettes laid left to right in an overlapping run, each
|
|
2277
|
+
* flipped at random and never the same one twice in a row, so a long
|
|
2278
|
+
* level never shows the same stretch twice.
|
|
2279
|
+
*/
|
|
2280
|
+
run: import_zod.z.array(ParallaxRunSpriteSchema).min(1).max(32).optional(),
|
|
2281
|
+
/** Seeds a run's layout; the same seed lays the same run. Defaults to one taken from the layer's name. */
|
|
2282
|
+
seed: import_zod.z.number().int().min(0).max(2 ** 32 - 1).optional(),
|
|
2283
|
+
/** How far across one sprite the next starts, as a fraction of its width; 0.72 by default. */
|
|
2284
|
+
step: import_zod.z.number().min(0.1).max(2).optional(),
|
|
2285
|
+
/** Up to this many more pixels between sprites, at random; 16 by default. */
|
|
2286
|
+
gap: import_zod.z.number().int().min(0).max(4096).optional(),
|
|
2287
|
+
/** Moves each sprite's foot up or down by up to this many pixels; 0 by default. */
|
|
2288
|
+
jitter: import_zod.z.number().int().min(0).max(256).optional(),
|
|
2289
|
+
/** The run's length in pixels; by default as much as the camera sees of the layer. */
|
|
2290
|
+
width: import_zod.z.number().int().min(1).max(1e5).optional(),
|
|
2291
|
+
speed: import_zod.z.number().min(0).max(4),
|
|
2292
|
+
/** Vertical speed; 1, moving with the level, when the set does not climb. */
|
|
2293
|
+
speedY: import_zod.z.number().min(0).max(4).optional(),
|
|
2294
|
+
/** Left edge on the set's canvas, whose origin is the view's top-left at the start. */
|
|
2295
|
+
x: import_zod.z.number().int().min(-1e5).max(1e5).optional(),
|
|
2296
|
+
/** The canvas row the layer's bottom edge sits on; the view's height when absent. */
|
|
2297
|
+
bottom: import_zod.z.number().int().min(-1e5).max(1e5).optional(),
|
|
2298
|
+
/**
|
|
2299
|
+
* Repeat the bottom row downward: true to the foot of the view, or this
|
|
2300
|
+
* many rows. A far range extended this way gives nearer
|
|
2301
|
+
* layers' feet distant land to dissolve into instead of floating.
|
|
2302
|
+
*/
|
|
2303
|
+
extend: import_zod.z.union([import_zod.z.boolean(), import_zod.z.number().int().min(1).max(4096)]).optional(),
|
|
2304
|
+
/** Repeat sideways (the default) so the layer loops. */
|
|
2305
|
+
repeat: import_zod.z.boolean().optional(),
|
|
2306
|
+
/** Repeat vertically, for an endless climb. */
|
|
2307
|
+
repeatY: import_zod.z.boolean().optional()
|
|
2308
|
+
}).strict().superRefine((layer, ctx) => {
|
|
2309
|
+
const sources = [layer.asset, layer.file, layer.sky, layer.run].filter((value) => value !== void 0).length;
|
|
2310
|
+
if (sources !== 1) {
|
|
2311
|
+
ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, message: "a layer needs exactly one of asset, file, sky, or run" });
|
|
2312
|
+
}
|
|
2313
|
+
if (layer.run === void 0) {
|
|
2314
|
+
for (const key3 of RUN_ONLY) {
|
|
2315
|
+
if (layer[key3] !== void 0) ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: [key3], message: `${key3} only applies to a run layer` });
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
if (layer.style !== void 0 && layer.asset === void 0) {
|
|
2319
|
+
ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: ["style"], message: "style only applies to an asset layer" });
|
|
2320
|
+
}
|
|
2321
|
+
});
|
|
2322
|
+
var ParallaxSetSchema = import_zod.z.object({
|
|
2323
|
+
/** The game's view in pixels, [width, height]. */
|
|
2324
|
+
view: import_zod.z.tuple([import_zod.z.number().int().min(8).max(4096), import_zod.z.number().int().min(8).max(4096)]),
|
|
2325
|
+
/** How far the camera moves sideways across the level, in pixels. */
|
|
2326
|
+
travel: import_zod.z.number().int().min(0).max(1e5).optional(),
|
|
2327
|
+
/** How far the camera climbs, in pixels. */
|
|
2328
|
+
climb: import_zod.z.number().int().min(0).max(1e5).optional(),
|
|
2329
|
+
layers: import_zod.z.array(ParallaxLayerSchema).min(1).max(32)
|
|
2330
|
+
}).strict();
|
|
2331
|
+
var ParallaxSetIdSchema = import_zod.z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/, "a set id is letters, digits, - and _, starting with a letter or digit");
|
|
2246
2332
|
var ManifestSchema = import_zod.z.object({
|
|
2247
2333
|
$schema: import_zod.z.string().optional(),
|
|
2248
2334
|
name: import_zod.z.string(),
|
|
@@ -2251,7 +2337,9 @@ var ManifestSchema = import_zod.z.object({
|
|
|
2251
2337
|
/** Replaced generations kept per asset for this project; overrides PIXELKILN_HISTORY. 0 keeps none. */
|
|
2252
2338
|
history: HistoryLimitSchema.optional(),
|
|
2253
2339
|
styles: import_zod.z.record(StyleSchema),
|
|
2254
|
-
assets: import_zod.z.record(AssetSchema)
|
|
2340
|
+
assets: import_zod.z.record(AssetSchema),
|
|
2341
|
+
/** Parallax backgrounds built from the assets, by set id. */
|
|
2342
|
+
parallax: import_zod.z.record(ParallaxSetIdSchema, ParallaxSetSchema).optional()
|
|
2255
2343
|
}).strict();
|
|
2256
2344
|
var ManifestInputSchema = import_zod.z.object({
|
|
2257
2345
|
$schema: import_zod.z.string().optional(),
|
|
@@ -2259,7 +2347,8 @@ var ManifestInputSchema = import_zod.z.object({
|
|
|
2259
2347
|
provider: import_zod.z.string().min(1).default("pixellab"),
|
|
2260
2348
|
history: HistoryLimitSchema.optional(),
|
|
2261
2349
|
styles: import_zod.z.record(StyleInputSchema),
|
|
2262
|
-
assets: import_zod.z.record(AssetSchema)
|
|
2350
|
+
assets: import_zod.z.record(AssetSchema),
|
|
2351
|
+
parallax: import_zod.z.record(ParallaxSetIdSchema, ParallaxSetSchema).optional()
|
|
2263
2352
|
}).strict();
|
|
2264
2353
|
var LockOutputSchema = import_zod.z.object({
|
|
2265
2354
|
path: import_zod.z.string(),
|
|
@@ -14112,6 +14201,28 @@ ${issues}`);
|
|
|
14112
14201
|
connectVisited.add(assetId);
|
|
14113
14202
|
};
|
|
14114
14203
|
for (const assetId of Object.keys(parsed.data.assets)) visitConnections(assetId);
|
|
14204
|
+
for (const [setId, set] of Object.entries(parsed.data.parallax ?? {})) {
|
|
14205
|
+
const names = /* @__PURE__ */ new Set();
|
|
14206
|
+
set.layers.forEach((layer, index) => {
|
|
14207
|
+
const at2 = `parallax.${setId}.layers.${index}`;
|
|
14208
|
+
const checkAsset = (where, ref) => {
|
|
14209
|
+
if (ref.asset === void 0) return;
|
|
14210
|
+
const asset = parsed.data.assets[ref.asset];
|
|
14211
|
+
if (!asset) unknownReferences.push(`${where}.asset: unknown asset "${ref.asset}"`);
|
|
14212
|
+
else if (ref.style !== void 0 && !asset.styles.includes(ref.style)) {
|
|
14213
|
+
unknownReferences.push(`${where}.style: asset "${ref.asset}" is not generated under style "${ref.style}"`);
|
|
14214
|
+
} else if (ref.style === void 0 && asset.styles.length > 1) {
|
|
14215
|
+
unknownReferences.push(`${where}.style: asset "${ref.asset}" has ${asset.styles.length} styles; name one`);
|
|
14216
|
+
}
|
|
14217
|
+
};
|
|
14218
|
+
checkAsset(at2, layer);
|
|
14219
|
+
layer.run?.forEach((sprite, n) => checkAsset(`${at2}.run.${n}`, sprite));
|
|
14220
|
+
if (layer.name !== void 0) {
|
|
14221
|
+
if (names.has(layer.name)) unknownReferences.push(`${at2}.name: "${layer.name}" is used twice`);
|
|
14222
|
+
names.add(layer.name);
|
|
14223
|
+
}
|
|
14224
|
+
});
|
|
14225
|
+
}
|
|
14115
14226
|
if (unknownReferences.length) {
|
|
14116
14227
|
throw new ProjectError(`Manifest at ${abs} is invalid:
|
|
14117
14228
|
${unknownReferences.map((i) => ` ${i}`).join("\n")}`);
|
|
@@ -30605,6 +30716,10 @@ async function workspaceStatus(ws, dir) {
|
|
|
30605
30716
|
PIXEL_ART_FIXER_REVISION,
|
|
30606
30717
|
PIXEL_ART_FIXER_URL,
|
|
30607
30718
|
PRO_TIER_PRICES,
|
|
30719
|
+
ParallaxLayerSchema,
|
|
30720
|
+
ParallaxRunSpriteSchema,
|
|
30721
|
+
ParallaxSetIdSchema,
|
|
30722
|
+
ParallaxSetSchema,
|
|
30608
30723
|
PixelKilnError,
|
|
30609
30724
|
PixelLabClient,
|
|
30610
30725
|
PixelLabError,
|