From 3c4212b71875961936dc56369beb0cb6bf1b431a Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 5 Mar 2024 19:34:35 +0100 Subject: [PATCH] refactor: commandline (#5180) * initial rewrite * remove title * remove from dom on hide * actual command dom show active keep active in view update active index on keypress * global event only shows commandline * impr(dev): showing notifications with unhandled errors * rename functions * handle hover functions handle nesting handle exec attaching handlers once * void promise * no need for async * move font preview to ui * add configkey to command * add function to build single list * add mouse mode clearing preview on hide add config icon * using new function * use fw icon * fix incorrect type * extract logic * add support for input commands * unused error * update single list * chevron icon margin * only focusing when no popups and words are visible * extract condition * better type * remove no icon * only showing when nothing is already visible * commandline lists no longer modify the commandline element dynamically changing which funbox commnands are available modified searching approach showing active settings in single mode again calling before list if needed * ignore keydown on page transition * add other ways to show the commandline * always clearing previews * incorrect icon being used * extract logic * support quick single list mode by starting input with > * fix test words not being focused * showing all if in quick single mode * remove unused code * rename entry to command * remove more unused code * add data- prefix * rename to data-command-id * fix input commands not refocusing words * fix fontsize change not working as intended * set active index to 0 when going back * keeping active command in view * remove console logs * fix quick single mode * move file * add footer events * add option for subgroup override fix issue where commands would get hidden after clearing input field fixed auto scrolling in mouse mode * rename commands to lists * add background after to avoid flashing * getting config key from active subgroup * updating active command after removing hidden class but before animating * fix nasty hover behavior * updating active before animation showing, keeping active after * add keymap event * remove comments * invert if, use return, combine ifs to reduce nesting * add test event * popups events * fix some commands not showing up on a single list * use new animated modal * use regex escaping function from misc * add singlelistdisplay and singlelistdisplaynoicon properties * add more navigation aliases * not adding alias if not needed * rework command filtering * fix active icon not working * add custom hide handlers * fix active command not being kept in view after showing * unused imports * remove commandlinelists imports from other files * delete old file * remove unused file * import commandline dynamically * fix: if skeleton has wrapper, append before building animated modal * using new parameters * save skeleton on ready * rename folder * add util to get async modules * remove empty imports * remove unnecessary code * unnecessary void * catching errors and notifying user * better error message * making sure all the lists are fetched before getting the single command list * add tab navigation --- frontend/src/html/popups.html | 13 +- frontend/src/styles/commandline.scss | 89 +- frontend/src/ts/commandline/commandline.ts | 588 ++++++++++++ frontend/src/ts/commandline/index.ts | 862 ------------------ .../ts/commandline/{commands.ts => lists.ts} | 158 +++- .../src/ts/commandline/lists/font-family.ts | 7 +- frontend/src/ts/commandline/lists/funbox.ts | 64 +- .../ts/commandline/lists/load-challenge.ts | 1 - .../src/ts/commandline/lists/navigation.ts | 7 +- frontend/src/ts/commandline/lists/tags.ts | 35 +- frontend/src/ts/config.ts | 13 - frontend/src/ts/event-handlers/footer.ts | 39 + frontend/src/ts/event-handlers/global.ts | 30 + frontend/src/ts/event-handlers/keymap.ts | 7 + frontend/src/ts/event-handlers/popups.ts | 5 + frontend/src/ts/event-handlers/test.ts | 7 + frontend/src/ts/index.ts | 6 +- frontend/src/ts/popups/animated-modal.ts | 4 + frontend/src/ts/ready.ts | 3 + frontend/src/ts/test/test-ui.ts | 11 +- frontend/src/ts/types/types.d.ts | 8 +- frontend/src/ts/ui.ts | 15 + frontend/src/ts/utils/async-modules.ts | 29 + frontend/src/ts/utils/skeleton.ts | 4 + frontend/static/themes/dark_note.css | 2 +- 25 files changed, 930 insertions(+), 1077 deletions(-) create mode 100644 frontend/src/ts/commandline/commandline.ts delete mode 100644 frontend/src/ts/commandline/index.ts rename frontend/src/ts/commandline/{commands.ts => lists.ts} (79%) create mode 100644 frontend/src/ts/event-handlers/footer.ts create mode 100644 frontend/src/ts/event-handlers/global.ts create mode 100644 frontend/src/ts/event-handlers/keymap.ts create mode 100644 frontend/src/ts/event-handlers/popups.ts create mode 100644 frontend/src/ts/event-handlers/test.ts create mode 100644 frontend/src/ts/utils/async-modules.ts diff --git a/frontend/src/html/popups.html b/frontend/src/html/popups.html index 3dcee1756..90cf55c9b 100644 --- a/frontend/src/html/popups.html +++ b/frontend/src/html/popups.html @@ -1095,8 +1095,8 @@ -