pixelkiln 0.141.0 → 0.142.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/index.cjs CHANGED
@@ -140,6 +140,7 @@ __export(index_exports, {
140
140
  ParallaxRunSpriteSchema: () => ParallaxRunSpriteSchema,
141
141
  ParallaxSetIdSchema: () => ParallaxSetIdSchema,
142
142
  ParallaxSetSchema: () => ParallaxSetSchema,
143
+ ParallaxTintSchema: () => ParallaxTintSchema,
143
144
  PixelKilnError: () => PixelKilnError,
144
145
  PixelLabClient: () => PixelLabClient,
145
146
  PixelLabError: () => PixelLabError,
@@ -2261,6 +2262,11 @@ var ParallaxRunSpriteSchema = import_zod.z.object({
2261
2262
  }
2262
2263
  });
2263
2264
  var RUN_ONLY = ["seed", "step", "gap", "jitter", "width"];
2265
+ var ParallaxTintSchema = import_zod.z.object({
2266
+ color: HexColorSchema,
2267
+ /** 0 leaves the picture as it is; 1 makes every pixel the colour, snapped. */
2268
+ amount: import_zod.z.number().min(0).max(1)
2269
+ }).strict();
2264
2270
  var ParallaxLayerSchema = import_zod.z.object({
2265
2271
  /** Names the layer in exports; defaults to the asset id, the file name, or "sky". */
2266
2272
  name: import_zod.z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "letters, digits, - and _, starting with a letter").optional(),
@@ -2304,7 +2310,16 @@ var ParallaxLayerSchema = import_zod.z.object({
2304
2310
  /** Repeat sideways (the default) so the layer loops. */
2305
2311
  repeat: import_zod.z.boolean().optional(),
2306
2312
  /** Repeat vertically, for an endless climb. */
2307
- repeatY: import_zod.z.boolean().optional()
2313
+ repeatY: import_zod.z.boolean().optional(),
2314
+ /**
2315
+ * Trim the picture to its opaque box, then thin out this fraction of it
2316
+ * from the bottom with a 4x4 ordered dither, so its foot dissolves into
2317
+ * what is behind it. A layer that repeats sideways keeps its width. In a
2318
+ * run, each sprite is trimmed and thinned before it is laid.
2319
+ */
2320
+ foot: import_zod.z.number().gt(0).max(1).optional(),
2321
+ /** Pull the picture (each sprite of a run) toward a colour and snap it to the set's palette. Applied after `foot`. */
2322
+ tint: ParallaxTintSchema.optional()
2308
2323
  }).strict().superRefine((layer, ctx) => {
2309
2324
  const sources = [layer.asset, layer.file, layer.sky, layer.run].filter((value) => value !== void 0).length;
2310
2325
  if (sources !== 1) {
@@ -2318,6 +2333,14 @@ var ParallaxLayerSchema = import_zod.z.object({
2318
2333
  if (layer.style !== void 0 && layer.asset === void 0) {
2319
2334
  ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: ["style"], message: "style only applies to an asset layer" });
2320
2335
  }
2336
+ if (layer.sky !== void 0) {
2337
+ for (const key3 of ["foot", "tint"]) {
2338
+ if (layer[key3] !== void 0) ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: [key3], message: `${key3} does not apply to a sky layer` });
2339
+ }
2340
+ }
2341
+ if (layer.foot !== void 0 && layer.extend !== void 0) {
2342
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: ["extend"], message: "extend repeats the bottom row, which foot thins out; use one or the other" });
2343
+ }
2321
2344
  });
2322
2345
  var ParallaxSetSchema = import_zod.z.object({
2323
2346
  /** The game's view in pixels, [width, height]. */
@@ -2326,6 +2349,12 @@ var ParallaxSetSchema = import_zod.z.object({
2326
2349
  travel: import_zod.z.number().int().min(0).max(1e5).optional(),
2327
2350
  /** How far the camera climbs, in pixels. */
2328
2351
  climb: import_zod.z.number().int().min(0).max(1e5).optional(),
2352
+ /**
2353
+ * What a layer's `tint` snaps to: a style id, for that style's palette, or
2354
+ * a list of colours. Without one, a tint snaps to the colours already in
2355
+ * the picture, so it adds none.
2356
+ */
2357
+ palette: import_zod.z.union([import_zod.z.string().min(1), import_zod.z.array(HexColorSchema).min(2).max(256)]).optional(),
2329
2358
  layers: import_zod.z.array(ParallaxLayerSchema).min(1).max(32)
2330
2359
  }).strict();
2331
2360
  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");
@@ -14203,6 +14232,11 @@ ${issues}`);
14203
14232
  for (const assetId of Object.keys(parsed.data.assets)) visitConnections(assetId);
14204
14233
  for (const [setId, set] of Object.entries(parsed.data.parallax ?? {})) {
14205
14234
  const names = /* @__PURE__ */ new Set();
14235
+ if (typeof set.palette === "string") {
14236
+ const style = parsed.data.styles[set.palette];
14237
+ if (!style) unknownReferences.push(`parallax.${setId}.palette: unknown style "${set.palette}"`);
14238
+ else if (style.palette.length < 2) unknownReferences.push(`parallax.${setId}.palette: style "${set.palette}" has no palette`);
14239
+ }
14206
14240
  set.layers.forEach((layer, index) => {
14207
14241
  const at2 = `parallax.${setId}.layers.${index}`;
14208
14242
  const checkAsset = (where, ref) => {
@@ -30720,6 +30754,7 @@ async function workspaceStatus(ws, dir) {
30720
30754
  ParallaxRunSpriteSchema,
30721
30755
  ParallaxSetIdSchema,
30722
30756
  ParallaxSetSchema,
30757
+ ParallaxTintSchema,
30723
30758
  PixelKilnError,
30724
30759
  PixelLabClient,
30725
30760
  PixelLabError,