@pixra/chrome-icons 0.0.1 → 0.0.3
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 +29 -0
- package/dist/plugin.js +2456 -0
- package/dist/plugin.js.map +7 -0
- package/{plugin.json → dist/plugin.json} +3 -1
- package/package.json +6 -3
- package/src/plugin.ts +0 -74
- package/tsconfig.json +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixra/chrome-icons",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Export Chrome extension icons (16/32/48/96/128) as ZIP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pixra-plugin",
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
"icons",
|
|
9
9
|
"export"
|
|
10
10
|
],
|
|
11
|
+
"author": "Pixra Team",
|
|
12
|
+
"license": "AGPL-3.0-only",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
11
16
|
"publishConfig": {
|
|
12
17
|
"access": "public"
|
|
13
18
|
},
|
|
14
|
-
"author": "Pixra Team",
|
|
15
|
-
"license": "MIT",
|
|
16
19
|
"devDependencies": {
|
|
17
20
|
"typescript": "^5.9.3",
|
|
18
21
|
"@pixra/plugin-cli": "0.0.1",
|
package/src/plugin.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chrome Extension Icons Plugin for Pixra
|
|
3
|
-
*
|
|
4
|
-
* Exports the current image as Chrome extension icons in multiple sizes:
|
|
5
|
-
* 16x16, 32x32, 48x48, 96x96, 128x128
|
|
6
|
-
* All icons are packaged into a ZIP file for download.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import * as pixra from '@pixra/plugin-sdk'
|
|
10
|
-
import JSZip from 'jszip'
|
|
11
|
-
|
|
12
|
-
const ICON_SIZES = [16, 32, 48, 96, 128] as const
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Resize an ImageData to the specified size
|
|
16
|
-
*/
|
|
17
|
-
async function resizeImage(imageData: ImageData, size: number): Promise<Blob> {
|
|
18
|
-
const bitmap = await createImageBitmap(imageData)
|
|
19
|
-
const canvas = new OffscreenCanvas(size, size)
|
|
20
|
-
const ctx = canvas.getContext('2d')!
|
|
21
|
-
ctx.drawImage(bitmap, 0, 0, size, size)
|
|
22
|
-
return canvas.convertToBlob({ type: 'image/png' })
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Export Chrome extension icons
|
|
27
|
-
*/
|
|
28
|
-
async function exportChromeIcons(): Promise<void> {
|
|
29
|
-
// Get current image
|
|
30
|
-
const imageData = await pixra.workspace.getActiveImage()
|
|
31
|
-
if (!imageData) {
|
|
32
|
-
await pixra.window.showErrorMessage('No image is currently open')
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Create ZIP file
|
|
37
|
-
const zip = new JSZip()
|
|
38
|
-
|
|
39
|
-
// Generate icons for each size
|
|
40
|
-
for (const size of ICON_SIZES) {
|
|
41
|
-
const blob = await resizeImage(imageData, size)
|
|
42
|
-
const arrayBuffer = await blob.arrayBuffer()
|
|
43
|
-
zip.file(`icon-${size}.png`, arrayBuffer)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Generate ZIP
|
|
47
|
-
const zipBlob = await zip.generateAsync({ type: 'arraybuffer' })
|
|
48
|
-
|
|
49
|
-
// Download
|
|
50
|
-
await pixra.workspace.downloadFile('chrome-icons.zip', zipBlob)
|
|
51
|
-
|
|
52
|
-
await pixra.window.showInformationMessage(
|
|
53
|
-
`Exported ${ICON_SIZES.length} icons: ${ICON_SIZES.join(', ')}px`,
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Plugin activation
|
|
59
|
-
*/
|
|
60
|
-
export function activate(context: pixra.ExtensionContext) {
|
|
61
|
-
const disposable = pixra.commands.registerCommand(
|
|
62
|
-
'chromeIcons.export',
|
|
63
|
-
exportChromeIcons,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
context.subscriptions.push(disposable)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Plugin deactivation
|
|
71
|
-
*/
|
|
72
|
-
export function deactivate() {
|
|
73
|
-
// Nothing to clean up
|
|
74
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"lib": [
|
|
6
|
-
"ESNext",
|
|
7
|
-
"DOM"
|
|
8
|
-
],
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"declarationMap": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"rootDir": "./src",
|
|
13
|
-
"strict": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": true,
|
|
17
|
-
"moduleResolution": "bundler"
|
|
18
|
-
},
|
|
19
|
-
"include": [
|
|
20
|
-
"src"
|
|
21
|
-
],
|
|
22
|
-
}
|