pixelkiln 0.140.0 → 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/dist/cli.js +142 -29
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +50 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +433 -1
- package/dist/index.d.ts +433 -1
- package/dist/index.js +49 -10
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +2 -2
- package/docs/MANIFEST.md +10 -3
- package/docs/PARALLAX.md +31 -31
- package/docs/RESEARCH_PARALLAX.md +4 -2
- package/package.json +1 -1
- package/schema/manifest.schema.json +48 -0
- package/skills/pixelkiln/references/parallax.md +7 -3
package/dist/index.js
CHANGED
|
@@ -1745,6 +1745,20 @@ 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 ParallaxRunSpriteSchema = z.object({
|
|
1749
|
+
asset: z.string().min(1).optional(),
|
|
1750
|
+
/** The style the asset was generated under, when it was generated under more than one. */
|
|
1751
|
+
style: z.string().min(1).optional(),
|
|
1752
|
+
file: z.string().min(1).optional()
|
|
1753
|
+
}).strict().superRefine((sprite, ctx) => {
|
|
1754
|
+
if (sprite.asset === void 0 === (sprite.file === void 0)) {
|
|
1755
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "a run sprite needs exactly one of asset or file" });
|
|
1756
|
+
}
|
|
1757
|
+
if (sprite.style !== void 0 && sprite.asset === void 0) {
|
|
1758
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["style"], message: "style only applies to an asset sprite" });
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
var RUN_ONLY = ["seed", "step", "gap", "jitter", "width"];
|
|
1748
1762
|
var ParallaxLayerSchema = z.object({
|
|
1749
1763
|
/** Names the layer in exports; defaults to the asset id, the file name, or "sky". */
|
|
1750
1764
|
name: z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "letters, digits, - and _, starting with a letter").optional(),
|
|
@@ -1756,6 +1770,22 @@ var ParallaxLayerSchema = z.object({
|
|
|
1756
1770
|
file: z.string().min(1).optional(),
|
|
1757
1771
|
/** Flat colour bands, top to bottom, with a dithered step between neighbours. */
|
|
1758
1772
|
sky: z.array(HexColorSchema).min(1).max(64).optional(),
|
|
1773
|
+
/**
|
|
1774
|
+
* Isolated silhouettes laid left to right in an overlapping run, each
|
|
1775
|
+
* flipped at random and never the same one twice in a row, so a long
|
|
1776
|
+
* level never shows the same stretch twice.
|
|
1777
|
+
*/
|
|
1778
|
+
run: z.array(ParallaxRunSpriteSchema).min(1).max(32).optional(),
|
|
1779
|
+
/** Seeds a run's layout; the same seed lays the same run. Defaults to one taken from the layer's name. */
|
|
1780
|
+
seed: z.number().int().min(0).max(2 ** 32 - 1).optional(),
|
|
1781
|
+
/** How far across one sprite the next starts, as a fraction of its width; 0.72 by default. */
|
|
1782
|
+
step: z.number().min(0.1).max(2).optional(),
|
|
1783
|
+
/** Up to this many more pixels between sprites, at random; 16 by default. */
|
|
1784
|
+
gap: z.number().int().min(0).max(4096).optional(),
|
|
1785
|
+
/** Moves each sprite's foot up or down by up to this many pixels; 0 by default. */
|
|
1786
|
+
jitter: z.number().int().min(0).max(256).optional(),
|
|
1787
|
+
/** The run's length in pixels; by default as much as the camera sees of the layer. */
|
|
1788
|
+
width: z.number().int().min(1).max(1e5).optional(),
|
|
1759
1789
|
speed: z.number().min(0).max(4),
|
|
1760
1790
|
/** Vertical speed; 1, moving with the level, when the set does not climb. */
|
|
1761
1791
|
speedY: z.number().min(0).max(4).optional(),
|
|
@@ -1774,9 +1804,14 @@ var ParallaxLayerSchema = z.object({
|
|
|
1774
1804
|
/** Repeat vertically, for an endless climb. */
|
|
1775
1805
|
repeatY: z.boolean().optional()
|
|
1776
1806
|
}).strict().superRefine((layer, ctx) => {
|
|
1777
|
-
const sources = [layer.asset, layer.file, layer.sky].filter((value) => value !== void 0).length;
|
|
1807
|
+
const sources = [layer.asset, layer.file, layer.sky, layer.run].filter((value) => value !== void 0).length;
|
|
1778
1808
|
if (sources !== 1) {
|
|
1779
|
-
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "a layer needs exactly one of asset, file, or
|
|
1809
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "a layer needs exactly one of asset, file, sky, or run" });
|
|
1810
|
+
}
|
|
1811
|
+
if (layer.run === void 0) {
|
|
1812
|
+
for (const key3 of RUN_ONLY) {
|
|
1813
|
+
if (layer[key3] !== void 0) ctx.addIssue({ code: z.ZodIssueCode.custom, path: [key3], message: `${key3} only applies to a run layer` });
|
|
1814
|
+
}
|
|
1780
1815
|
}
|
|
1781
1816
|
if (layer.style !== void 0 && layer.asset === void 0) {
|
|
1782
1817
|
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["style"], message: "style only applies to an asset layer" });
|
|
@@ -13668,15 +13703,18 @@ ${issues}`);
|
|
|
13668
13703
|
const names = /* @__PURE__ */ new Set();
|
|
13669
13704
|
set.layers.forEach((layer, index) => {
|
|
13670
13705
|
const at2 = `parallax.${setId}.layers.${index}`;
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13706
|
+
const checkAsset = (where, ref) => {
|
|
13707
|
+
if (ref.asset === void 0) return;
|
|
13708
|
+
const asset = parsed.data.assets[ref.asset];
|
|
13709
|
+
if (!asset) unknownReferences.push(`${where}.asset: unknown asset "${ref.asset}"`);
|
|
13710
|
+
else if (ref.style !== void 0 && !asset.styles.includes(ref.style)) {
|
|
13711
|
+
unknownReferences.push(`${where}.style: asset "${ref.asset}" is not generated under style "${ref.style}"`);
|
|
13712
|
+
} else if (ref.style === void 0 && asset.styles.length > 1) {
|
|
13713
|
+
unknownReferences.push(`${where}.style: asset "${ref.asset}" has ${asset.styles.length} styles; name one`);
|
|
13678
13714
|
}
|
|
13679
|
-
}
|
|
13715
|
+
};
|
|
13716
|
+
checkAsset(at2, layer);
|
|
13717
|
+
layer.run?.forEach((sprite, n) => checkAsset(`${at2}.run.${n}`, sprite));
|
|
13680
13718
|
if (layer.name !== void 0) {
|
|
13681
13719
|
if (names.has(layer.name)) unknownReferences.push(`${at2}.name: "${layer.name}" is used twice`);
|
|
13682
13720
|
names.add(layer.name);
|
|
@@ -30176,6 +30214,7 @@ export {
|
|
|
30176
30214
|
PIXEL_ART_FIXER_URL,
|
|
30177
30215
|
PRO_TIER_PRICES,
|
|
30178
30216
|
ParallaxLayerSchema,
|
|
30217
|
+
ParallaxRunSpriteSchema,
|
|
30179
30218
|
ParallaxSetIdSchema,
|
|
30180
30219
|
ParallaxSetSchema,
|
|
30181
30220
|
PixelKilnError,
|