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.cjs CHANGED
@@ -1545,8 +1545,18 @@ var StyleObjectSchema = import_zod.z.object({
1545
1545
  * it. Part of a `pixflux` asset's identity only when set.
1546
1546
  */
1547
1547
  textGuidanceScale: import_zod.z.number().min(1).max(20).optional(),
1548
- /** `character` only. Draw `standard` bases and every loop in isometric view. */
1548
+ /**
1549
+ * `character` and `pixflux`. Draw `standard` character bases and every
1550
+ * loop, or a `pixflux` image, in isometric view. PixelLab calls it weakly
1551
+ * guiding on `pixflux`. Part of a `pixflux` asset's identity only when true.
1552
+ */
1549
1553
  isometric: import_zod.z.boolean().optional(),
1554
+ /**
1555
+ * `pixflux` only, with `noBackground`: how the background is cut away.
1556
+ * `simple` is PixelLab's default and faster; `complex` handles fine or
1557
+ * busy edges better. Part of the asset's identity only when set.
1558
+ */
1559
+ backgroundRemoval: import_zod.z.enum(["simple", "complex"]).optional(),
1550
1560
  /** `character` only, `v3` bases: let PixelLab expand the prompt into a fuller one before drawing. */
1551
1561
  enhancePrompt: import_zod.z.boolean().optional(),
1552
1562
  /**
@@ -1620,6 +1630,20 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
1620
1630
  message: "tileFeature and styleImages cannot be combined; a connectable set derives its own tile geometry, so remove one or the other",
1621
1631
  path: ["tileFeature"]
1622
1632
  }).superRefine((style, ctx) => {
1633
+ if (style.backgroundRemoval !== void 0 && style.generator !== "pixflux") {
1634
+ ctx.addIssue({
1635
+ code: import_zod.z.ZodIssueCode.custom,
1636
+ message: `backgroundRemoval is taken by pixflux styles; this one uses "${style.generator}"`,
1637
+ path: ["backgroundRemoval"]
1638
+ });
1639
+ }
1640
+ if (style.backgroundRemoval !== void 0 && !style.noBackground) {
1641
+ ctx.addIssue({
1642
+ code: import_zod.z.ZodIssueCode.custom,
1643
+ message: "backgroundRemoval chooses how the background is cut away; this style keeps its background (noBackground is false)",
1644
+ path: ["backgroundRemoval"]
1645
+ });
1646
+ }
1623
1647
  if (style.quality && (style.generator === "tiles" || style.generator === "terrain" || style.generator === "animation" || style.generator === "vfx")) {
1624
1648
  ctx.addIssue({
1625
1649
  code: import_zod.z.ZodIssueCode.custom,
@@ -1853,6 +1877,12 @@ var AssetSchema = import_zod.z.object({
1853
1877
  * instead of starting from nothing.
1854
1878
  */
1855
1879
  initImage: import_zod.z.string().min(1).optional(),
1880
+ /**
1881
+ * `pixflux` styles: the way the subject faces. PixelLab calls it weakly
1882
+ * guiding, so treat it as a nudge. Part of the asset's identity only
1883
+ * when set.
1884
+ */
1885
+ direction: CharacterDirectionSchema.optional(),
1856
1886
  /**
1857
1887
  * With `initImage`: how strongly the starting image holds, 1 to 999.
1858
1888
  * PixelLab's default is 300.
@@ -3405,6 +3435,11 @@ var PixelLabClient = class {
3405
3435
  if (args.detail) body.detail = args.detail;
3406
3436
  if (args.view) body.view = args.view;
3407
3437
  if (args.textGuidanceScale != null) body.text_guidance_scale = args.textGuidanceScale;
3438
+ if (args.direction) body.direction = args.direction;
3439
+ if (args.isometric) body.isometric = true;
3440
+ if (args.backgroundRemoval) {
3441
+ body.background_removal_task = args.backgroundRemoval === "complex" ? "remove_complex_background" : "remove_simple_background";
3442
+ }
3408
3443
  if (args.seed != null) body.seed = args.seed;
3409
3444
  const res = validateResponse(
3410
3445
  PixfluxResponseSchema,
@@ -5338,6 +5373,9 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
5338
5373
  terrainEnhance: spec.terrainEnhance,
5339
5374
  // Absent unless a pixflux style sets it, so every older hash stands.
5340
5375
  textGuidanceScale: spec.textGuidanceScale,
5376
+ subjectDirection: spec.subjectDirection,
5377
+ isometric: spec.isometric,
5378
+ backgroundRemoval: spec.backgroundRemoval,
5341
5379
  terrainPlatformThickness: spec.terrainPlatformThickness,
5342
5380
  // Reference images enter as their bytes' hashes, never their paths.
5343
5381
  // The starting image by its bytes, with its strength only when set.
@@ -7878,6 +7916,9 @@ var PixelLabProvider = class _PixelLabProvider {
7878
7916
  // Only a view the style states: the resolved default would steer every scene and banner top-down.
7879
7917
  view: spec.styleView,
7880
7918
  textGuidanceScale: spec.textGuidanceScale,
7919
+ direction: spec.subjectDirection,
7920
+ isometric: spec.isometric,
7921
+ backgroundRemoval: spec.backgroundRemoval,
7881
7922
  seed: spec.seed,
7882
7923
  ...await initImageArgs(spec)
7883
7924
  });
@@ -12433,6 +12474,8 @@ async function resolveSpecs(loaded, filter) {
12433
12474
  view: style.view ?? (generator === "1dir" ? "top-down" : generator === "character" ? "low top-down" : "high top-down"),
12434
12475
  ...style.view !== void 0 ? { styleView: style.view } : {},
12435
12476
  ...generator === "pixflux" && style.textGuidanceScale !== void 0 ? { textGuidanceScale: style.textGuidanceScale } : {},
12477
+ ...generator === "pixflux" && style.isometric ? { isometric: true } : {},
12478
+ ...generator === "pixflux" && style.backgroundRemoval ? { backgroundRemoval: style.backgroundRemoval } : {},
12436
12479
  styleImagePaths: style.styleImages.map((s) => s.path),
12437
12480
  outline: style.outline,
12438
12481
  shading: style.shading,
@@ -12935,6 +12978,12 @@ async function resolveSpecs(loaded, filter) {
12935
12978
  }
12936
12979
  resolved.terrainConnect = links;
12937
12980
  }
12981
+ if (asset.direction) {
12982
+ if (resolved.generator !== "pixflux") {
12983
+ throw new Error(`assets.${assetId}.direction: a facing is taken by pixflux styles; style "${styleId}" uses "${resolved.generator}"`);
12984
+ }
12985
+ resolved.subjectDirection = asset.direction;
12986
+ }
12938
12987
  if (asset.initImage) {
12939
12988
  if (!["pixflux", "map", "isometricTile"].includes(resolved.generator)) {
12940
12989
  throw new Error(