From 9e424efaf4a4f1c9f95e30723233b077dacfe549 Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Wed, 8 Jul 2026 18:43:55 +0100 Subject: [PATCH] =?UTF-8?q?refactor(js):=20extract=20quick-search=20overla?= =?UTF-8?q?y=20cluster=20from=20app.js=20(=C2=A73.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eighth slice. Quick search wasn't contiguous — its functions sat on both sides of the cheatsheet and password-history modals (lines 725-1104). Rather than a fiddly non-contiguous cut, the whole overlay cluster is extracted as one byte-identical block: js/app.overlays.js (quick search + cheatsheet + password history). Pure declarations, no top-level side effects → loads before app.js; all state/api/Bridge/render/decryptPwd refs resolve via shared global scope at call time. - Byte-for-byte identical; syntax OK on all nine app parts; 62/62 tests green. - index.html + BuildAssets whitelist + harness APP_PARTS updated. app.js: 11936 → 9170 lines (8 modules extracted, ~2770 lines). Load order: argon2 → crypto → totp → favicon → import → backup → health → overlays → app → sync. Co-Authored-By: Claude Opus 4.8 --- CLAUDE.md | 2 + CODE_AUDIT.md | 12 +- delphi-backend/assets/BuildAssets.ps1 | 1 + index.html | 1 + js/app.js | 381 +------------------------ js/app.overlays.js | 392 ++++++++++++++++++++++++++ js/tests/harness.js | 2 +- 7 files changed, 408 insertions(+), 383 deletions(-) create mode 100644 js/app.overlays.js diff --git a/CLAUDE.md b/CLAUDE.md index c852d56..29c15fd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -38,6 +38,7 @@ js/app.favicon.js (favicon fetch/cache + faviconHost — extrait §3.1) js/app.import.js (export container + import CSV/JSON — extrait §3.1) js/app.backup.js (auto-backup planifié — extrait §3.1) js/app.health.js (vault health dashboard — extrait §3.1) +js/app.overlays.js (quick search + cheatsheet + password history — extrait §3.1) js/app.js (le reste : state, Bridge, api, UI…) js/app.sync.js (WebDAV + merge — extrait §3.1, APRÈS app.js car effet de bord top-level `Bridge.onWebdavResult = …`) @@ -109,6 +110,7 @@ seule `api()` est stubbée). | Import/export frontend (CSV/JSON parse, export container) — extrait §3.1 | `js/app.import.js` | | Auto-backup frontend (planifié, chiffré) — extrait §3.1 | `js/app.backup.js` | | Vault health dashboard — extrait §3.1 | `js/app.health.js` | +| Quick search + cheatsheet + history modal — extrait §3.1 | `js/app.overlays.js` | | Sync frontend (WebDAV, snapshot, merge) — extrait §3.1 | `js/app.sync.js` | | Argon2id vendé (bundle `@noble/hashes`, IIFE) | `js/argon2.js` | | HTML racine | `index.html` | diff --git a/CODE_AUDIT.md b/CODE_AUDIT.md index f7d81ca..da6d92a 100644 --- a/CODE_AUDIT.md +++ b/CODE_AUDIT.md @@ -245,11 +245,15 @@ réécriture des call-sites, risque quasi nul vs conversion en modules ES). - ✅ `js/app.health.js` extrait (vault health dashboard) — byte-for-byte identique, chargé AVANT app.js (`auditCache`/`auditFilter` viennent avec, résolus cross-fichier). -- `app.js` : 11 936 → **9 545 lignes** (7 modules sortis). +- ✅ `js/app.overlays.js` extrait (quick search + cheatsheet + password + history) — quicksearch était entrelacé avec ces 2 overlays, donc extraits + ensemble en un bloc contigu byte-for-byte. Chargé AVANT app.js. +- `app.js` : 11 936 → **9 170 lignes** (8 modules sortis, ~2 770 lignes). - Suite de tests : 42 → **62 tests**. -- Reste : slideover, settings, autofill… Note : **quicksearch n'est PAS - contigu** (entrelacé avec cheatsheet + history-modal 886-1063) → extraction - propre pas triviale, reportée. +- Reste : sections très couplées au state/DOM (slideover, settings, folders, + attachments, autofill, PIN/recovery/quick-unlock) — rendement/risque faible, + à faire au fil de l'eau. Le socle §3.1 (pattern + modules à risque isolés + + filet de tests) est en place. - ✅ `node --check` en pré-étape de `BuildAssets.ps1` : **déjà fait** (cf. §3.2). ### 3.2 🟡 Aucun test automatisé — **partiellement adressé (2026-07-04)** diff --git a/delphi-backend/assets/BuildAssets.ps1 b/delphi-backend/assets/BuildAssets.ps1 index 4fa36a7..9383bbe 100644 --- a/delphi-backend/assets/BuildAssets.ps1 +++ b/delphi-backend/assets/BuildAssets.ps1 @@ -58,6 +58,7 @@ $patterns = @( 'js\app.import.js', 'js\app.backup.js', 'js\app.health.js', + 'js\app.overlays.js', 'js\app.js', 'js\app.sync.js', 'css\style.css' diff --git a/index.html b/index.html index 73bdab1..3b54da4 100644 --- a/index.html +++ b/index.html @@ -1198,6 +1198,7 @@ + diff --git a/js/app.js b/js/app.js index 3200bf4..3a1feef 100644 --- a/js/app.js +++ b/js/app.js @@ -723,385 +723,10 @@ async function api(path, opts) { // ============================================================ // ============================================================ -// QUICK SEARCH MODAL (tray menu → fast password copy) +// QUICK SEARCH + CHEATSHEET + HISTORY — extracted to +// js/app.overlays.js (§3.1), loaded as a separate