From 6f60462d444fbfbddadf79764462422c8100b7eb Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Wed, 28 Oct 2026 12:54:23 +0100 Subject: [PATCH] A converter tool: text in six encodings, hex, binary, decimal, octal, Base64; 8/16/32-bit words either byte order; Tools menu in the top bar Co-Authored-By: Claude Opus 5.5 (1M context) --- app/assets/css/main.css | 98 ++++++++++++ app/components/editor/App.vue | 1 + app/components/editor/ConvertDialog.vue | 144 +++++++++++++++++ app/components/editor/QuickAdd.vue | 2 + app/components/editor/Toolbar.vue | 12 +- app/composables/useEditor.ts | 2 +- app/lib/convert.ts | 203 ++++++++++++++++++++++++ tests/convert.test.ts | 58 +++++++ 8 files changed, 517 insertions(+), 3 deletions(-) create mode 100644 app/components/editor/ConvertDialog.vue create mode 100644 app/lib/convert.ts create mode 100644 tests/convert.test.ts diff --git a/app/assets/css/main.css b/app/assets/css/main.css index 5cf8137..e68ba94 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -5813,3 +5813,101 @@ button.tile:hover { .node .pixel-rgb.dark { fill: rgb(0 0 0 / 0.55); } + +/* Converter */ +.modal.convert { + width: min(860px, 100%); +} + +.convert-opts { + display: flex; + flex-wrap: wrap; + gap: 10px 18px; + margin: 10px 0 12px; +} + +.convert-opts label > span { + display: block; + margin-bottom: 4px; + font-size: 12px; + color: var(--muted); +} + +.convert-in .seg { + margin-bottom: 6px; +} + +.convert-text { + font-family: var(--font-mono); + font-size: 13px; + resize: vertical; +} + +.convert-error { + margin-top: 4px; + font-size: 12px; + color: var(--danger); +} + +.convert-outs { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); + gap: 8px; + margin-top: 10px; +} + +.convert-out { + min-width: 0; + padding: 6px 8px 8px; + background: var(--panel-2); + border: 1px solid var(--border); + border-radius: 8px; +} + +.convert-out-head { + display: flex; + align-items: center; + gap: 6px; + font-size: 12px; + font-weight: 600; +} + +.convert-out-head .hint { + margin: 0; + font-weight: 400; +} + +.convert-value { + max-height: 120px; + overflow: auto; + margin-top: 4px; + font-family: var(--font-mono); + font-size: 12px; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.convert-table-wrap { + max-height: 280px; + overflow: auto; +} + +.convert-table { + width: 100%; + font-family: var(--font-mono); + font-size: 12px; +} + +.convert-table th { + position: sticky; + top: 0; + background: var(--panel); + color: var(--muted); + font-weight: 600; + text-align: left; +} + +.convert-table th, +.convert-table td { + padding: 2px 10px 2px 0; +} diff --git a/app/components/editor/App.vue b/app/components/editor/App.vue index bd6e6d3..54f12b7 100644 --- a/app/components/editor/App.vue +++ b/app/components/editor/App.vue @@ -84,5 +84,6 @@ watch( + diff --git a/app/components/editor/ConvertDialog.vue b/app/components/editor/ConvertDialog.vue new file mode 100644 index 0000000..a8c1d18 --- /dev/null +++ b/app/components/editor/ConvertDialog.vue @@ -0,0 +1,144 @@ + + +