pixelkiln 0.102.2 → 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
@@ -1539,13 +1539,24 @@ var StyleObjectSchema = import_zod.z.object({
1539
1539
  /** `character` only, `standard` humanoid bases. A preset or multipliers; an asset may override it. */
1540
1540
  proportions: CharacterProportionsSchema.optional(),
1541
1541
  /**
1542
- * `character` only. How closely a `standard` base and a template loop
1543
- * follow their text, 1 to 20; PixelLab's default is 8. The v3 and pro
1544
- * engines do not take it.
1542
+ * `character` and `pixflux`. How closely a `standard` character base
1543
+ * and a template loop, or a `pixflux` image, follow their text, 1 to 20;
1544
+ * PixelLab's default is 8. The v3 and pro character engines do not take
1545
+ * it. Part of a `pixflux` asset's identity only when set.
1545
1546
  */
1546
1547
  textGuidanceScale: import_zod.z.number().min(1).max(20).optional(),
1547
- /** `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
+ */
1548
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(),
1549
1560
  /** `character` only, `v3` bases: let PixelLab expand the prompt into a fuller one before drawing. */
1550
1561
  enhancePrompt: import_zod.z.boolean().optional(),
1551
1562
  /**
@@ -1619,6 +1630,20 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
1619
1630
  message: "tileFeature and styleImages cannot be combined; a connectable set derives its own tile geometry, so remove one or the other",
1620
1631
  path: ["tileFeature"]
1621
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
+ }
1622
1647
  if (style.quality && (style.generator === "tiles" || style.generator === "terrain" || style.generator === "animation" || style.generator === "vfx")) {
1623
1648
  ctx.addIssue({
1624
1649
  code: import_zod.z.ZodIssueCode.custom,
@@ -1852,6 +1877,12 @@ var AssetSchema = import_zod.z.object({
1852
1877
  * instead of starting from nothing.
1853
1878
  */
1854
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(),
1855
1886
  /**
1856
1887
  * With `initImage`: how strongly the starting image holds, 1 to 999.
1857
1888
  * PixelLab's default is 300.
@@ -3403,6 +3434,12 @@ var PixelLabClient = class {
3403
3434
  if (args.shading) body.shading = args.shading;
3404
3435
  if (args.detail) body.detail = args.detail;
3405
3436
  if (args.view) body.view = args.view;
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
+ }
3406
3443
  if (args.seed != null) body.seed = args.seed;
3407
3444
  const res = validateResponse(
3408
3445
  PixfluxResponseSchema,
@@ -5334,6 +5371,11 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
5334
5371
  terrainSideWallThickness: spec.terrainSideWallThickness,
5335
5372
  terrainSideWallPlacement: spec.terrainSideWallPlacement,
5336
5373
  terrainEnhance: spec.terrainEnhance,
5374
+ // Absent unless a pixflux style sets it, so every older hash stands.
5375
+ textGuidanceScale: spec.textGuidanceScale,
5376
+ subjectDirection: spec.subjectDirection,
5377
+ isometric: spec.isometric,
5378
+ backgroundRemoval: spec.backgroundRemoval,
5337
5379
  terrainPlatformThickness: spec.terrainPlatformThickness,
5338
5380
  // Reference images enter as their bytes' hashes, never their paths.
5339
5381
  // The starting image by its bytes, with its strength only when set.
@@ -7873,6 +7915,10 @@ var PixelLabProvider = class _PixelLabProvider {
7873
7915
  detail: spec.detail,
7874
7916
  // Only a view the style states: the resolved default would steer every scene and banner top-down.
7875
7917
  view: spec.styleView,
7918
+ textGuidanceScale: spec.textGuidanceScale,
7919
+ direction: spec.subjectDirection,
7920
+ isometric: spec.isometric,
7921
+ backgroundRemoval: spec.backgroundRemoval,
7876
7922
  seed: spec.seed,
7877
7923
  ...await initImageArgs(spec)
7878
7924
  });
@@ -12427,6 +12473,9 @@ async function resolveSpecs(loaded, filter) {
12427
12473
  size,
12428
12474
  view: style.view ?? (generator === "1dir" ? "top-down" : generator === "character" ? "low top-down" : "high top-down"),
12429
12475
  ...style.view !== void 0 ? { styleView: style.view } : {},
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 } : {},
12430
12479
  styleImagePaths: style.styleImages.map((s) => s.path),
12431
12480
  outline: style.outline,
12432
12481
  shading: style.shading,
@@ -12929,6 +12978,12 @@ async function resolveSpecs(loaded, filter) {
12929
12978
  }
12930
12979
  resolved.terrainConnect = links;
12931
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
+ }
12932
12987
  if (asset.initImage) {
12933
12988
  if (!["pixflux", "map", "isometricTile"].includes(resolved.generator)) {
12934
12989
  throw new Error(