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/dist/index.cjs CHANGED
@@ -136,6 +136,9 @@ __export(index_exports, {
136
136
  PIXEL_ART_FIXER_REVISION: () => PIXEL_ART_FIXER_REVISION,
137
137
  PIXEL_ART_FIXER_URL: () => PIXEL_ART_FIXER_URL,
138
138
  PRO_TIER_PRICES: () => PRO_TIER_PRICES,
139
+ ParallaxLayerSchema: () => ParallaxLayerSchema,
140
+ ParallaxSetIdSchema: () => ParallaxSetIdSchema,
141
+ ParallaxSetSchema: () => ParallaxSetSchema,
139
142
  PixelKilnError: () => PixelKilnError,
140
143
  PixelLabClient: () => PixelLabClient,
141
144
  PixelLabError: () => PixelLabError,
@@ -2243,6 +2246,53 @@ var AssetSchema = import_zod.z.object({
2243
2246
  });
2244
2247
  var DEFAULT_HISTORY_LIMIT = 5;
2245
2248
  var HistoryLimitSchema = import_zod.z.number().int().min(0).max(100);
2249
+ var ParallaxLayerSchema = import_zod.z.object({
2250
+ /** Names the layer in exports; defaults to the asset id, the file name, or "sky". */
2251
+ name: import_zod.z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "letters, digits, - and _, starting with a letter").optional(),
2252
+ /** A manifest asset, read from the lockfile once generated. */
2253
+ asset: import_zod.z.string().min(1).optional(),
2254
+ /** The style the asset was generated under, when it was generated under more than one. */
2255
+ style: import_zod.z.string().min(1).optional(),
2256
+ /** A picture on disk, relative to the manifest: a layer finished by hand or by script. */
2257
+ file: import_zod.z.string().min(1).optional(),
2258
+ /** Flat colour bands, top to bottom, with a dithered step between neighbours. */
2259
+ sky: import_zod.z.array(HexColorSchema).min(1).max(64).optional(),
2260
+ speed: import_zod.z.number().min(0).max(4),
2261
+ /** Vertical speed; 1, moving with the level, when the set does not climb. */
2262
+ speedY: import_zod.z.number().min(0).max(4).optional(),
2263
+ /** Left edge on the set's canvas, whose origin is the view's top-left at the start. */
2264
+ x: import_zod.z.number().int().min(-1e5).max(1e5).optional(),
2265
+ /** The canvas row the layer's bottom edge sits on; the view's height when absent. */
2266
+ bottom: import_zod.z.number().int().min(-1e5).max(1e5).optional(),
2267
+ /**
2268
+ * Repeat the bottom row downward: true to the foot of the view, or this
2269
+ * many rows. A far range extended this way gives nearer
2270
+ * layers' feet distant land to dissolve into instead of floating.
2271
+ */
2272
+ extend: import_zod.z.union([import_zod.z.boolean(), import_zod.z.number().int().min(1).max(4096)]).optional(),
2273
+ /** Repeat sideways (the default) so the layer loops. */
2274
+ repeat: import_zod.z.boolean().optional(),
2275
+ /** Repeat vertically, for an endless climb. */
2276
+ repeatY: import_zod.z.boolean().optional()
2277
+ }).strict().superRefine((layer, ctx) => {
2278
+ const sources = [layer.asset, layer.file, layer.sky].filter((value) => value !== void 0).length;
2279
+ if (sources !== 1) {
2280
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, message: "a layer needs exactly one of asset, file, or sky" });
2281
+ }
2282
+ if (layer.style !== void 0 && layer.asset === void 0) {
2283
+ ctx.addIssue({ code: import_zod.z.ZodIssueCode.custom, path: ["style"], message: "style only applies to an asset layer" });
2284
+ }
2285
+ });
2286
+ var ParallaxSetSchema = import_zod.z.object({
2287
+ /** The game's view in pixels, [width, height]. */
2288
+ view: import_zod.z.tuple([import_zod.z.number().int().min(8).max(4096), import_zod.z.number().int().min(8).max(4096)]),
2289
+ /** How far the camera moves sideways across the level, in pixels. */
2290
+ travel: import_zod.z.number().int().min(0).max(1e5).optional(),
2291
+ /** How far the camera climbs, in pixels. */
2292
+ climb: import_zod.z.number().int().min(0).max(1e5).optional(),
2293
+ layers: import_zod.z.array(ParallaxLayerSchema).min(1).max(32)
2294
+ }).strict();
2295
+ 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");
2246
2296
  var ManifestSchema = import_zod.z.object({
2247
2297
  $schema: import_zod.z.string().optional(),
2248
2298
  name: import_zod.z.string(),
@@ -2251,7 +2301,9 @@ var ManifestSchema = import_zod.z.object({
2251
2301
  /** Replaced generations kept per asset for this project; overrides PIXELKILN_HISTORY. 0 keeps none. */
2252
2302
  history: HistoryLimitSchema.optional(),
2253
2303
  styles: import_zod.z.record(StyleSchema),
2254
- assets: import_zod.z.record(AssetSchema)
2304
+ assets: import_zod.z.record(AssetSchema),
2305
+ /** Parallax backgrounds built from the assets, by set id. */
2306
+ parallax: import_zod.z.record(ParallaxSetIdSchema, ParallaxSetSchema).optional()
2255
2307
  }).strict();
2256
2308
  var ManifestInputSchema = import_zod.z.object({
2257
2309
  $schema: import_zod.z.string().optional(),
@@ -2259,7 +2311,8 @@ var ManifestInputSchema = import_zod.z.object({
2259
2311
  provider: import_zod.z.string().min(1).default("pixellab"),
2260
2312
  history: HistoryLimitSchema.optional(),
2261
2313
  styles: import_zod.z.record(StyleInputSchema),
2262
- assets: import_zod.z.record(AssetSchema)
2314
+ assets: import_zod.z.record(AssetSchema),
2315
+ parallax: import_zod.z.record(ParallaxSetIdSchema, ParallaxSetSchema).optional()
2263
2316
  }).strict();
2264
2317
  var LockOutputSchema = import_zod.z.object({
2265
2318
  path: import_zod.z.string(),
@@ -14112,6 +14165,25 @@ ${issues}`);
14112
14165
  connectVisited.add(assetId);
14113
14166
  };
14114
14167
  for (const assetId of Object.keys(parsed.data.assets)) visitConnections(assetId);
14168
+ for (const [setId, set] of Object.entries(parsed.data.parallax ?? {})) {
14169
+ const names = /* @__PURE__ */ new Set();
14170
+ set.layers.forEach((layer, index) => {
14171
+ const at2 = `parallax.${setId}.layers.${index}`;
14172
+ if (layer.asset !== void 0) {
14173
+ const asset = parsed.data.assets[layer.asset];
14174
+ if (!asset) unknownReferences.push(`${at2}.asset: unknown asset "${layer.asset}"`);
14175
+ else if (layer.style !== void 0 && !asset.styles.includes(layer.style)) {
14176
+ unknownReferences.push(`${at2}.style: asset "${layer.asset}" is not generated under style "${layer.style}"`);
14177
+ } else if (layer.style === void 0 && asset.styles.length > 1) {
14178
+ unknownReferences.push(`${at2}.style: asset "${layer.asset}" has ${asset.styles.length} styles; name one`);
14179
+ }
14180
+ }
14181
+ if (layer.name !== void 0) {
14182
+ if (names.has(layer.name)) unknownReferences.push(`${at2}.name: "${layer.name}" is used twice`);
14183
+ names.add(layer.name);
14184
+ }
14185
+ });
14186
+ }
14115
14187
  if (unknownReferences.length) {
14116
14188
  throw new ProjectError(`Manifest at ${abs} is invalid:
14117
14189
  ${unknownReferences.map((i) => ` ${i}`).join("\n")}`);
@@ -30605,6 +30677,9 @@ async function workspaceStatus(ws, dir) {
30605
30677
  PIXEL_ART_FIXER_REVISION,
30606
30678
  PIXEL_ART_FIXER_URL,
30607
30679
  PRO_TIER_PRICES,
30680
+ ParallaxLayerSchema,
30681
+ ParallaxSetIdSchema,
30682
+ ParallaxSetSchema,
30608
30683
  PixelKilnError,
30609
30684
  PixelLabClient,
30610
30685
  PixelLabError,