pixelkiln 0.144.2 → 0.146.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.js CHANGED
@@ -1861,6 +1861,13 @@ var ParallaxLayerSchema = z.object({
1861
1861
  ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["extend"], message: "extend repeats the bottom row, which foot thins out; use one or the other" });
1862
1862
  }
1863
1863
  });
1864
+ var ParallaxTimeSchema = z.object({
1865
+ /** A style id, for that style's palette, or a list of colours. */
1866
+ palette: z.union([z.string().min(1), z.array(HexColorSchema).min(2).max(256)]),
1867
+ /** Map only onto colours whose blue is at least their red, which leaves out a night palette's lamps and moon. */
1868
+ cool: z.boolean().optional()
1869
+ }).strict();
1870
+ var ParallaxTimeIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,31}$/, "a time is letters, digits, - and _, starting with a letter");
1864
1871
  var ParallaxSetSchema = z.object({
1865
1872
  /** The game's view in pixels, [width, height]. */
1866
1873
  view: z.tuple([z.number().int().min(8).max(4096), z.number().int().min(8).max(4096)]),
@@ -1874,8 +1881,21 @@ var ParallaxSetSchema = z.object({
1874
1881
  * the picture, so it adds none.
1875
1882
  */
1876
1883
  palette: z.union([z.string().min(1), z.array(HexColorSchema).min(2).max(256)]).optional(),
1884
+ /**
1885
+ * Other times of day for the same set, by name: each swaps the set's
1886
+ * `palette` for another by luminance rank. Godot exports carry them in
1887
+ * one shader; Tiled and LDtk get a map per time.
1888
+ */
1889
+ times: z.record(ParallaxTimeIdSchema, ParallaxTimeSchema).optional(),
1877
1890
  layers: z.array(ParallaxLayerSchema).min(1).max(32)
1878
- }).strict();
1891
+ }).strict().superRefine((set, ctx) => {
1892
+ if (set.times && Object.keys(set.times).length && set.palette === void 0) {
1893
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["times"], message: "times swap the set's palette, so the set needs a palette" });
1894
+ }
1895
+ if (set.times && Object.keys(set.times).length > 15) {
1896
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["times"], message: "at most 15 times" });
1897
+ }
1898
+ });
1879
1899
  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");
1880
1900
  var ManifestSchema = z.object({
1881
1901
  $schema: z.string().optional(),
@@ -13860,6 +13880,12 @@ ${issues}`);
13860
13880
  if (!style) unknownReferences.push(`parallax.${setId}.palette: unknown style "${set.palette}"`);
13861
13881
  else if (style.palette.length < 2) unknownReferences.push(`parallax.${setId}.palette: style "${set.palette}" has no palette`);
13862
13882
  }
13883
+ for (const [time, spec] of Object.entries(set.times ?? {})) {
13884
+ if (typeof spec.palette !== "string") continue;
13885
+ const style = parsed.data.styles[spec.palette];
13886
+ if (!style) unknownReferences.push(`parallax.${setId}.times.${time}.palette: unknown style "${spec.palette}"`);
13887
+ else if (style.palette.length < 2) unknownReferences.push(`parallax.${setId}.times.${time}.palette: style "${spec.palette}" has no palette`);
13888
+ }
13863
13889
  set.layers.forEach((layer, index) => {
13864
13890
  const at2 = `parallax.${setId}.layers.${index}`;
13865
13891
  const checkAsset = (where, ref) => {
@@ -17255,7 +17281,12 @@ var RecipeSchema = z5.object({
17255
17281
  sourceImage: RecipeBindingSchema.optional(),
17256
17282
  maskImage: RecipeBindingSchema.optional(),
17257
17283
  strength: RecipeBindingSchema.optional()
17258
- }).strict()
17284
+ }).catchall(RecipeBindingSchema),
17285
+ /** Frame-set options; required when the style's generator is `frames`. */
17286
+ frames: z5.object({
17287
+ vary: z5.string().min(1),
17288
+ seedStep: z5.number().int().optional()
17289
+ }).strict().optional()
17259
17290
  }).strict().optional(),
17260
17291
  quality: z5.object({
17261
17292
  stage: z5.enum(["composition-source", "production-candidate"]),
@@ -17349,11 +17380,27 @@ var RecipeSchema = z5.object({
17349
17380
  });
17350
17381
  return;
17351
17382
  }
17383
+ const frames = recipe.workflow.frames;
17384
+ if (recipe.style.generator === "frames" !== (frames !== void 0)) {
17385
+ context.addIssue({
17386
+ code: z5.ZodIssueCode.custom,
17387
+ path: ["workflow", "frames"],
17388
+ message: "is required for a frames style and only allowed there"
17389
+ });
17390
+ }
17391
+ if (frames && !Object.hasOwn(recipe.workflow.bindings, frames.vary)) {
17392
+ context.addIssue({
17393
+ code: z5.ZodIssueCode.custom,
17394
+ path: ["workflow", "frames", "vary"],
17395
+ message: "must name a workflow binding"
17396
+ });
17397
+ }
17352
17398
  const expected = {
17353
17399
  workflowFile: `${RECIPE_DIR_TOKEN}/${recipe.workflow.path}`,
17354
17400
  outputNodeId: recipe.workflow.outputNodeId,
17355
17401
  numImages: recipe.workflow.numImages,
17356
- bindings: recipe.workflow.bindings
17402
+ bindings: recipe.workflow.bindings,
17403
+ frames
17357
17404
  };
17358
17405
  if (JSON.stringify(canonical3(options)) !== JSON.stringify(canonical3(expected))) {
17359
17406
  context.addIssue({
@@ -30398,6 +30445,8 @@ export {
30398
30445
  ParallaxRunSpriteSchema,
30399
30446
  ParallaxSetIdSchema,
30400
30447
  ParallaxSetSchema,
30448
+ ParallaxTimeIdSchema,
30449
+ ParallaxTimeSchema,
30401
30450
  ParallaxTintSchema,
30402
30451
  PixelKilnError,
30403
30452
  PixelLabClient,