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/cli.js +47 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +47 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +47 -5
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +6 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9398,7 +9398,11 @@ var ManifestEditSchema = import_zod7.z.discriminatedUnion("action", [
|
|
|
9398
9398
|
promptPrefix: import_zod7.z.string().optional(),
|
|
9399
9399
|
promptSuffix: import_zod7.z.string().optional(),
|
|
9400
9400
|
/** `#rrggbb` values; null or empty clears the style's own palette. */
|
|
9401
|
-
palette: import_zod7.z.array(import_zod7.z.string().regex(/^#?[0-9a-f]{6}$/i, "expected a six-digit hex colour")).max(256).nullable().optional()
|
|
9401
|
+
palette: import_zod7.z.array(import_zod7.z.string().regex(/^#?[0-9a-f]{6}$/i, "expected a six-digit hex colour")).max(256).nullable().optional(),
|
|
9402
|
+
/** Provider view name (PixelLab: low top-down, high top-down, side); empty clears. */
|
|
9403
|
+
view: import_zod7.z.string().max(64).nullable().optional(),
|
|
9404
|
+
/** pixflux only; null clears the style's own value. */
|
|
9405
|
+
noBackground: import_zod7.z.boolean().nullable().optional()
|
|
9402
9406
|
}).strict().refine((patch) => Object.keys(patch).length > 0, { message: "nothing to change" })
|
|
9403
9407
|
}).strict()
|
|
9404
9408
|
]);
|
|
@@ -9456,6 +9460,8 @@ function applyEdit(raw, edit) {
|
|
|
9456
9460
|
const colors = (patch2.palette ?? []).map((color) => "#" + color.replace(/^#/, "").toLowerCase());
|
|
9457
9461
|
setOrDelete(style, "palette", colors.length ? colors : null);
|
|
9458
9462
|
}
|
|
9463
|
+
if (patch2.view !== void 0) setOrDelete(style, "view", patch2.view?.trim() || null);
|
|
9464
|
+
if (patch2.noBackground !== void 0) setOrDelete(style, "noBackground", patch2.noBackground);
|
|
9459
9465
|
return;
|
|
9460
9466
|
}
|
|
9461
9467
|
if (edit.action === "add-asset") {
|
|
@@ -9835,6 +9841,8 @@ async function buildGallerySnapshot(opts) {
|
|
|
9835
9841
|
promptPrefix: style?.promptPrefix ?? "",
|
|
9836
9842
|
promptSuffix: style?.promptSuffix ?? "",
|
|
9837
9843
|
palette: style?.palette ?? [],
|
|
9844
|
+
view: style?.view ?? null,
|
|
9845
|
+
noBackground: style?.noBackground ?? true,
|
|
9838
9846
|
quality: Boolean(style?.quality),
|
|
9839
9847
|
tags: style?.tags ?? [],
|
|
9840
9848
|
extends: typeof rawStyle?.extends === "string" ? rawStyle.extends : null,
|
|
@@ -10309,6 +10317,7 @@ function renderGallery(snapshot, opts = {}) {
|
|
|
10309
10317
|
</footer>
|
|
10310
10318
|
<div id="drawer-host"></div>
|
|
10311
10319
|
<div id="dialog-host"></div>
|
|
10320
|
+
<datalist id="view-options"><option value="low top-down"><option value="high top-down"><option value="side"><option value="sidescroller"></datalist>
|
|
10312
10321
|
<script>
|
|
10313
10322
|
const INITIAL = ${data};
|
|
10314
10323
|
const SESSION = ${session};
|
|
@@ -11100,9 +11109,18 @@ function inheritorsOf(style, field) {
|
|
|
11100
11109
|
}
|
|
11101
11110
|
return out;
|
|
11102
11111
|
}
|
|
11112
|
+
// noBackground reaches the request only for pixflux and non-PixelLab
|
|
11113
|
+
// providers; elsewhere a change is recorded but alters nothing.
|
|
11114
|
+
const fieldReaches = (field, style) =>
|
|
11115
|
+
field !== 'noBackground' || style.generator === 'pixflux' || style.provider !== 'pixellab';
|
|
11103
11116
|
function blastRadius(style, fields) {
|
|
11104
|
-
const
|
|
11105
|
-
|
|
11117
|
+
const byId = new Map(snap.styles.filter((x) => x.project === style.project).map((x) => [x.id, x]));
|
|
11118
|
+
const styleIds = new Set();
|
|
11119
|
+
for (const field of fields) {
|
|
11120
|
+
for (const id of [style.id, ...inheritorsOf(style, field)]) {
|
|
11121
|
+
if (fieldReaches(field, byId.get(id) || style)) styleIds.add(id);
|
|
11122
|
+
}
|
|
11123
|
+
}
|
|
11106
11124
|
const affected = snap.items.filter((i) => i.project === style.project && i.declared && styleIds.has(i.styleId));
|
|
11107
11125
|
const units = new Map();
|
|
11108
11126
|
for (const i of affected) if (i.estimatedCost !== null) units.set(i.costUnit, (units.get(i.costUnit) || 0) + i.estimatedCost);
|
|
@@ -11127,6 +11145,11 @@ function styleForm(style) {
|
|
|
11127
11145
|
const prefix = el('input'); prefix.type = 'text'; prefix.value = style.promptPrefix; prefix.placeholder = 'none';
|
|
11128
11146
|
const suffix = el('input'); suffix.type = 'text'; suffix.value = style.promptSuffix; suffix.placeholder = 'none';
|
|
11129
11147
|
const palette = el('input'); palette.type = 'text'; palette.value = style.palette.join(', '); palette.placeholder = '#rrggbb, #rrggbb \u2014 leave empty for no forced palette';
|
|
11148
|
+
const view = el('input'); view.type = 'text'; view.value = style.view || ''; view.placeholder = 'provider default';
|
|
11149
|
+
view.setAttribute('list', 'view-options');
|
|
11150
|
+
const noBg = el('select');
|
|
11151
|
+
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'));
|
|
11152
|
+
noBg.value = own('noBackground') ? (style.noBackground ? 'on' : 'off') : 'default';
|
|
11130
11153
|
const swatches = el('div', 'pal');
|
|
11131
11154
|
const drawSwatches = () => {
|
|
11132
11155
|
swatches.textContent = '';
|
|
@@ -11139,12 +11162,21 @@ function styleForm(style) {
|
|
|
11139
11162
|
field('palette', palette, 'Forced colours where the provider supports them (pixflux). ' + provenance('palette')),
|
|
11140
11163
|
swatches,
|
|
11141
11164
|
);
|
|
11165
|
+
const row = el('div', 'row');
|
|
11166
|
+
row.append(
|
|
11167
|
+
field('view', view, 'PixelLab accepts low top-down, high top-down, side; Retro Diffusion reads sidescroller. ' + provenance('view')),
|
|
11168
|
+
field('background', noBg, (fieldReaches('noBackground', style) ? 'Sent for this style. ' : 'Not sent for ' + style.provider + ' ' + style.generator + '; recorded only. ') + provenance('noBackground')),
|
|
11169
|
+
);
|
|
11170
|
+
form.append(row);
|
|
11142
11171
|
const blast = el('div', 'blast');
|
|
11143
11172
|
const changed = () => {
|
|
11144
11173
|
const out = [];
|
|
11145
11174
|
if (prefix.value !== style.promptPrefix) out.push('promptPrefix');
|
|
11146
11175
|
if (suffix.value !== style.promptSuffix) out.push('promptSuffix');
|
|
11147
11176
|
if (parsePalette(palette.value).join(',') !== style.palette.map((c) => c.toLowerCase()).join(',')) out.push('palette');
|
|
11177
|
+
if (view.value.trim() !== (style.view || '')) out.push('view');
|
|
11178
|
+
const bgNow = own('noBackground') ? (style.noBackground ? 'on' : 'off') : 'default';
|
|
11179
|
+
if (noBg.value !== bgNow) out.push('noBackground');
|
|
11148
11180
|
return out;
|
|
11149
11181
|
};
|
|
11150
11182
|
const updateBlast = () => {
|
|
@@ -11152,6 +11184,11 @@ function styleForm(style) {
|
|
|
11152
11184
|
drawSwatches();
|
|
11153
11185
|
if (!fields.length) { blast.className = 'blast'; blast.textContent = 'No changes yet. A style change alters the request for every asset that uses it.'; return; }
|
|
11154
11186
|
const r = blastRadius(style, fields);
|
|
11187
|
+
if (!r.assets) {
|
|
11188
|
+
blast.className = 'blast';
|
|
11189
|
+
blast.textContent = 'Recorded in the manifest only: nothing in ' + style.id + ' sends this field, so no request changes.';
|
|
11190
|
+
return;
|
|
11191
|
+
}
|
|
11155
11192
|
blast.className = 'blast hot';
|
|
11156
11193
|
blast.textContent = '';
|
|
11157
11194
|
const others = r.styles.filter((id) => id !== style.id);
|
|
@@ -11161,7 +11198,8 @@ function styleForm(style) {
|
|
|
11161
11198
|
: ' in ' + style.id + '.'));
|
|
11162
11199
|
blast.append(document.createTextNode(' Generated ones become stale; regenerating all of them is about ' + (r.cost || 'nothing') + '. Nothing is spent until you generate.'));
|
|
11163
11200
|
};
|
|
11164
|
-
for (const input of [prefix, suffix, palette]) input.addEventListener('input', updateBlast);
|
|
11201
|
+
for (const input of [prefix, suffix, palette, view]) input.addEventListener('input', updateBlast);
|
|
11202
|
+
noBg.addEventListener('change', updateBlast);
|
|
11165
11203
|
updateBlast();
|
|
11166
11204
|
form.append(blast);
|
|
11167
11205
|
const actions = el('div', 'actions');
|
|
@@ -11180,6 +11218,8 @@ function styleForm(style) {
|
|
|
11180
11218
|
if (fields.includes('promptPrefix')) patch.promptPrefix = prefix.value;
|
|
11181
11219
|
if (fields.includes('promptSuffix')) patch.promptSuffix = suffix.value;
|
|
11182
11220
|
if (fields.includes('palette')) patch.palette = colors;
|
|
11221
|
+
if (fields.includes('view')) patch.view = view.value.trim();
|
|
11222
|
+
if (fields.includes('noBackground')) patch.noBackground = noBg.value === 'default' ? null : noBg.value === 'on';
|
|
11183
11223
|
save.disabled = true; msg.className = 'msg'; msg.textContent = 'saving\u2026';
|
|
11184
11224
|
const r = blastRadius(style, fields);
|
|
11185
11225
|
try {
|
|
@@ -11188,7 +11228,9 @@ function styleForm(style) {
|
|
|
11188
11228
|
snap = await postEdit(body);
|
|
11189
11229
|
ui.editing = null;
|
|
11190
11230
|
ui.notice = { id: 'style:' + (style.project || '') + ':' + style.id,
|
|
11191
|
-
text:
|
|
11231
|
+
text: r.assets
|
|
11232
|
+
? '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.'
|
|
11233
|
+
: 'Saved. Recorded in the manifest; no request changed.' };
|
|
11192
11234
|
render();
|
|
11193
11235
|
} catch (err) {
|
|
11194
11236
|
save.disabled = false;
|