nanoodle 0.2.0 → 0.5.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/README.md +68 -9
- package/bin/nanoodle.mjs +33 -5
- package/package.json +5 -1
- package/src/browser.mjs +38 -0
- package/src/catalog.mjs +22 -0
- package/src/client.mjs +116 -17
- package/src/graph.mjs +25 -9
- package/src/index.mjs +7 -2
- package/src/io.mjs +42 -2
- package/src/local-media.mjs +998 -0
- package/src/media.mjs +68 -16
- package/src/mp4cat.mjs +284 -0
- package/src/nodes.mjs +262 -37
- package/src/qr.mjs +385 -0
- package/src/share.mjs +20 -14
- package/src/workflow.mjs +102 -18
- package/src/x402.mjs +77 -0
- package/src/zlib.mjs +44 -0
package/src/io.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NanoodleError } from "./errors.mjs";
|
|
2
|
-
import { NODE_TYPES, displayName, topoSort } from "./graph.mjs";
|
|
2
|
+
import { NODE_TYPES, displayName, topoSort, wiredFramesFloor, MAX_FRAMES } from "./graph.mjs";
|
|
3
3
|
|
|
4
4
|
/* ============================== INPUTS ============================== */
|
|
5
5
|
|
|
@@ -152,7 +152,16 @@ export function deriveOutputs(graph) {
|
|
|
152
152
|
const count = (used.get(lower) || 0) + 1;
|
|
153
153
|
used.set(lower, count);
|
|
154
154
|
if (count > 1) key = key + " " + count;
|
|
155
|
-
|
|
155
|
+
const t = NODE_TYPES[n.type];
|
|
156
|
+
let ports = t.outputs.map((p) => ({ ...p }));
|
|
157
|
+
// vframes grows frame1..frameN from max(fields.frames, wired floor) (mirrors browser)
|
|
158
|
+
if (n.type === "vframes") {
|
|
159
|
+
const authored = Math.max(1, Math.min(MAX_FRAMES, parseInt(n.fields && n.fields.frames, 10) || 1));
|
|
160
|
+
const count = Math.max(authored, wiredFramesFloor(graph, n.id));
|
|
161
|
+
ports = [];
|
|
162
|
+
for (let i = 1; i <= count; i++) ports.push({ name: "frame" + i, type: "image" });
|
|
163
|
+
}
|
|
164
|
+
return { key, nodeId: n.id, type: n.type, ports };
|
|
156
165
|
});
|
|
157
166
|
}
|
|
158
167
|
|
|
@@ -244,6 +253,31 @@ export const SETTING_SPECS = {
|
|
|
244
253
|
{ f: "size", label: "Image size", kind: "select", options: SIZES, def: "1024x1024" },
|
|
245
254
|
{ f: "seed", label: "Seed", kind: "number" },
|
|
246
255
|
],
|
|
256
|
+
// local media knobs (play.html SETTING_SPECS) — shape-affecting fields for vframes/combine
|
|
257
|
+
resize: [
|
|
258
|
+
{ f: "mode", label: "Mode", kind: "select", options: ["fit", "fill", "exact"], def: "fit" },
|
|
259
|
+
{ f: "width", label: "Width", kind: "number" },
|
|
260
|
+
{ f: "height", label: "Height", kind: "number" },
|
|
261
|
+
],
|
|
262
|
+
vframes: [
|
|
263
|
+
{ f: "dir", label: "Start from", kind: "select", options: ["end", "start"], def: "end" },
|
|
264
|
+
{ f: "frames", label: "Frames", kind: "number", def: "1", min: 1, max: 12 },
|
|
265
|
+
{ f: "gap", label: "Gap (s)", kind: "number", def: "0.5" },
|
|
266
|
+
],
|
|
267
|
+
combine: [
|
|
268
|
+
{ f: "dedup", label: "Trim duplicate seam frame", kind: "boolean", def: true },
|
|
269
|
+
],
|
|
270
|
+
soundtrack: [
|
|
271
|
+
{ f: "loop", label: "Loop audio to fill video", kind: "boolean", def: false },
|
|
272
|
+
],
|
|
273
|
+
trim: [
|
|
274
|
+
{ f: "start", label: "Start (s)", kind: "number", def: "0" },
|
|
275
|
+
{ f: "length", label: "Length (s)", kind: "number", def: "30" },
|
|
276
|
+
],
|
|
277
|
+
extractaudio: [
|
|
278
|
+
{ f: "start", label: "Start (s)", kind: "number", def: "0" },
|
|
279
|
+
{ f: "length", label: "Length (s)", kind: "number" },
|
|
280
|
+
],
|
|
247
281
|
};
|
|
248
282
|
|
|
249
283
|
/**
|
|
@@ -259,10 +293,16 @@ export function deriveSettings(graph) {
|
|
|
259
293
|
for (const s of specs) {
|
|
260
294
|
if (graph.links.some((l) => l.to.node === n.id && l.to.port === s.f)) continue; // wired knob is decided upstream
|
|
261
295
|
const cur = n.fields[s.f];
|
|
296
|
+
// vframes frames is shape-affecting — never offer a floor below the highest wired frameK
|
|
297
|
+
const min = (n.type === "vframes" && s.f === "frames")
|
|
298
|
+
? Math.max(s.min || 1, wiredFramesFloor(graph, n.id))
|
|
299
|
+
: s.min;
|
|
262
300
|
out.push({
|
|
263
301
|
key: `${n.id}.${s.f}`, nodeId: n.id, field: s.f, kind: s.kind, label: s.label,
|
|
264
302
|
def: cur != null && String(cur) !== "" ? cur : s.def,
|
|
265
303
|
...(s.options ? { options: [...s.options] } : {}),
|
|
304
|
+
...(min != null ? { min } : {}),
|
|
305
|
+
...(s.max != null ? { max: s.max } : {}),
|
|
266
306
|
title: displayName(n),
|
|
267
307
|
});
|
|
268
308
|
}
|