@pixra/chrome-icons 0.0.7 → 0.0.9
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/plugin +9 -3
- package/dist/plugin.json +1 -1
- package/dist/plugin.map +3 -3
- package/package.json +9 -3
package/dist/plugin
CHANGED
|
@@ -2397,6 +2397,7 @@ var require_jszip_min = __commonJS({
|
|
|
2397
2397
|
});
|
|
2398
2398
|
|
|
2399
2399
|
// src/plugin.ts
|
|
2400
|
+
var import_jszip = __toESM(require_jszip_min());
|
|
2400
2401
|
import * as pixra from "@pixra/plugin-sdk";
|
|
2401
2402
|
var ICON_SIZES = [16, 32, 48, 96, 128];
|
|
2402
2403
|
async function resizeImage(imageData, size) {
|
|
@@ -2412,15 +2413,20 @@ async function exportChromeIcons() {
|
|
|
2412
2413
|
await pixra.window.showErrorMessage("No image is currently open");
|
|
2413
2414
|
return;
|
|
2414
2415
|
}
|
|
2415
|
-
const
|
|
2416
|
-
const zip = new JSZip();
|
|
2416
|
+
const zip = new import_jszip.default();
|
|
2417
2417
|
for (const size of ICON_SIZES) {
|
|
2418
2418
|
const blob = await resizeImage(imageData, size);
|
|
2419
2419
|
const arrayBuffer = await blob.arrayBuffer();
|
|
2420
2420
|
zip.file(`icon-${size}.png`, arrayBuffer);
|
|
2421
2421
|
}
|
|
2422
2422
|
const zipBlob = await zip.generateAsync({ type: "arraybuffer" });
|
|
2423
|
-
await pixra.
|
|
2423
|
+
const activeTab = await pixra.tabs.getActive();
|
|
2424
|
+
const baseName = activeTab?.name.replace(/\.[^.]+$/, "");
|
|
2425
|
+
if (!baseName) {
|
|
2426
|
+
throw new Error("Failed to determine base filename from active tab");
|
|
2427
|
+
}
|
|
2428
|
+
const filename = `${baseName}-chrome-icons.zip`;
|
|
2429
|
+
await pixra.window.saveFile({ filename, data: zipBlob });
|
|
2424
2430
|
await pixra.window.showInformationMessage(
|
|
2425
2431
|
`Exported ${ICON_SIZES.length} icons: ${ICON_SIZES.join(", ")}px`
|
|
2426
2432
|
);
|