@field/cascade 0.10.0 → 0.12.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/AGENTS.md +25 -5
- package/ARCHITECTURE.md +5 -4
- package/CHANGELOG.md +382 -0
- package/README.md +1 -2
- package/dist/assets/AgentPanel-1JugFjE4.css +1 -0
- package/dist/assets/AgentPanel-BDL5MddA.js +5 -0
- package/dist/assets/{CodeEditor-DSZBpzdy.js → CodeEditor-C-xYG-Wn.js} +120 -120
- package/dist/assets/CodePanel-CtXd50m6.js +2 -0
- package/dist/assets/CookInfoPanel-B3NMhKJF.css +1 -0
- package/dist/assets/CookInfoPanel-DG4_TRsX.js +2 -0
- package/dist/assets/CustomNodeDialog-CHfZUs-r.js +1 -0
- package/dist/assets/DefinitionNode-CaRTXQ_b.js +1 -0
- package/dist/assets/DefinitionPanel-C3CxZY9r.js +1 -0
- package/dist/assets/DefinitionPanel-VNLnAiQD.css +1 -0
- package/dist/assets/OpenGraphDialog-BLdr6k_q.js +1 -0
- package/dist/assets/ProjectSettings-ZnvmIAir.js +2 -0
- package/dist/assets/{SettingsDialog-p25h3tj0.js → SettingsDialog-CBX3Wa87.js} +1 -1
- package/dist/assets/TimelinePanel-CDeR0arY.css +1 -0
- package/dist/assets/TimelinePanel-CWgnFH1e.js +1 -0
- package/dist/assets/{VersionHistoryDialog-DzFLUotB.js → VersionHistoryDialog-BOSoW1R-.js} +1 -1
- package/dist/assets/assert-BO2_erPD.js +1 -0
- package/dist/assets/assert-hvykGCnP.js +1 -0
- package/dist/assets/builder-BmBKcDix.js +1 -0
- package/dist/assets/camera-DFF7YA3F.js +1 -0
- package/dist/assets/checks-DAvyO9Gf.js +1 -0
- package/dist/assets/contactSheet-N1NcaWxw.js +2 -0
- package/dist/assets/{core-BICrEt0y.js → core-DB-MkGjj.js} +3 -4
- package/dist/assets/coreTypes-DtnDATZ7.js +1 -0
- package/dist/assets/{cssMode-D7TXw57I.js → cssMode-DPVckSOc.js} +1 -1
- package/dist/assets/definitions-B227e7f_.js +1 -0
- package/dist/assets/definitions-D0WOUJd7.js +1 -0
- package/dist/assets/{editor.api-DvkCO3ko.js → editor.api-Dkutg_Z1.js} +1 -1
- package/dist/assets/expressions-X-Z-GrgW.js +5 -0
- package/dist/assets/file-DAL6IfjV.js +1 -0
- package/dist/assets/filters-D3k1LRMa.js +1 -0
- package/dist/assets/{freemarker2-BA2lxsF1.js → freemarker2-CLiLKk3B.js} +1 -1
- package/dist/assets/generators-BhDxRAFC.js +1 -0
- package/dist/assets/geo-BsMImJIJ.js +1 -0
- package/dist/assets/geo-C4YngDob.js +2 -0
- package/dist/assets/{handlebars-BcDiyPd8.js → handlebars-CcD3aMeL.js} +1 -1
- package/dist/assets/{html-C7O4TyhX.js → html-DvZWGfqb.js} +1 -1
- package/dist/assets/{htmlMode-WaDGF3Mj.js → htmlMode-DUD3VaoN.js} +1 -1
- package/dist/assets/image-0SfH-snh.js +1 -0
- package/dist/assets/image-Ck-RdGU4.js +2 -0
- package/dist/assets/index-BWnrmIB9.js +137 -0
- package/dist/assets/index-DIaxEONI.css +1 -0
- package/dist/assets/io-BGmt2g0D.js +1 -0
- package/dist/assets/{javascript-CpIEK7tz.js → javascript-Cap2ahgh.js} +1 -1
- package/dist/assets/{jsonMode-B2FltW0f.js → jsonMode-B0uLjp9C.js} +1 -1
- package/dist/assets/{liquid-CN6FFHZE.js → liquid-CnxwhfLn.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-QhV9XtLp.js → lspLanguageFeatures-Dn9hlKX6.js} +1 -1
- package/dist/assets/math-GeULS-sk.js +1 -0
- package/dist/assets/{mdx-DE89pafV.js → mdx-BV3jbrVa.js} +1 -1
- package/dist/assets/pop-KMF_qloi.js +1 -0
- package/dist/assets/preload-helper-Czpn1I53.js +1 -0
- package/dist/assets/{python-ByTllTB9.js → python-CGyFk4XK.js} +1 -1
- package/dist/assets/{razor-USYlRRCE.js → razor-CQfzX3-N.js} +1 -1
- package/dist/assets/remap-5SjXQU-q.js +1 -0
- package/dist/assets/renderMarkdown-ork0Oir7.js +67 -0
- package/dist/assets/studioImages-CAyH-0Pl.js +1 -0
- package/dist/assets/text-ZpX7qNkx.js +2 -0
- package/dist/assets/time-P_OiBhcf.js +1 -0
- package/dist/assets/{tsMode-BXpN8iUz.js → tsMode-BOeXzO9H.js} +1 -1
- package/dist/assets/{typescript-DInBjGQQ.js → typescript-J1SnE_Tu.js} +1 -1
- package/dist/assets/{workers-C7Ye5B7D.js → workers-CYwwTiVF.js} +1 -1
- package/dist/assets/{xml-U0Uocqyo.js → xml-DnPRNzK9.js} +1 -1
- package/dist/assets/{yaml-CBw_PVYf.js → yaml-BmmYBNa9.js} +1 -1
- package/dist/cli/DefinitionNode-P7AA4TAU.js +15 -0
- package/dist/cli/Graph-OB6EWSGL.js +2975 -0
- package/dist/cli/assert-GROGQNCQ.js +25 -0
- package/dist/cli/checks-3WB44XBL.js +189 -0
- package/dist/cli/chunk-2JEU3MGB.js +1125 -0
- package/dist/cli/chunk-2KXB47FP.js +115 -0
- package/dist/cli/chunk-3RXL5GHB.js +816 -0
- package/dist/cli/chunk-53LGFPWX.js +138 -0
- package/dist/cli/chunk-5ORUQ6ES.js +267 -0
- package/dist/cli/chunk-73S4JZXK.js +336 -0
- package/dist/cli/chunk-7QE2ZNSN.js +121 -0
- package/dist/cli/chunk-BP7UKF36.js +376 -0
- package/dist/cli/chunk-BPODRH52.js +201 -0
- package/dist/cli/chunk-BZ63XQ3I.js +1301 -0
- package/dist/cli/chunk-CKS2FQWR.js +89 -0
- package/dist/cli/chunk-CO22XHNG.js +593 -0
- package/dist/cli/chunk-CTPLRSWF.js +2197 -0
- package/dist/cli/chunk-DEQSEFFH.js +153 -0
- package/dist/cli/chunk-EU4ZFZ7Y.js +122 -0
- package/dist/cli/chunk-EZRWJ4G2.js +104 -0
- package/dist/cli/chunk-FWMSGKEH.js +71 -0
- package/dist/cli/chunk-G23A2BZZ.js +705 -0
- package/dist/cli/chunk-GRIN2DDP.js +1465 -0
- package/dist/cli/chunk-HFHWYL55.js +139 -0
- package/dist/cli/chunk-HSNOBIVT.js +263 -0
- package/dist/cli/chunk-ICH7N5PN.js +26 -0
- package/dist/cli/chunk-J7VK7MNF.js +418 -0
- package/dist/cli/chunk-JVOCK5W4.js +83 -0
- package/dist/cli/chunk-KBGUO27Q.js +15 -0
- package/dist/cli/chunk-KH4MUBKF.js +1551 -0
- package/dist/cli/chunk-L6B6FUQP.js +330 -0
- package/dist/cli/chunk-LTXWBXOM.js +438 -0
- package/dist/cli/chunk-MI5JLQYA.js +220 -0
- package/dist/cli/chunk-MP653A5O.js +3766 -0
- package/dist/cli/chunk-NJFMDXHR.js +320 -0
- package/dist/cli/chunk-OM6BEME6.js +267 -0
- package/dist/cli/chunk-OWWBYLHC.js +136 -0
- package/dist/cli/chunk-QQPA2ZHH.js +273 -0
- package/dist/cli/chunk-RUU3YWXU.js +99 -0
- package/dist/cli/chunk-RXDIMXN5.js +98 -0
- package/dist/cli/chunk-ST6LROUG.js +267 -0
- package/dist/cli/chunk-TJW67QSI.js +225 -0
- package/dist/cli/chunk-WD62JIP6.js +118 -0
- package/dist/cli/chunk-WGKPJZDY.js +364 -0
- package/dist/cli/chunk-X4WKAOQP.js +634 -0
- package/dist/cli/chunk-X566FWBV.js +156 -0
- package/dist/cli/chunk-YH637PDL.js +317 -0
- package/dist/cli/chunk-ZL4JTG5Y.js +37 -0
- package/dist/cli/chunk-ZSCUZE6I.js +112 -0
- package/dist/cli/cliCommands-JJN5Z3ZC.js +3470 -0
- package/dist/cli/commands-PHYFYA3F.js +1374 -0
- package/dist/cli/contactSheet-2PQVRUFW.js +11 -0
- package/dist/cli/definitions-BPOPW52L.js +32 -0
- package/dist/cli/doctorCommand-ORWQRNYP.js +106 -0
- package/dist/cli/edit-S5KEQ5RA.js +28 -0
- package/dist/cli/editorCommands-NFR32JOY.js +41 -0
- package/dist/cli/encode-ICPEPMH5.js +17 -0
- package/dist/cli/file-3HTQHPYQ.js +41 -0
- package/dist/cli/filters-6ODFWYK4.js +379 -0
- package/dist/cli/frames-LSAUBZ7P.js +16 -0
- package/dist/cli/generators-YU7GB4MD.js +210 -0
- package/dist/cli/geo-6ZPGKZRU.js +43 -0
- package/dist/cli/graphCommands-EOUOBOIJ.js +184 -0
- package/dist/cli/graphFile-YTGJB5F5.js +292 -0
- package/dist/cli/headlessCanvas-ENRHC7GS.js +16 -0
- package/dist/cli/helpCommand-PULH6ZYB.js +157 -0
- package/dist/cli/image-TXELZZK5.js +55 -0
- package/dist/cli/index.js +100 -30756
- package/dist/cli/math-RSYRQ3C6.js +16 -0
- package/dist/cli/mcp-JVZFQOEX.js +164 -0
- package/dist/cli/parity-X6DEH2DV.js +334 -0
- package/dist/cli/pop-B7SIIYKN.js +39 -0
- package/dist/cli/project-VYGIA7JX.js +12 -0
- package/dist/cli/projectDefinition-F3D7UIHJ.js +27 -0
- package/dist/cli/projectRuntime-2Q4JKEH3.js +55 -0
- package/dist/cli/registerStandardNodes-BXJCB6E4.js +744 -0
- package/dist/cli/render-PT4MWI6U.js +438 -0
- package/dist/cli/runCommand-HNPQVZMS.js +198 -0
- package/dist/cli/runner-5XPXVW7J.js +43 -0
- package/dist/cli/runtime/image.ts +302 -0
- package/dist/cli/runtime/io.ts +78 -0
- package/dist/cli/runtime/stage.ts +4 -1
- package/dist/cli/share-MHF6TNRK.js +166 -0
- package/dist/cli/stageCache-TY2BFZJR.js +15 -0
- package/dist/cli/stageRunner-KY2EJP7X.js +10 -0
- package/dist/cli/text-MB3EKR4H.js +126 -0
- package/dist/cli/verbs-PI2JH5FI.js +19 -0
- package/dist/cli/webBuild-WPPMGGW7.js +44 -0
- package/dist/contracts/capabilities.d.ts +18 -1
- package/dist/contracts/color.d.ts +8 -0
- package/dist/contracts/color.js +23 -0
- package/dist/contracts/definition.d.ts +10 -0
- package/dist/contracts/documentFormat.d.ts +18 -0
- package/dist/contracts/documentFormat.js +195 -0
- package/dist/contracts/editor.d.ts +17 -0
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/schema.d.ts +1 -1
- package/dist/contracts/schema.js +1 -0
- package/dist/contracts/validate.js +11 -1
- package/dist/contracts/values.d.ts +24 -0
- package/dist/image.d.ts +156 -0
- package/dist/image.js +161 -0
- package/dist/index.html +8 -2
- package/dist/io.d.ts +29 -0
- package/dist/io.js +40 -0
- package/dist/player/app.js +3 -2
- package/dist/player/editor.js +35 -9
- package/dist/player/editorEngine.js +3 -2
- package/dist/runtime/builtins/assert/checks.d.ts +18 -0
- package/dist/runtime/builtins/assert/checks.js +207 -0
- package/dist/runtime/builtins/assert/definitions.d.ts +130 -0
- package/dist/runtime/builtins/assert/definitions.js +54 -0
- package/dist/runtime/builtins/assert/index.d.ts +152 -0
- package/dist/runtime/builtins/assert/index.js +36 -0
- package/dist/runtime/builtins/image/contactSheet.d.ts +64 -0
- package/dist/runtime/builtins/image/contactSheet.js +150 -0
- package/dist/runtime/builtins/image/definitions.d.ts +950 -0
- package/dist/runtime/builtins/image/definitions.js +343 -0
- package/dist/runtime/builtins/image/file.d.ts +8 -0
- package/dist/runtime/builtins/image/file.js +37 -0
- package/dist/runtime/builtins/image/filters.d.ts +8 -0
- package/dist/runtime/builtins/image/filters.js +394 -0
- package/dist/runtime/builtins/image/generators.d.ts +7 -0
- package/dist/runtime/builtins/image/generators.js +144 -0
- package/dist/runtime/builtins/image/index.d.ts +952 -0
- package/dist/runtime/builtins/image/index.js +44 -0
- package/dist/runtime/builtins/image/io.d.ts +100 -0
- package/dist/runtime/builtins/image/io.js +142 -0
- package/dist/runtime/builtins/image/planar.d.ts +55 -0
- package/dist/runtime/builtins/image/planar.js +274 -0
- package/dist/runtime/builtins/image/simplex.d.ts +22 -0
- package/dist/runtime/builtins/image/simplex.js +92 -0
- package/dist/runtime/builtins/image/text.d.ts +4 -0
- package/dist/runtime/builtins/image/text.js +141 -0
- package/dist/runtime/builtins/index.d.ts +3 -0
- package/dist/runtime/builtins/index.js +7 -0
- package/dist/runtime/gpu.d.ts +25 -0
- package/dist/runtime/gpu.js +40 -0
- package/dist/runtime/runtime.d.ts +2 -0
- package/dist/runtime/runtime.js +268 -44
- package/dist/runtime/types.d.ts +30 -0
- package/dist/stage.js +4 -1
- package/doc/CLI_REFERENCE.md +91 -2
- package/doc/EDITOR_EXPORT.md +37 -2
- package/doc/MCP.md +18 -1
- package/doc/NODE_REFERENCE.md +424 -10
- package/doc/PROJECT_AUTHORING.md +222 -7
- package/package.json +19 -4
- package/dist/assets/CodePanel-sY6sZa7B.js +0 -2
- package/dist/assets/CustomNodeDialog-BRKnqZhp.js +0 -1
- package/dist/assets/ExportDialog-C7dVGua4.js +0 -358
- package/dist/assets/ExportDialog-DOq0flMV.css +0 -1
- package/dist/assets/OpenGraphDialog-ZsgL-iwr.js +0 -1
- package/dist/assets/ProjectSettings-Cw17nNe3.js +0 -2
- package/dist/assets/definitions-DUww2Rt-.js +0 -1
- package/dist/assets/geo-C2RHOVHC.js +0 -1
- package/dist/assets/image-DR4oeyJB.js +0 -2062
- package/dist/assets/index-7vae6YFC.css +0 -1
- package/dist/assets/index-DyvDC6pS.js +0 -219
- package/dist/assets/math-DaDEgWKt.js +0 -1
- package/dist/assets/pop-pLH7L0PW.js +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each image goes. By default every cell is as wide as the widest image
|
|
3
|
+
* and as tall as the tallest, and images keep their size. With `cellWidth`,
|
|
4
|
+
* cells are that wide and as tall as the tallest image needs at that width,
|
|
5
|
+
* and each image is scaled to fit. Either way an image is centred in its cell
|
|
6
|
+
* and never cropped, in whole pixels, so a sheet is the same bytes every run.
|
|
7
|
+
*/
|
|
8
|
+
export function contactSheetLayout(sizes, options = {}) {
|
|
9
|
+
const count = sizes.length;
|
|
10
|
+
if (!count)
|
|
11
|
+
throw new Error("cascade.image.ContactSheet needs at least one image");
|
|
12
|
+
for (const [width, height] of sizes) {
|
|
13
|
+
if (!(width > 0 && height > 0))
|
|
14
|
+
throw new Error(`cascade.image.ContactSheet: an image is ${width}x${height}`);
|
|
15
|
+
}
|
|
16
|
+
const gap = Math.max(0, Math.round(options.gap ?? 16));
|
|
17
|
+
const columns = Math.min(count, options.columns && options.columns > 0 ? Math.round(options.columns) : Math.ceil(Math.sqrt(count)));
|
|
18
|
+
const rows = Math.ceil(count / columns);
|
|
19
|
+
const scaled = Boolean(options.cellWidth && options.cellWidth > 0);
|
|
20
|
+
const cellWidth = scaled ? Math.round(options.cellWidth) : Math.max(...sizes.map(([width]) => width));
|
|
21
|
+
const cellHeight = scaled
|
|
22
|
+
? Math.max(...sizes.map(([width, height]) => Math.round((height * cellWidth) / width)))
|
|
23
|
+
: Math.max(...sizes.map(([, height]) => height));
|
|
24
|
+
const labelHeight = Math.max(0, Math.round(options.labelHeight ?? 0));
|
|
25
|
+
const cells = sizes.map(([width, height], index) => {
|
|
26
|
+
const column = index % columns;
|
|
27
|
+
const row = Math.floor(index / columns);
|
|
28
|
+
// Native size unless a cell width was asked for; never cropped.
|
|
29
|
+
const fit = Math.min(cellWidth / width, cellHeight / height);
|
|
30
|
+
const scale = scaled ? fit : Math.min(1, fit);
|
|
31
|
+
const drawnWidth = Math.max(1, Math.round(width * scale));
|
|
32
|
+
const drawnHeight = Math.max(1, Math.round(height * scale));
|
|
33
|
+
const left = gap + column * (cellWidth + gap);
|
|
34
|
+
const top = gap + row * (cellHeight + labelHeight + gap);
|
|
35
|
+
return {
|
|
36
|
+
x: left + Math.floor((cellWidth - drawnWidth) / 2),
|
|
37
|
+
y: top + Math.floor((cellHeight - drawnHeight) / 2),
|
|
38
|
+
width: drawnWidth,
|
|
39
|
+
height: drawnHeight,
|
|
40
|
+
labelX: left,
|
|
41
|
+
labelY: top + cellHeight,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
width: gap + columns * (cellWidth + gap),
|
|
46
|
+
height: gap + rows * (cellHeight + labelHeight + gap),
|
|
47
|
+
columns,
|
|
48
|
+
rows,
|
|
49
|
+
cell: [cellWidth, cellHeight],
|
|
50
|
+
labelHeight,
|
|
51
|
+
cells,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** The host's canvas, read here and nowhere else (see `cascade.geo.Render`). */
|
|
55
|
+
function host() {
|
|
56
|
+
const globals = globalThis;
|
|
57
|
+
const Canvas = globals.OffscreenCanvas;
|
|
58
|
+
const createBitmap = globals.createImageBitmap;
|
|
59
|
+
if (!Canvas || !createBitmap || !globals.Blob) {
|
|
60
|
+
throw new Error("cascade.image.ContactSheet needs OffscreenCanvas and createImageBitmap, which this host does not provide");
|
|
61
|
+
}
|
|
62
|
+
const BlobType = globals.Blob;
|
|
63
|
+
return {
|
|
64
|
+
surface: (width, height) => new Canvas(width, height),
|
|
65
|
+
decode: (bytes) => createBitmap(new BlobType([bytes])),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function css(colour, fallback) {
|
|
69
|
+
const [r = 0, g = 0, b = 0, a = 1] = colour ?? fallback;
|
|
70
|
+
return `rgba(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(b * 255)}, ${a})`;
|
|
71
|
+
}
|
|
72
|
+
/** Encoded images (PNG, JPEG, WebP) in, one PNG sheet out. */
|
|
73
|
+
export async function composeContactSheet(images, options = {}) {
|
|
74
|
+
const canvas = host();
|
|
75
|
+
const bitmaps = [];
|
|
76
|
+
try {
|
|
77
|
+
for (const bytes of images)
|
|
78
|
+
bitmaps.push(await canvas.decode(bytes));
|
|
79
|
+
const labels = options.labels ?? [];
|
|
80
|
+
const labelSize = Math.round(options.labelSize ?? 14);
|
|
81
|
+
const labelled = labels.some((label) => label.trim().length > 0);
|
|
82
|
+
const layout = contactSheetLayout(bitmaps.map((bitmap) => [bitmap.width, bitmap.height]), {
|
|
83
|
+
columns: options.columns,
|
|
84
|
+
gap: options.gap,
|
|
85
|
+
cellWidth: options.cellWidth,
|
|
86
|
+
labelHeight: labelled ? Math.round(labelSize * 1.8) : 0,
|
|
87
|
+
});
|
|
88
|
+
const surface = canvas.surface(layout.width, layout.height);
|
|
89
|
+
const context = surface.getContext("2d");
|
|
90
|
+
if (!context)
|
|
91
|
+
throw new Error("cascade.image.ContactSheet: no 2D context");
|
|
92
|
+
context.fillStyle = css(options.background, [1, 1, 1, 1]);
|
|
93
|
+
context.fillRect(0, 0, layout.width, layout.height);
|
|
94
|
+
context.imageSmoothingEnabled = true;
|
|
95
|
+
context.imageSmoothingQuality = "high";
|
|
96
|
+
layout.cells.forEach((cell, index) => context.drawImage(bitmaps[index], cell.x, cell.y, cell.width, cell.height));
|
|
97
|
+
if (labelled) {
|
|
98
|
+
context.fillStyle = css(options.labelColor, [0.1, 0.1, 0.1, 1]);
|
|
99
|
+
context.font = `${labelSize}px sans-serif`;
|
|
100
|
+
context.textBaseline = "top";
|
|
101
|
+
layout.cells.forEach((cell, index) => {
|
|
102
|
+
const label = labels[index];
|
|
103
|
+
if (label)
|
|
104
|
+
context.fillText(label, cell.labelX, cell.labelY + Math.round((layout.labelHeight - labelSize) / 2), layout.cell[0]);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const blob = await surface.convertToBlob({ type: "image/png" });
|
|
108
|
+
return { bytes: new Uint8Array(await blob.arrayBuffer()), layout };
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
for (const bitmap of bitmaps)
|
|
112
|
+
bitmap.close?.();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** An image value or a path, as the asset reference to read it by. */
|
|
116
|
+
function imageReference(value) {
|
|
117
|
+
if (typeof value === "string" && value)
|
|
118
|
+
return { path: value };
|
|
119
|
+
const candidate = value?.path;
|
|
120
|
+
return typeof candidate === "string" && candidate ? { path: candidate } : undefined;
|
|
121
|
+
}
|
|
122
|
+
export async function executeContactSheet(context) {
|
|
123
|
+
const { props } = context;
|
|
124
|
+
const references = [...context.inputs.images, ...(context.inputs.list ?? [])]
|
|
125
|
+
.map(imageReference)
|
|
126
|
+
.filter((reference) => reference !== undefined);
|
|
127
|
+
const bytes = [];
|
|
128
|
+
for (const reference of references) {
|
|
129
|
+
bytes.push(await context.capabilities.assets.read(reference, { signal: context.signal }));
|
|
130
|
+
}
|
|
131
|
+
const { bytes: sheet, layout } = await composeContactSheet(bytes, {
|
|
132
|
+
columns: props.columns,
|
|
133
|
+
gap: props.gap,
|
|
134
|
+
cellWidth: props.cellWidth,
|
|
135
|
+
labels: props.labels ? props.labels.split("\n") : [],
|
|
136
|
+
labelSize: props.labelSize,
|
|
137
|
+
background: props.background,
|
|
138
|
+
labelColor: props.labelColor,
|
|
139
|
+
});
|
|
140
|
+
const asset = await context.capabilities.assets.write(sheet, { mediaType: "image/png", suggestedName: props.filename }, { signal: context.signal });
|
|
141
|
+
context.outputs.asset.set(asset);
|
|
142
|
+
context.outputs.image.set({
|
|
143
|
+
path: asset.path ?? props.filename,
|
|
144
|
+
size: [layout.width, layout.height],
|
|
145
|
+
channels: "rgba",
|
|
146
|
+
depth: "u8",
|
|
147
|
+
space: "srgb",
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=contactSheet.js.map
|