@cordfuse/nux-qr-tool 1.0.0 → 1.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.
@@ -6066,7 +6066,9 @@ var BG = "#0f0f0f";
6066
6066
  var ACCENT = "#e63946";
6067
6067
  var TEXT_MAIN = "#ffffff";
6068
6068
  var TEXT_SUB = "#aaaaaa";
6069
- async function decorateQR(qrPng, artist, song, deviceId, deviceName) {
6069
+ async function decorateQR(qrPng, artist, song, deviceId, deviceName, options) {
6070
+ const appName = options?.appName ?? "ToneAI";
6071
+ const appVersion = options?.appVersion ?? VERSION;
6070
6072
  const hasEmbeddedName = PRO_DEVICES.has(deviceId);
6071
6073
  const canvas = import_canvas.createCanvas(TOTAL_W, TOTAL_H);
6072
6074
  const ctx = canvas.getContext("2d");
@@ -6076,11 +6078,11 @@ async function decorateQR(qrPng, artist, song, deviceId, deviceName) {
6076
6078
  ctx.fillStyle = ACCENT;
6077
6079
  ctx.textAlign = "left";
6078
6080
  ctx.textBaseline = "middle";
6079
- ctx.fillText("ToneAI", PADDING, HEADER_H / 2);
6081
+ ctx.fillText(appName, PADDING, HEADER_H / 2);
6080
6082
  ctx.font = "13px Arial";
6081
6083
  ctx.fillStyle = TEXT_SUB;
6082
6084
  ctx.textAlign = "right";
6083
- ctx.fillText(`v${VERSION}`, TOTAL_W - PADDING, HEADER_H / 2);
6085
+ ctx.fillText(`v${appVersion}`, TOTAL_W - PADDING, HEADER_H / 2);
6084
6086
  ctx.fillStyle = ACCENT;
6085
6087
  ctx.globalAlpha = 0.4;
6086
6088
  ctx.fillRect(0, HEADER_H - 2, TOTAL_W, 2);
@@ -6133,7 +6135,12 @@ async function main() {
6133
6135
  writeFileSync(outPath, decorated);
6134
6136
  console.log(outPath);
6135
6137
  }
6136
- main().catch((err) => {
6137
- console.error(err.message);
6138
- process.exit(1);
6139
- });
6138
+ var isMain = process.argv[1] === fileURLToPath(import.meta.url) || process.argv[1]?.endsWith("qr-generator.js");
6139
+ if (isMain)
6140
+ main().catch((err) => {
6141
+ console.error(err.message);
6142
+ process.exit(1);
6143
+ });
6144
+ export {
6145
+ decorateQR
6146
+ };
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@cordfuse/nux-qr-tool",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "NUX MightyAmp QR preset encoder — generates decorated QR PNG cards from preset JSON",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "nux-qr-tool": "./dist/qr-generator.js"
8
8
  },
9
+ "exports": "./dist/qr-generator.js",
9
10
  "files": [
10
11
  "dist"
11
12
  ],