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.cjs CHANGED
@@ -141,6 +141,8 @@ __export(index_exports, {
141
141
  ParallaxRunSpriteSchema: () => ParallaxRunSpriteSchema,
142
142
  ParallaxSetIdSchema: () => ParallaxSetIdSchema,
143
143
  ParallaxSetSchema: () => ParallaxSetSchema,
144
+ ParallaxTimeIdSchema: () => ParallaxTimeIdSchema,
145
+ ParallaxTimeSchema: () => ParallaxTimeSchema,
144
146
  ParallaxTintSchema: () => ParallaxTintSchema,
145
147
  PixelKilnError: () => PixelKilnError,
146
148
  PixelLabClient: () => PixelLabClient,
@@ -2366,6 +2368,13 @@ var ParallaxLayerSchema = import_zod.z.object({
2366
2368
  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" });
2367
2369
  }
2368
2370
  });
2371
+ var ParallaxTimeSchema = import_zod.z.object({
2372
+ /** A style id, for that style's palette, or a list of colours. */
2373
+ palette: import_zod.z.union([import_zod.z.string().min(1), import_zod.z.array(HexColorSchema).min(2).max(256)]),
2374
+ /** Map only onto colours whose blue is at least their red, which leaves out a night palette's lamps and moon. */
2375
+ cool: import_zod.z.boolean().optional()
2376
+ }).strict();
2377
+ var ParallaxTimeIdSchema = import_zod.z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,31}$/, "a time is letters, digits, - and _, starting with a letter");
2369
2378
  var ParallaxSetSchema = import_zod.z.object({
2370
2379
  /** The game's view in pixels, [width, height]. */
2371
2380
  view: import_zod.z.tuple([import_zod.z.number().int().min(8).max(4096), import_zod.z.number().int().min(8).max(4096)]),
@@ -2379,8 +2388,21 @@ var ParallaxSetSchema = import_zod.z.object({
2379
2388
  * the picture, so it adds none.
2380
2389
  */
2381
2390
  palette: import_zod.z.union([import_zod.z.string().min(1), import_zod.z.array(HexColorSchema).min(2).max(256)]).optional(),
2391
+ /**
2392
+ * Other times of day for the same set, by name: each swaps the set's
2393
+ * `palette` for another by luminance rank. Godot exports carry them in
2394
+ * one shader; Tiled and LDtk get a map per time.
2395
+ */
2396
+ times: import_zod.z.record(ParallaxTimeIdSchema, ParallaxTimeSchema).optional(),
2382
2397
  layers: import_zod.z.array(ParallaxLayerSchema).min(1).max(32)
2383
- }).strict();
2398
+ }).strict().superRefine((set, ctx) => {
2399
+ if (set.times && Object.keys(set.times).length && set.palette === void 0) {
2400
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: ["times"], message: "times swap the set's palette, so the set needs a palette" });
2401
+ }
2402
+ if (set.times && Object.keys(set.times).length > 15) {
2403
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: ["times"], message: "at most 15 times" });
2404
+ }
2405
+ });
2384
2406
  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");
2385
2407
  var ManifestSchema = import_zod.z.object({
2386
2408
  $schema: import_zod.z.string().optional(),
@@ -14365,6 +14387,12 @@ ${issues}`);
14365
14387
  if (!style) unknownReferences.push(`parallax.${setId}.palette: unknown style "${set.palette}"`);
14366
14388
  else if (style.palette.length < 2) unknownReferences.push(`parallax.${setId}.palette: style "${set.palette}" has no palette`);
14367
14389
  }
14390
+ for (const [time, spec] of Object.entries(set.times ?? {})) {
14391
+ if (typeof spec.palette !== "string") continue;
14392
+ const style = parsed.data.styles[spec.palette];
14393
+ if (!style) unknownReferences.push(`parallax.${setId}.times.${time}.palette: unknown style "${spec.palette}"`);
14394
+ else if (style.palette.length < 2) unknownReferences.push(`parallax.${setId}.times.${time}.palette: style "${spec.palette}" has no palette`);
14395
+ }
14368
14396
  set.layers.forEach((layer, index) => {
14369
14397
  const at2 = `parallax.${setId}.layers.${index}`;
14370
14398
  const checkAsset = (where, ref) => {
@@ -17760,7 +17788,12 @@ var RecipeSchema = import_zod5.z.object({
17760
17788
  sourceImage: RecipeBindingSchema.optional(),
17761
17789
  maskImage: RecipeBindingSchema.optional(),
17762
17790
  strength: RecipeBindingSchema.optional()
17763
- }).strict()
17791
+ }).catchall(RecipeBindingSchema),
17792
+ /** Frame-set options; required when the style's generator is `frames`. */
17793
+ frames: import_zod5.z.object({
17794
+ vary: import_zod5.z.string().min(1),
17795
+ seedStep: import_zod5.z.number().int().optional()
17796
+ }).strict().optional()
17764
17797
  }).strict().optional(),
17765
17798
  quality: import_zod5.z.object({
17766
17799
  stage: import_zod5.z.enum(["composition-source", "production-candidate"]),
@@ -17854,11 +17887,27 @@ var RecipeSchema = import_zod5.z.object({
17854
17887
  });
17855
17888
  return;
17856
17889
  }
17890
+ const frames = recipe.workflow.frames;
17891
+ if (recipe.style.generator === "frames" !== (frames !== void 0)) {
17892
+ context.addIssue({
17893
+ code: import_zod5.z.ZodIssueCode.custom,
17894
+ path: ["workflow", "frames"],
17895
+ message: "is required for a frames style and only allowed there"
17896
+ });
17897
+ }
17898
+ if (frames && !Object.hasOwn(recipe.workflow.bindings, frames.vary)) {
17899
+ context.addIssue({
17900
+ code: import_zod5.z.ZodIssueCode.custom,
17901
+ path: ["workflow", "frames", "vary"],
17902
+ message: "must name a workflow binding"
17903
+ });
17904
+ }
17857
17905
  const expected = {
17858
17906
  workflowFile: `${RECIPE_DIR_TOKEN}/${recipe.workflow.path}`,
17859
17907
  outputNodeId: recipe.workflow.outputNodeId,
17860
17908
  numImages: recipe.workflow.numImages,
17861
- bindings: recipe.workflow.bindings
17909
+ bindings: recipe.workflow.bindings,
17910
+ frames
17862
17911
  };
17863
17912
  if (JSON.stringify(canonical3(options)) !== JSON.stringify(canonical3(expected))) {
17864
17913
  context.addIssue({
@@ -30904,6 +30953,8 @@ async function workspaceStatus(ws, dir) {
30904
30953
  ParallaxRunSpriteSchema,
30905
30954
  ParallaxSetIdSchema,
30906
30955
  ParallaxSetSchema,
30956
+ ParallaxTimeIdSchema,
30957
+ ParallaxTimeSchema,
30907
30958
  ParallaxTintSchema,
30908
30959
  PixelKilnError,
30909
30960
  PixelLabClient,