@edv4h/usketch-plugin-export 2.0.5 → 2.1.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/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +34 -16
- package/dist/plugin.js.map +1 -1
- package/package.json +6 -6
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG1E,wBAAgB,kBAAkB,IAAI,aAAa,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG1E,wBAAgB,kBAAkB,IAAI,aAAa,CAkDlD"}
|
package/dist/plugin.js
CHANGED
|
@@ -4,27 +4,45 @@ export function createExportPlugin() {
|
|
|
4
4
|
id: "usketch-plugin-export",
|
|
5
5
|
name: "エクスポート",
|
|
6
6
|
setup(ctx) {
|
|
7
|
-
const
|
|
7
|
+
const exportImage = (format) => {
|
|
8
8
|
const shapes = new Map(ctx.store.getShapes());
|
|
9
|
-
exportCanvas(shapes, ctx.shapes, { format
|
|
10
|
-
.then((blob) => downloadBlob(blob,
|
|
11
|
-
.catch((e) => console.error(
|
|
12
|
-
}
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
exportCanvas(shapes, ctx.shapes, { format })
|
|
10
|
+
.then((blob) => downloadBlob(blob, `usketch-export.${format}`))
|
|
11
|
+
.catch((e) => console.error(`${format.toUpperCase()} export failed:`, e));
|
|
12
|
+
};
|
|
13
|
+
const exportJsonFile = () => {
|
|
14
|
+
downloadBlob(exportJson(new Map(ctx.store.getShapes())), "usketch-export.json");
|
|
15
|
+
};
|
|
16
|
+
const unsub1 = ctx.shortcuts.register("ctrl+shift+e", () => exportImage("png"));
|
|
17
|
+
const unsub2 = ctx.shortcuts.register("ctrl+shift+alt+e", () => exportImage("svg"));
|
|
18
|
+
const unsub3 = ctx.shortcuts.register("ctrl+shift+j", exportJsonFile);
|
|
19
|
+
// ── Control HUD 用 Action(Demo の Export メニュー相当) ──
|
|
20
|
+
const offActions = [
|
|
21
|
+
ctx.actions.register({
|
|
22
|
+
id: "export:png",
|
|
23
|
+
label: "Export PNG",
|
|
24
|
+
group: "Export",
|
|
25
|
+
run: () => exportImage("png"),
|
|
26
|
+
}),
|
|
27
|
+
ctx.actions.register({
|
|
28
|
+
id: "export:svg",
|
|
29
|
+
label: "Export SVG",
|
|
30
|
+
group: "Export",
|
|
31
|
+
run: () => exportImage("svg"),
|
|
32
|
+
}),
|
|
33
|
+
ctx.actions.register({
|
|
34
|
+
id: "export:json",
|
|
35
|
+
label: "Export JSON",
|
|
36
|
+
group: "Export",
|
|
37
|
+
run: exportJsonFile,
|
|
38
|
+
}),
|
|
39
|
+
];
|
|
24
40
|
return () => {
|
|
25
41
|
unsub1();
|
|
26
42
|
unsub2();
|
|
27
43
|
unsub3();
|
|
44
|
+
for (const off of offActions)
|
|
45
|
+
off();
|
|
28
46
|
};
|
|
29
47
|
},
|
|
30
48
|
};
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,UAAU,kBAAkB;IACjC,OAAO;QACN,EAAE,EAAE,uBAAuB;QAC3B,IAAI,EAAE,QAAQ;QAEd,KAAK,CAAC,GAAkB;YACvB,MAAM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S,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;YAEtE,mDAAmD;YACnD,MAAM,UAAU,GAAG;gBAClB,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACpB,EAAE,EAAE,YAAY;oBAChB,KAAK,EAAE,YAAY;oBACnB,KAAK,EAAE,QAAQ;oBACf,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;iBAC7B,CAAC;gBACF,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACpB,EAAE,EAAE,YAAY;oBAChB,KAAK,EAAE,YAAY;oBACnB,KAAK,EAAE,QAAQ;oBACf,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;iBAC7B,CAAC;gBACF,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACpB,EAAE,EAAE,aAAa;oBACjB,KAAK,EAAE,aAAa;oBACpB,KAAK,EAAE,QAAQ;oBACf,GAAG,EAAE,cAAc;iBACnB,CAAC;aACF,CAAC;YAEF,OAAO,GAAG,EAAE;gBACX,MAAM,EAAE,CAAC;gBACT,MAAM,EAAE,CAAC;gBACT,MAAM,EAAE,CAAC;gBACT,KAAK,MAAM,GAAG,IAAI,UAAU;oBAAE,GAAG,EAAE,CAAC;YACrC,CAAC,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edv4h/usketch-plugin-export",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"satori": "0.
|
|
15
|
-
"@edv4h/usketch-core": "2.0
|
|
16
|
-
"@edv4h/usketch-shared": "4.
|
|
14
|
+
"satori": "0.28.0",
|
|
15
|
+
"@edv4h/usketch-core": "2.1.0",
|
|
16
|
+
"@edv4h/usketch-shared": "4.5.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=19",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "19.2.17",
|
|
24
24
|
"@types/react-dom": "19.2.3",
|
|
25
|
-
"typescript": "
|
|
26
|
-
"vitest": "
|
|
25
|
+
"typescript": "7.0.2",
|
|
26
|
+
"vitest": "4.1.10"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|