pixelkiln 0.22.0 → 0.23.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.d.cts CHANGED
@@ -7616,6 +7616,10 @@ interface GalleryStyle {
7616
7616
  promptPrefix: string;
7617
7617
  promptSuffix: string;
7618
7618
  palette: string[];
7619
+ /** Provider view name, when the style sets one. */
7620
+ view: string | null;
7621
+ /** Strip the generated background (sent for pixflux and non-PixelLab providers). */
7622
+ noBackground: boolean;
7619
7623
  quality: boolean;
7620
7624
  tags: string[];
7621
7625
  /** Parent style id when this style `extends` one. */
@@ -7912,34 +7916,48 @@ declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject
7912
7916
  promptSuffix: z.ZodOptional<z.ZodString>;
7913
7917
  /** `#rrggbb` values; null or empty clears the style's own palette. */
7914
7918
  palette: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
7919
+ /** Provider view name (PixelLab: low top-down, high top-down, side); empty clears. */
7920
+ view: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7921
+ /** pixflux only; null clears the style's own value. */
7922
+ noBackground: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
7915
7923
  }, "strict", z.ZodTypeAny, {
7916
7924
  candidates?: number | undefined;
7917
7925
  palette?: string[] | null | undefined;
7926
+ view?: string | null | undefined;
7918
7927
  promptSuffix?: string | undefined;
7919
7928
  promptPrefix?: string | undefined;
7929
+ noBackground?: boolean | null | undefined;
7920
7930
  }, {
7921
7931
  candidates?: number | undefined;
7922
7932
  palette?: string[] | null | undefined;
7933
+ view?: string | null | undefined;
7923
7934
  promptSuffix?: string | undefined;
7924
7935
  promptPrefix?: string | undefined;
7936
+ noBackground?: boolean | null | undefined;
7925
7937
  }>, {
7926
7938
  candidates?: number | undefined;
7927
7939
  palette?: string[] | null | undefined;
7940
+ view?: string | null | undefined;
7928
7941
  promptSuffix?: string | undefined;
7929
7942
  promptPrefix?: string | undefined;
7943
+ noBackground?: boolean | null | undefined;
7930
7944
  }, {
7931
7945
  candidates?: number | undefined;
7932
7946
  palette?: string[] | null | undefined;
7947
+ view?: string | null | undefined;
7933
7948
  promptSuffix?: string | undefined;
7934
7949
  promptPrefix?: string | undefined;
7950
+ noBackground?: boolean | null | undefined;
7935
7951
  }>;
7936
7952
  }, "strict", z.ZodTypeAny, {
7937
7953
  styleId: string;
7938
7954
  patch: {
7939
7955
  candidates?: number | undefined;
7940
7956
  palette?: string[] | null | undefined;
7957
+ view?: string | null | undefined;
7941
7958
  promptSuffix?: string | undefined;
7942
7959
  promptPrefix?: string | undefined;
7960
+ noBackground?: boolean | null | undefined;
7943
7961
  };
7944
7962
  expectedSha256: string;
7945
7963
  action: "patch-style";
@@ -7949,8 +7967,10 @@ declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject
7949
7967
  patch: {
7950
7968
  candidates?: number | undefined;
7951
7969
  palette?: string[] | null | undefined;
7970
+ view?: string | null | undefined;
7952
7971
  promptSuffix?: string | undefined;
7953
7972
  promptPrefix?: string | undefined;
7973
+ noBackground?: boolean | null | undefined;
7954
7974
  };
7955
7975
  expectedSha256: string;
7956
7976
  action: "patch-style";
package/dist/index.d.ts CHANGED
@@ -7616,6 +7616,10 @@ interface GalleryStyle {
7616
7616
  promptPrefix: string;
7617
7617
  promptSuffix: string;
7618
7618
  palette: string[];
7619
+ /** Provider view name, when the style sets one. */
7620
+ view: string | null;
7621
+ /** Strip the generated background (sent for pixflux and non-PixelLab providers). */
7622
+ noBackground: boolean;
7619
7623
  quality: boolean;
7620
7624
  tags: string[];
7621
7625
  /** Parent style id when this style `extends` one. */
@@ -7912,34 +7916,48 @@ declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject
7912
7916
  promptSuffix: z.ZodOptional<z.ZodString>;
7913
7917
  /** `#rrggbb` values; null or empty clears the style's own palette. */
7914
7918
  palette: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
7919
+ /** Provider view name (PixelLab: low top-down, high top-down, side); empty clears. */
7920
+ view: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7921
+ /** pixflux only; null clears the style's own value. */
7922
+ noBackground: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
7915
7923
  }, "strict", z.ZodTypeAny, {
7916
7924
  candidates?: number | undefined;
7917
7925
  palette?: string[] | null | undefined;
7926
+ view?: string | null | undefined;
7918
7927
  promptSuffix?: string | undefined;
7919
7928
  promptPrefix?: string | undefined;
7929
+ noBackground?: boolean | null | undefined;
7920
7930
  }, {
7921
7931
  candidates?: number | undefined;
7922
7932
  palette?: string[] | null | undefined;
7933
+ view?: string | null | undefined;
7923
7934
  promptSuffix?: string | undefined;
7924
7935
  promptPrefix?: string | undefined;
7936
+ noBackground?: boolean | null | undefined;
7925
7937
  }>, {
7926
7938
  candidates?: number | undefined;
7927
7939
  palette?: string[] | null | undefined;
7940
+ view?: string | null | undefined;
7928
7941
  promptSuffix?: string | undefined;
7929
7942
  promptPrefix?: string | undefined;
7943
+ noBackground?: boolean | null | undefined;
7930
7944
  }, {
7931
7945
  candidates?: number | undefined;
7932
7946
  palette?: string[] | null | undefined;
7947
+ view?: string | null | undefined;
7933
7948
  promptSuffix?: string | undefined;
7934
7949
  promptPrefix?: string | undefined;
7950
+ noBackground?: boolean | null | undefined;
7935
7951
  }>;
7936
7952
  }, "strict", z.ZodTypeAny, {
7937
7953
  styleId: string;
7938
7954
  patch: {
7939
7955
  candidates?: number | undefined;
7940
7956
  palette?: string[] | null | undefined;
7957
+ view?: string | null | undefined;
7941
7958
  promptSuffix?: string | undefined;
7942
7959
  promptPrefix?: string | undefined;
7960
+ noBackground?: boolean | null | undefined;
7943
7961
  };
7944
7962
  expectedSha256: string;
7945
7963
  action: "patch-style";
@@ -7949,8 +7967,10 @@ declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject
7949
7967
  patch: {
7950
7968
  candidates?: number | undefined;
7951
7969
  palette?: string[] | null | undefined;
7970
+ view?: string | null | undefined;
7952
7971
  promptSuffix?: string | undefined;
7953
7972
  promptPrefix?: string | undefined;
7973
+ noBackground?: boolean | null | undefined;
7954
7974
  };
7955
7975
  expectedSha256: string;
7956
7976
  action: "patch-style";
package/dist/index.js CHANGED
@@ -9173,7 +9173,11 @@ var ManifestEditSchema = z7.discriminatedUnion("action", [
9173
9173
  promptPrefix: z7.string().optional(),
9174
9174
  promptSuffix: z7.string().optional(),
9175
9175
  /** `#rrggbb` values; null or empty clears the style's own palette. */
9176
- palette: z7.array(z7.string().regex(/^#?[0-9a-f]{6}$/i, "expected a six-digit hex colour")).max(256).nullable().optional()
9176
+ palette: z7.array(z7.string().regex(/^#?[0-9a-f]{6}$/i, "expected a six-digit hex colour")).max(256).nullable().optional(),
9177
+ /** Provider view name (PixelLab: low top-down, high top-down, side); empty clears. */
9178
+ view: z7.string().max(64).nullable().optional(),
9179
+ /** pixflux only; null clears the style's own value. */
9180
+ noBackground: z7.boolean().nullable().optional()
9177
9181
  }).strict().refine((patch) => Object.keys(patch).length > 0, { message: "nothing to change" })
9178
9182
  }).strict()
9179
9183
  ]);
@@ -9231,6 +9235,8 @@ function applyEdit(raw, edit) {
9231
9235
  const colors = (patch2.palette ?? []).map((color) => "#" + color.replace(/^#/, "").toLowerCase());
9232
9236
  setOrDelete(style, "palette", colors.length ? colors : null);
9233
9237
  }
9238
+ if (patch2.view !== void 0) setOrDelete(style, "view", patch2.view?.trim() || null);
9239
+ if (patch2.noBackground !== void 0) setOrDelete(style, "noBackground", patch2.noBackground);
9234
9240
  return;
9235
9241
  }
9236
9242
  if (edit.action === "add-asset") {
@@ -9610,6 +9616,8 @@ async function buildGallerySnapshot(opts) {
9610
9616
  promptPrefix: style?.promptPrefix ?? "",
9611
9617
  promptSuffix: style?.promptSuffix ?? "",
9612
9618
  palette: style?.palette ?? [],
9619
+ view: style?.view ?? null,
9620
+ noBackground: style?.noBackground ?? true,
9613
9621
  quality: Boolean(style?.quality),
9614
9622
  tags: style?.tags ?? [],
9615
9623
  extends: typeof rawStyle?.extends === "string" ? rawStyle.extends : null,
@@ -10084,6 +10092,7 @@ function renderGallery(snapshot, opts = {}) {
10084
10092
  </footer>
10085
10093
  <div id="drawer-host"></div>
10086
10094
  <div id="dialog-host"></div>
10095
+ <datalist id="view-options"><option value="low top-down"><option value="high top-down"><option value="side"><option value="sidescroller"></datalist>
10087
10096
  <script>
10088
10097
  const INITIAL = ${data};
10089
10098
  const SESSION = ${session};
@@ -10875,9 +10884,18 @@ function inheritorsOf(style, field) {
10875
10884
  }
10876
10885
  return out;
10877
10886
  }
10887
+ // noBackground reaches the request only for pixflux and non-PixelLab
10888
+ // providers; elsewhere a change is recorded but alters nothing.
10889
+ const fieldReaches = (field, style) =>
10890
+ field !== 'noBackground' || style.generator === 'pixflux' || style.provider !== 'pixellab';
10878
10891
  function blastRadius(style, fields) {
10879
- const styleIds = new Set([style.id]);
10880
- for (const field of fields) for (const id of inheritorsOf(style, field)) styleIds.add(id);
10892
+ const byId = new Map(snap.styles.filter((x) => x.project === style.project).map((x) => [x.id, x]));
10893
+ const styleIds = new Set();
10894
+ for (const field of fields) {
10895
+ for (const id of [style.id, ...inheritorsOf(style, field)]) {
10896
+ if (fieldReaches(field, byId.get(id) || style)) styleIds.add(id);
10897
+ }
10898
+ }
10881
10899
  const affected = snap.items.filter((i) => i.project === style.project && i.declared && styleIds.has(i.styleId));
10882
10900
  const units = new Map();
10883
10901
  for (const i of affected) if (i.estimatedCost !== null) units.set(i.costUnit, (units.get(i.costUnit) || 0) + i.estimatedCost);
@@ -10902,6 +10920,11 @@ function styleForm(style) {
10902
10920
  const prefix = el('input'); prefix.type = 'text'; prefix.value = style.promptPrefix; prefix.placeholder = 'none';
10903
10921
  const suffix = el('input'); suffix.type = 'text'; suffix.value = style.promptSuffix; suffix.placeholder = 'none';
10904
10922
  const palette = el('input'); palette.type = 'text'; palette.value = style.palette.join(', '); palette.placeholder = '#rrggbb, #rrggbb \u2014 leave empty for no forced palette';
10923
+ const view = el('input'); view.type = 'text'; view.value = style.view || ''; view.placeholder = 'provider default';
10924
+ view.setAttribute('list', 'view-options');
10925
+ const noBg = el('select');
10926
+ noBg.append(new Option(style.extends ? 'inherit from ' + style.extends : 'default (on)', 'default'), new Option('on \u2014 strip the generated background', 'on'), new Option('off \u2014 keep the background (scenes, banners)', 'off'));
10927
+ noBg.value = own('noBackground') ? (style.noBackground ? 'on' : 'off') : 'default';
10905
10928
  const swatches = el('div', 'pal');
10906
10929
  const drawSwatches = () => {
10907
10930
  swatches.textContent = '';
@@ -10914,12 +10937,21 @@ function styleForm(style) {
10914
10937
  field('palette', palette, 'Forced colours where the provider supports them (pixflux). ' + provenance('palette')),
10915
10938
  swatches,
10916
10939
  );
10940
+ const row = el('div', 'row');
10941
+ row.append(
10942
+ field('view', view, 'PixelLab accepts low top-down, high top-down, side; Retro Diffusion reads sidescroller. ' + provenance('view')),
10943
+ field('background', noBg, (fieldReaches('noBackground', style) ? 'Sent for this style. ' : 'Not sent for ' + style.provider + ' ' + style.generator + '; recorded only. ') + provenance('noBackground')),
10944
+ );
10945
+ form.append(row);
10917
10946
  const blast = el('div', 'blast');
10918
10947
  const changed = () => {
10919
10948
  const out = [];
10920
10949
  if (prefix.value !== style.promptPrefix) out.push('promptPrefix');
10921
10950
  if (suffix.value !== style.promptSuffix) out.push('promptSuffix');
10922
10951
  if (parsePalette(palette.value).join(',') !== style.palette.map((c) => c.toLowerCase()).join(',')) out.push('palette');
10952
+ if (view.value.trim() !== (style.view || '')) out.push('view');
10953
+ const bgNow = own('noBackground') ? (style.noBackground ? 'on' : 'off') : 'default';
10954
+ if (noBg.value !== bgNow) out.push('noBackground');
10923
10955
  return out;
10924
10956
  };
10925
10957
  const updateBlast = () => {
@@ -10927,6 +10959,11 @@ function styleForm(style) {
10927
10959
  drawSwatches();
10928
10960
  if (!fields.length) { blast.className = 'blast'; blast.textContent = 'No changes yet. A style change alters the request for every asset that uses it.'; return; }
10929
10961
  const r = blastRadius(style, fields);
10962
+ if (!r.assets) {
10963
+ blast.className = 'blast';
10964
+ blast.textContent = 'Recorded in the manifest only: nothing in ' + style.id + ' sends this field, so no request changes.';
10965
+ return;
10966
+ }
10930
10967
  blast.className = 'blast hot';
10931
10968
  blast.textContent = '';
10932
10969
  const others = r.styles.filter((id) => id !== style.id);
@@ -10936,7 +10973,8 @@ function styleForm(style) {
10936
10973
  : ' in ' + style.id + '.'));
10937
10974
  blast.append(document.createTextNode(' Generated ones become stale; regenerating all of them is about ' + (r.cost || 'nothing') + '. Nothing is spent until you generate.'));
10938
10975
  };
10939
- for (const input of [prefix, suffix, palette]) input.addEventListener('input', updateBlast);
10976
+ for (const input of [prefix, suffix, palette, view]) input.addEventListener('input', updateBlast);
10977
+ noBg.addEventListener('change', updateBlast);
10940
10978
  updateBlast();
10941
10979
  form.append(blast);
10942
10980
  const actions = el('div', 'actions');
@@ -10955,6 +10993,8 @@ function styleForm(style) {
10955
10993
  if (fields.includes('promptPrefix')) patch.promptPrefix = prefix.value;
10956
10994
  if (fields.includes('promptSuffix')) patch.promptSuffix = suffix.value;
10957
10995
  if (fields.includes('palette')) patch.palette = colors;
10996
+ if (fields.includes('view')) patch.view = view.value.trim();
10997
+ if (fields.includes('noBackground')) patch.noBackground = noBg.value === 'default' ? null : noBg.value === 'on';
10958
10998
  save.disabled = true; msg.className = 'msg'; msg.textContent = 'saving\u2026';
10959
10999
  const r = blastRadius(style, fields);
10960
11000
  try {
@@ -10963,7 +11003,9 @@ function styleForm(style) {
10963
11003
  snap = await postEdit(body);
10964
11004
  ui.editing = null;
10965
11005
  ui.notice = { id: 'style:' + (style.project || '') + ':' + style.id,
10966
- text: 'Saved. The request for ' + r.assets + (r.assets === 1 ? ' asset' : ' assets') + ' changed' + (r.cost ? ' \u2014 about ' + r.cost + ' to regenerate.' : '.') + ' Nothing is spent until you generate.' };
11006
+ text: r.assets
11007
+ ? 'Saved. The request for ' + r.assets + (r.assets === 1 ? ' asset' : ' assets') + ' changed' + (r.cost ? ' \u2014 about ' + r.cost + ' to regenerate.' : '.') + ' Nothing is spent until you generate.'
11008
+ : 'Saved. Recorded in the manifest; no request changed.' };
10967
11009
  render();
10968
11010
  } catch (err) {
10969
11011
  save.disabled = false;