diff --git a/bundled-addons/translate/addon.json b/bundled-addons/translate/addon.json index c5bad71f..5d48cbc2 100644 --- a/bundled-addons/translate/addon.json +++ b/bundled-addons/translate/addon.json @@ -1,12 +1,15 @@ { "id": "translate", "name": "Translate", - "version": "0.1.2", + "version": "0.1.3", "description": "Right-click a selection to translate it. Sidebar panel with LibreTranslate or Google as the backend.", "author": "Silent Mode", - "icon": "🌐", + "icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij4gPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTEiIGZpbGw9IiMxZDRlZDgiLz4gPGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuMSIgb3BhY2l0eT0iLjQ1Ij48ZWxsaXBzZSBjeD0iMTIiIGN5PSIxMiIgcng9IjQuNiIgcnk9IjExIi8+PC9nPiA8cmVjdCB4PSIwLjYiIHk9IjEuOCIgd2lkdGg9IjExLjYiIGhlaWdodD0iMTEuNiIgcng9IjIuNiIgZmlsbD0iI2ZmZiIvPiA8dGV4dCB4PSI2LjQiIHk9IjExLjEiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvbnQtZmFtaWx5PSJzeXN0ZW0tdWksU2Vnb2UgVUksc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxMCIgZm9udC13ZWlnaHQ9IjgwMCIgZmlsbD0iIzFkNGVkOCI+QTwvdGV4dD4gPHJlY3QgeD0iMTEuOCIgeT0iMTAuNiIgd2lkdGg9IjExLjYiIGhlaWdodD0iMTEuNiIgcng9IjIuNiIgZmlsbD0iIzBiMTIyMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEiLz4gPGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuOSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBmaWxsPSJub25lIj4gPHBhdGggZD0iTTE3LjYgMTIuNXYxIi8+IDxwYXRoIGQ9Ik0xNC40IDE0LjdoNi40Ii8+IDxwYXRoIGQ9Ik0xOC4zIDE1LjYgMTQuNyAyMCIvPiA8cGF0aCBkPSJNMTYuOSAxNS42IDIwLjUgMjAiLz4gPC9nPiA8L3N2Zz4=", "main": "index.js", - "capabilities": ["sidebar-panel", "context-menu-item"], + "capabilities": [ + "sidebar-panel", + "context-menu-item" + ], "context-menu-items": [ { "id": "translate-selection", diff --git a/bundled-addons/translate/index.js b/bundled-addons/translate/index.js index 08267858..8bb98dce 100644 --- a/bundled-addons/translate/index.js +++ b/bundled-addons/translate/index.js @@ -100,10 +100,11 @@ async function doTranslate(payload) { module.exports = { activate(api) { + // No `icon` here on purpose — registerSidebarPanel defaults to + // manifest.icon, and passing one would shadow the data-URI mark. api.registerSidebarPanel({ id: "main", title: "Translate", - icon: "🌐", page: "panel.html", }); diff --git a/bundled-addons/translate/panel.html b/bundled-addons/translate/panel.html index 3a001aa2..6a3fd836 100644 --- a/bundled-addons/translate/panel.html +++ b/bundled-addons/translate/panel.html @@ -26,6 +26,23 @@ header .m { color: var(--dim); font-size: 11.5px; } header .m.err { color: #ff9081; } header .m.ok { color: var(--acid); } + header .t .em { display: inline-flex; } + header .t .em svg { display: block; width: 17px; height: 17px; } + .zoom { display: flex; align-items: center; gap: 2px; margin-left: 10px; } + .zoom button { + width: 20px; height: 20px; padding: 0; line-height: 1; + display: grid; place-items: center; + background: var(--btn); color: var(--mut); + border: 1px solid var(--line); border-radius: 5px; + cursor: pointer; font: inherit; font-size: 13px; + } + .zoom button:hover:not(:disabled) { background: var(--btn-h); color: var(--ink); } + .zoom button:disabled { opacity: .35; cursor: default; } + .zoom .pct { + min-width: 34px; text-align: center; color: var(--dim); + font-size: 10.5px; font-variant-numeric: tabular-nums; cursor: pointer; + } + .zoom .pct:hover { color: var(--ink); } .langs { display: flex; gap: 6px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel2); } .langs select { flex: 1; min-width: 0; padding: 6px 8px; font: inherit; @@ -43,10 +60,14 @@ .zone label .action { color: var(--mut); font-size: 10.5px; cursor: pointer; letter-spacing: normal; text-transform: none; } .zone label .action:hover { color: var(--acid); } + /* --tsize drives both panes so zoom keeps them matched. 15px is the + default: the old 13.5px was small for reading a paragraph of a language + you don't know well, which is the whole job here. */ textarea, .output { flex: 1; padding: 8px 14px 14px; border: none; outline: none; resize: none; background: transparent; color: var(--ink); - font: 13.5px/1.55 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; + font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; + font-size: var(--tsize, 15px); line-height: 1.55; overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; } textarea::placeholder { color: var(--dim); } @@ -79,7 +100,15 @@