pixelkiln 0.103.0 → 0.104.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
@@ -1086,8 +1086,18 @@ var StyleObjectSchema = z.object({
1086
1086
  * it. Part of a `pixflux` asset's identity only when set.
1087
1087
  */
1088
1088
  textGuidanceScale: z.number().min(1).max(20).optional(),
1089
- /** `character` only. Draw `standard` bases and every loop in isometric view. */
1089
+ /**
1090
+ * `character` and `pixflux`. Draw `standard` character bases and every
1091
+ * loop, or a `pixflux` image, in isometric view. PixelLab calls it weakly
1092
+ * guiding on `pixflux`. Part of a `pixflux` asset's identity only when true.
1093
+ */
1090
1094
  isometric: z.boolean().optional(),
1095
+ /**
1096
+ * `pixflux` only, with `noBackground`: how the background is cut away.
1097
+ * `simple` is PixelLab's default and faster; `complex` handles fine or
1098
+ * busy edges better. Part of the asset's identity only when set.
1099
+ */
1100
+ backgroundRemoval: z.enum(["simple", "complex"]).optional(),
1091
1101
  /** `character` only, `v3` bases: let PixelLab expand the prompt into a fuller one before drawing. */
1092
1102
  enhancePrompt: z.boolean().optional(),
1093
1103
  /**
@@ -1161,6 +1171,20 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
1161
1171
  message: "tileFeature and styleImages cannot be combined; a connectable set derives its own tile geometry, so remove one or the other",
1162
1172
  path: ["tileFeature"]
1163
1173
  }).superRefine((style, ctx) => {
1174
+ if (style.backgroundRemoval !== void 0 && style.generator !== "pixflux") {
1175
+ ctx.addIssue({
1176
+ code: z.ZodIssueCode.custom,
1177
+ message: `backgroundRemoval is taken by pixflux styles; this one uses "${style.generator}"`,
1178
+ path: ["backgroundRemoval"]
1179
+ });
1180
+ }
1181
+ if (style.backgroundRemoval !== void 0 && !style.noBackground) {
1182
+ ctx.addIssue({
1183
+ code: z.ZodIssueCode.custom,
1184
+ message: "backgroundRemoval chooses how the background is cut away; this style keeps its background (noBackground is false)",
1185
+ path: ["backgroundRemoval"]
1186
+ });
1187
+ }
1164
1188
  if (style.quality && (style.generator === "tiles" || style.generator === "terrain" || style.generator === "animation" || style.generator === "vfx")) {
1165
1189
  ctx.addIssue({
1166
1190
  code: z.ZodIssueCode.custom,
@@ -1394,6 +1418,12 @@ var AssetSchema = z.object({
1394
1418
  * instead of starting from nothing.
1395
1419
  */
1396
1420
  initImage: z.string().min(1).optional(),
1421
+ /**
1422
+ * `pixflux` styles: the way the subject faces. PixelLab calls it weakly
1423
+ * guiding, so treat it as a nudge. Part of the asset's identity only
1424
+ * when set.
1425
+ */
1426
+ direction: CharacterDirectionSchema.optional(),
1397
1427
  /**
1398
1428
  * With `initImage`: how strongly the starting image holds, 1 to 999.
1399
1429
  * PixelLab's default is 300.
@@ -2946,6 +2976,11 @@ var PixelLabClient = class {
2946
2976
  if (args.detail) body.detail = args.detail;
2947
2977
  if (args.view) body.view = args.view;
2948
2978
  if (args.textGuidanceScale != null) body.text_guidance_scale = args.textGuidanceScale;
2979
+ if (args.direction) body.direction = args.direction;
2980
+ if (args.isometric) body.isometric = true;
2981
+ if (args.backgroundRemoval) {
2982
+ body.background_removal_task = args.backgroundRemoval === "complex" ? "remove_complex_background" : "remove_simple_background";
2983
+ }
2949
2984
  if (args.seed != null) body.seed = args.seed;
2950
2985
  const res = validateResponse(
2951
2986
  PixfluxResponseSchema,
@@ -4879,6 +4914,9 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
4879
4914
  terrainEnhance: spec.terrainEnhance,
4880
4915
  // Absent unless a pixflux style sets it, so every older hash stands.
4881
4916
  textGuidanceScale: spec.textGuidanceScale,
4917
+ subjectDirection: spec.subjectDirection,
4918
+ isometric: spec.isometric,
4919
+ backgroundRemoval: spec.backgroundRemoval,
4882
4920
  terrainPlatformThickness: spec.terrainPlatformThickness,
4883
4921
  // Reference images enter as their bytes' hashes, never their paths.
4884
4922
  // The starting image by its bytes, with its strength only when set.
@@ -7419,6 +7457,9 @@ var PixelLabProvider = class _PixelLabProvider {
7419
7457
  // Only a view the style states: the resolved default would steer every scene and banner top-down.
7420
7458
  view: spec.styleView,
7421
7459
  textGuidanceScale: spec.textGuidanceScale,
7460
+ direction: spec.subjectDirection,
7461
+ isometric: spec.isometric,
7462
+ backgroundRemoval: spec.backgroundRemoval,
7422
7463
  seed: spec.seed,
7423
7464
  ...await initImageArgs(spec)
7424
7465
  });
@@ -11974,6 +12015,8 @@ async function resolveSpecs(loaded, filter) {
11974
12015
  view: style.view ?? (generator === "1dir" ? "top-down" : generator === "character" ? "low top-down" : "high top-down"),
11975
12016
  ...style.view !== void 0 ? { styleView: style.view } : {},
11976
12017
  ...generator === "pixflux" && style.textGuidanceScale !== void 0 ? { textGuidanceScale: style.textGuidanceScale } : {},
12018
+ ...generator === "pixflux" && style.isometric ? { isometric: true } : {},
12019
+ ...generator === "pixflux" && style.backgroundRemoval ? { backgroundRemoval: style.backgroundRemoval } : {},
11977
12020
  styleImagePaths: style.styleImages.map((s) => s.path),
11978
12021
  outline: style.outline,
11979
12022
  shading: style.shading,
@@ -12476,6 +12519,12 @@ async function resolveSpecs(loaded, filter) {
12476
12519
  }
12477
12520
  resolved.terrainConnect = links;
12478
12521
  }
12522
+ if (asset.direction) {
12523
+ if (resolved.generator !== "pixflux") {
12524
+ throw new Error(`assets.${assetId}.direction: a facing is taken by pixflux styles; style "${styleId}" uses "${resolved.generator}"`);
12525
+ }
12526
+ resolved.subjectDirection = asset.direction;
12527
+ }
12479
12528
  if (asset.initImage) {
12480
12529
  if (!["pixflux", "map", "isometricTile"].includes(resolved.generator)) {
12481
12530
  throw new Error(