pixelkiln 0.139.2 → 0.140.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 +876 -74
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +77 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +587 -43
- package/dist/index.d.ts +587 -43
- package/dist/index.js +74 -2
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +25 -0
- package/docs/MANIFEST.md +46 -0
- package/docs/PARALLAX.md +145 -8
- package/docs/README.md +2 -2
- package/docs/RESEARCH_PARALLAX.md +142 -36
- package/package.json +1 -1
- package/schema/manifest.schema.json +120 -0
- package/skills/pixelkiln/SKILL.md +3 -2
- package/skills/pixelkiln/references/parallax.md +44 -3
package/dist/index.js
CHANGED
|
@@ -1745,6 +1745,53 @@ var AssetSchema = z.object({
|
|
|
1745
1745
|
});
|
|
1746
1746
|
var DEFAULT_HISTORY_LIMIT = 5;
|
|
1747
1747
|
var HistoryLimitSchema = z.number().int().min(0).max(100);
|
|
1748
|
+
var ParallaxLayerSchema = z.object({
|
|
1749
|
+
/** Names the layer in exports; defaults to the asset id, the file name, or "sky". */
|
|
1750
|
+
name: z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "letters, digits, - and _, starting with a letter").optional(),
|
|
1751
|
+
/** A manifest asset, read from the lockfile once generated. */
|
|
1752
|
+
asset: z.string().min(1).optional(),
|
|
1753
|
+
/** The style the asset was generated under, when it was generated under more than one. */
|
|
1754
|
+
style: z.string().min(1).optional(),
|
|
1755
|
+
/** A picture on disk, relative to the manifest: a layer finished by hand or by script. */
|
|
1756
|
+
file: z.string().min(1).optional(),
|
|
1757
|
+
/** Flat colour bands, top to bottom, with a dithered step between neighbours. */
|
|
1758
|
+
sky: z.array(HexColorSchema).min(1).max(64).optional(),
|
|
1759
|
+
speed: z.number().min(0).max(4),
|
|
1760
|
+
/** Vertical speed; 1, moving with the level, when the set does not climb. */
|
|
1761
|
+
speedY: z.number().min(0).max(4).optional(),
|
|
1762
|
+
/** Left edge on the set's canvas, whose origin is the view's top-left at the start. */
|
|
1763
|
+
x: z.number().int().min(-1e5).max(1e5).optional(),
|
|
1764
|
+
/** The canvas row the layer's bottom edge sits on; the view's height when absent. */
|
|
1765
|
+
bottom: z.number().int().min(-1e5).max(1e5).optional(),
|
|
1766
|
+
/**
|
|
1767
|
+
* Repeat the bottom row downward: true to the foot of the view, or this
|
|
1768
|
+
* many rows. A far range extended this way gives nearer
|
|
1769
|
+
* layers' feet distant land to dissolve into instead of floating.
|
|
1770
|
+
*/
|
|
1771
|
+
extend: z.union([z.boolean(), z.number().int().min(1).max(4096)]).optional(),
|
|
1772
|
+
/** Repeat sideways (the default) so the layer loops. */
|
|
1773
|
+
repeat: z.boolean().optional(),
|
|
1774
|
+
/** Repeat vertically, for an endless climb. */
|
|
1775
|
+
repeatY: z.boolean().optional()
|
|
1776
|
+
}).strict().superRefine((layer, ctx) => {
|
|
1777
|
+
const sources = [layer.asset, layer.file, layer.sky].filter((value) => value !== void 0).length;
|
|
1778
|
+
if (sources !== 1) {
|
|
1779
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "a layer needs exactly one of asset, file, or sky" });
|
|
1780
|
+
}
|
|
1781
|
+
if (layer.style !== void 0 && layer.asset === void 0) {
|
|
1782
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["style"], message: "style only applies to an asset layer" });
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1785
|
+
var ParallaxSetSchema = z.object({
|
|
1786
|
+
/** The game's view in pixels, [width, height]. */
|
|
1787
|
+
view: z.tuple([z.number().int().min(8).max(4096), z.number().int().min(8).max(4096)]),
|
|
1788
|
+
/** How far the camera moves sideways across the level, in pixels. */
|
|
1789
|
+
travel: z.number().int().min(0).max(1e5).optional(),
|
|
1790
|
+
/** How far the camera climbs, in pixels. */
|
|
1791
|
+
climb: z.number().int().min(0).max(1e5).optional(),
|
|
1792
|
+
layers: z.array(ParallaxLayerSchema).min(1).max(32)
|
|
1793
|
+
}).strict();
|
|
1794
|
+
var ParallaxSetIdSchema = 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");
|
|
1748
1795
|
var ManifestSchema = z.object({
|
|
1749
1796
|
$schema: z.string().optional(),
|
|
1750
1797
|
name: z.string(),
|
|
@@ -1753,7 +1800,9 @@ var ManifestSchema = z.object({
|
|
|
1753
1800
|
/** Replaced generations kept per asset for this project; overrides PIXELKILN_HISTORY. 0 keeps none. */
|
|
1754
1801
|
history: HistoryLimitSchema.optional(),
|
|
1755
1802
|
styles: z.record(StyleSchema),
|
|
1756
|
-
assets: z.record(AssetSchema)
|
|
1803
|
+
assets: z.record(AssetSchema),
|
|
1804
|
+
/** Parallax backgrounds built from the assets, by set id. */
|
|
1805
|
+
parallax: z.record(ParallaxSetIdSchema, ParallaxSetSchema).optional()
|
|
1757
1806
|
}).strict();
|
|
1758
1807
|
var ManifestInputSchema = z.object({
|
|
1759
1808
|
$schema: z.string().optional(),
|
|
@@ -1761,7 +1810,8 @@ var ManifestInputSchema = z.object({
|
|
|
1761
1810
|
provider: z.string().min(1).default("pixellab"),
|
|
1762
1811
|
history: HistoryLimitSchema.optional(),
|
|
1763
1812
|
styles: z.record(StyleInputSchema),
|
|
1764
|
-
assets: z.record(AssetSchema)
|
|
1813
|
+
assets: z.record(AssetSchema),
|
|
1814
|
+
parallax: z.record(ParallaxSetIdSchema, ParallaxSetSchema).optional()
|
|
1765
1815
|
}).strict();
|
|
1766
1816
|
var LockOutputSchema = z.object({
|
|
1767
1817
|
path: z.string(),
|
|
@@ -13614,6 +13664,25 @@ ${issues}`);
|
|
|
13614
13664
|
connectVisited.add(assetId);
|
|
13615
13665
|
};
|
|
13616
13666
|
for (const assetId of Object.keys(parsed.data.assets)) visitConnections(assetId);
|
|
13667
|
+
for (const [setId, set] of Object.entries(parsed.data.parallax ?? {})) {
|
|
13668
|
+
const names = /* @__PURE__ */ new Set();
|
|
13669
|
+
set.layers.forEach((layer, index) => {
|
|
13670
|
+
const at2 = `parallax.${setId}.layers.${index}`;
|
|
13671
|
+
if (layer.asset !== void 0) {
|
|
13672
|
+
const asset = parsed.data.assets[layer.asset];
|
|
13673
|
+
if (!asset) unknownReferences.push(`${at2}.asset: unknown asset "${layer.asset}"`);
|
|
13674
|
+
else if (layer.style !== void 0 && !asset.styles.includes(layer.style)) {
|
|
13675
|
+
unknownReferences.push(`${at2}.style: asset "${layer.asset}" is not generated under style "${layer.style}"`);
|
|
13676
|
+
} else if (layer.style === void 0 && asset.styles.length > 1) {
|
|
13677
|
+
unknownReferences.push(`${at2}.style: asset "${layer.asset}" has ${asset.styles.length} styles; name one`);
|
|
13678
|
+
}
|
|
13679
|
+
}
|
|
13680
|
+
if (layer.name !== void 0) {
|
|
13681
|
+
if (names.has(layer.name)) unknownReferences.push(`${at2}.name: "${layer.name}" is used twice`);
|
|
13682
|
+
names.add(layer.name);
|
|
13683
|
+
}
|
|
13684
|
+
});
|
|
13685
|
+
}
|
|
13617
13686
|
if (unknownReferences.length) {
|
|
13618
13687
|
throw new ProjectError(`Manifest at ${abs} is invalid:
|
|
13619
13688
|
${unknownReferences.map((i) => ` ${i}`).join("\n")}`);
|
|
@@ -30106,6 +30175,9 @@ export {
|
|
|
30106
30175
|
PIXEL_ART_FIXER_REVISION,
|
|
30107
30176
|
PIXEL_ART_FIXER_URL,
|
|
30108
30177
|
PRO_TIER_PRICES,
|
|
30178
|
+
ParallaxLayerSchema,
|
|
30179
|
+
ParallaxSetIdSchema,
|
|
30180
|
+
ParallaxSetSchema,
|
|
30109
30181
|
PixelKilnError,
|
|
30110
30182
|
PixelLabClient,
|
|
30111
30183
|
PixelLabError,
|