@a-company/atelier-studio 0.25.3 → 0.26.1
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.cjs +34 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +33 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AtelierStudio: () => AtelierStudio,
|
|
34
|
+
ImageCache: () => import_atelier_canvas3.ImageCache,
|
|
34
35
|
applyStudioTheme: () => applyStudioTheme,
|
|
35
36
|
defaultTheme: () => defaultTheme,
|
|
36
37
|
exportDocument: () => exportDocument,
|
|
@@ -2914,15 +2915,25 @@ async function exportMP4(doc, canvas, imageCache, opts) {
|
|
|
2914
2915
|
const height = doc.canvas.height;
|
|
2915
2916
|
const encWidth = width % 2 === 0 ? width : width + 1;
|
|
2916
2917
|
const encHeight = height % 2 === 0 ? height : height + 1;
|
|
2917
|
-
const
|
|
2918
|
-
codec: "avc1.
|
|
2919
|
-
|
|
2920
|
-
height: encHeight,
|
|
2921
|
-
|
|
2922
|
-
framerate: fps
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2918
|
+
const codecCandidates = [
|
|
2919
|
+
{ codec: "avc1.640033", width: encWidth, height: encHeight, bitrate: 5e6, framerate: fps },
|
|
2920
|
+
// High 5.1 (4K)
|
|
2921
|
+
{ codec: "avc1.64002a", width: encWidth, height: encHeight, bitrate: 5e6, framerate: fps },
|
|
2922
|
+
// High 4.2 (1080p60)
|
|
2923
|
+
{ codec: "avc1.640028", width: encWidth, height: encHeight, bitrate: 5e6, framerate: fps },
|
|
2924
|
+
// High 4.0 (1080p30)
|
|
2925
|
+
{ codec: "avc1.42001f", width: encWidth, height: encHeight, bitrate: 5e6, framerate: fps }
|
|
2926
|
+
// Baseline 3.1 (720p)
|
|
2927
|
+
];
|
|
2928
|
+
let support = null;
|
|
2929
|
+
for (const candidate of codecCandidates) {
|
|
2930
|
+
const result = await VideoEncoder.isConfigSupported(candidate);
|
|
2931
|
+
if (result.supported) {
|
|
2932
|
+
support = result;
|
|
2933
|
+
break;
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
if (!support?.supported) {
|
|
2926
2937
|
throw new Error(
|
|
2927
2938
|
`H.264 codec not supported for ${encWidth}\xD7${encHeight} at ${fps}fps. Try exporting as GIF or WebM instead.`
|
|
2928
2939
|
);
|
|
@@ -3158,11 +3169,13 @@ var ExportDialog = class {
|
|
|
3158
3169
|
dialog = null;
|
|
3159
3170
|
blobUrl = null;
|
|
3160
3171
|
parentEl = null;
|
|
3172
|
+
filename = null;
|
|
3161
3173
|
/**
|
|
3162
3174
|
* Mount the export overlay into the given parent element.
|
|
3163
3175
|
* Typically called with the studio root.
|
|
3164
3176
|
*/
|
|
3165
|
-
show(doc, canvas, imageCache, parentEl) {
|
|
3177
|
+
show(doc, canvas, imageCache, parentEl, filename) {
|
|
3178
|
+
this.filename = filename ?? null;
|
|
3166
3179
|
this.parentEl = parentEl;
|
|
3167
3180
|
this.overlay = document.createElement("div");
|
|
3168
3181
|
this.overlay.className = "atel-export-overlay";
|
|
@@ -3301,7 +3314,7 @@ var ExportDialog = class {
|
|
|
3301
3314
|
const ext = result.format;
|
|
3302
3315
|
const downloadBtn = document.createElement("a");
|
|
3303
3316
|
downloadBtn.href = this.blobUrl;
|
|
3304
|
-
downloadBtn.download =
|
|
3317
|
+
downloadBtn.download = `${this.filename || "animation"}.${ext}`;
|
|
3305
3318
|
downloadBtn.className = "atel-toolbar__btn atel-toolbar__btn--active atel-export-download";
|
|
3306
3319
|
downloadBtn.textContent = `Download .${ext}`;
|
|
3307
3320
|
this.dialog.appendChild(downloadBtn);
|
|
@@ -3387,6 +3400,7 @@ var AtelierStudio = class {
|
|
|
3387
3400
|
yamlPanel;
|
|
3388
3401
|
doc = null;
|
|
3389
3402
|
originalDoc = null;
|
|
3403
|
+
currentFilename = null;
|
|
3390
3404
|
currentTab;
|
|
3391
3405
|
stateName = "";
|
|
3392
3406
|
abortController = new AbortController();
|
|
@@ -3457,6 +3471,9 @@ var AtelierStudio = class {
|
|
|
3457
3471
|
this.currentTab = tab;
|
|
3458
3472
|
this.applyTab();
|
|
3459
3473
|
}
|
|
3474
|
+
setFilename(name) {
|
|
3475
|
+
this.currentFilename = name;
|
|
3476
|
+
}
|
|
3460
3477
|
destroy() {
|
|
3461
3478
|
this.abortController.abort();
|
|
3462
3479
|
this.canvasPanel.destroy();
|
|
@@ -3604,13 +3621,18 @@ var AtelierStudio = class {
|
|
|
3604
3621
|
this.doc,
|
|
3605
3622
|
this.canvasPanel.getCanvas(),
|
|
3606
3623
|
this.canvasPanel.getImageCache(),
|
|
3607
|
-
this.root
|
|
3624
|
+
this.root,
|
|
3625
|
+
this.currentFilename ?? void 0
|
|
3608
3626
|
);
|
|
3609
3627
|
}
|
|
3610
3628
|
};
|
|
3629
|
+
|
|
3630
|
+
// src/index.ts
|
|
3631
|
+
var import_atelier_canvas3 = require("@a-company/atelier-canvas");
|
|
3611
3632
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3612
3633
|
0 && (module.exports = {
|
|
3613
3634
|
AtelierStudio,
|
|
3635
|
+
ImageCache,
|
|
3614
3636
|
applyStudioTheme,
|
|
3615
3637
|
defaultTheme,
|
|
3616
3638
|
exportDocument,
|