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.js CHANGED
@@ -1080,13 +1080,24 @@ var StyleObjectSchema = z.object({
1080
1080
  /** `character` only, `standard` humanoid bases. A preset or multipliers; an asset may override it. */
1081
1081
  proportions: CharacterProportionsSchema.optional(),
1082
1082
  /**
1083
- * `character` only. How closely a `standard` base and a template loop
1084
- * follow their text, 1 to 20; PixelLab's default is 8. The v3 and pro
1085
- * engines do not take it.
1083
+ * `character` and `pixflux`. How closely a `standard` character base
1084
+ * and a template loop, or a `pixflux` image, follow their text, 1 to 20;
1085
+ * PixelLab's default is 8. The v3 and pro character engines do not take
1086
+ * it. Part of a `pixflux` asset's identity only when set.
1086
1087
  */
1087
1088
  textGuidanceScale: z.number().min(1).max(20).optional(),
1088
- /** `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
+ */
1089
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(),
1090
1101
  /** `character` only, `v3` bases: let PixelLab expand the prompt into a fuller one before drawing. */
1091
1102
  enhancePrompt: z.boolean().optional(),
1092
1103
  /**
@@ -1160,6 +1171,20 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
1160
1171
  message: "tileFeature and styleImages cannot be combined; a connectable set derives its own tile geometry, so remove one or the other",
1161
1172
  path: ["tileFeature"]
1162
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
+ }
1163
1188
  if (style.quality && (style.generator === "tiles" || style.generator === "terrain" || style.generator === "animation" || style.generator === "vfx")) {
1164
1189
  ctx.addIssue({
1165
1190
  code: z.ZodIssueCode.custom,
@@ -1393,6 +1418,12 @@ var AssetSchema = z.object({
1393
1418
  * instead of starting from nothing.
1394
1419
  */
1395
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(),
1396
1427
  /**
1397
1428
  * With `initImage`: how strongly the starting image holds, 1 to 999.
1398
1429
  * PixelLab's default is 300.
@@ -2944,6 +2975,12 @@ var PixelLabClient = class {
2944
2975
  if (args.shading) body.shading = args.shading;
2945
2976
  if (args.detail) body.detail = args.detail;
2946
2977
  if (args.view) body.view = args.view;
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
+ }
2947
2984
  if (args.seed != null) body.seed = args.seed;
2948
2985
  const res = validateResponse(
2949
2986
  PixfluxResponseSchema,
@@ -4875,6 +4912,11 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
4875
4912
  terrainSideWallThickness: spec.terrainSideWallThickness,
4876
4913
  terrainSideWallPlacement: spec.terrainSideWallPlacement,
4877
4914
  terrainEnhance: spec.terrainEnhance,
4915
+ // Absent unless a pixflux style sets it, so every older hash stands.
4916
+ textGuidanceScale: spec.textGuidanceScale,
4917
+ subjectDirection: spec.subjectDirection,
4918
+ isometric: spec.isometric,
4919
+ backgroundRemoval: spec.backgroundRemoval,
4878
4920
  terrainPlatformThickness: spec.terrainPlatformThickness,
4879
4921
  // Reference images enter as their bytes' hashes, never their paths.
4880
4922
  // The starting image by its bytes, with its strength only when set.
@@ -7414,6 +7456,10 @@ var PixelLabProvider = class _PixelLabProvider {
7414
7456
  detail: spec.detail,
7415
7457
  // Only a view the style states: the resolved default would steer every scene and banner top-down.
7416
7458
  view: spec.styleView,
7459
+ textGuidanceScale: spec.textGuidanceScale,
7460
+ direction: spec.subjectDirection,
7461
+ isometric: spec.isometric,
7462
+ backgroundRemoval: spec.backgroundRemoval,
7417
7463
  seed: spec.seed,
7418
7464
  ...await initImageArgs(spec)
7419
7465
  });
@@ -11968,6 +12014,9 @@ async function resolveSpecs(loaded, filter) {
11968
12014
  size,
11969
12015
  view: style.view ?? (generator === "1dir" ? "top-down" : generator === "character" ? "low top-down" : "high top-down"),
11970
12016
  ...style.view !== void 0 ? { styleView: style.view } : {},
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 } : {},
11971
12020
  styleImagePaths: style.styleImages.map((s) => s.path),
11972
12021
  outline: style.outline,
11973
12022
  shading: style.shading,
@@ -12470,6 +12519,12 @@ async function resolveSpecs(loaded, filter) {
12470
12519
  }
12471
12520
  resolved.terrainConnect = links;
12472
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
+ }
12473
12528
  if (asset.initImage) {
12474
12529
  if (!["pixflux", "map", "isometricTile"].includes(resolved.generator)) {
12475
12530
  throw new Error(