Add Action Loader Module with Stacking Support and STscript Commands (#5311)

* Add action loader utility with stoppable toast notifications

* Add slash commands for action loader control (/loader-wrap, /loader-show, /loader-hide, /loader-stop)

* Refactor action loader to support stacking multiple loaders with individual toast management

- Convert action loader from singleton to class-based handle system (ActionLoaderHandle)
- Support multiple concurrent loaders with single overlay and stacked toasts
- Add unique ID generation and tracking for each loader instance
- Implement onHide callback alongside existing onStop callback
- Add getActiveLoaderHandles() and getLoaderHandleById() utility functions
- Refactor hideActionLoader() to accept...

* Improve action loader overlay and toast handling with better state checks and cleanup timing

- Check isLoaderDisplayed() before showing overlay to prevent conflicts with existing loaders
- Use toastr.options.hideDuration for toast removal timing instead of hardcoded 250ms
- Simplify hideActionLoader() by using getActiveLoaderHandles() helper
- Remove redundant empty check in hideActionLoader()
- Add clarifying comment for intentional error throw in createClosureHandler()
- Remove redundant 'onStop' default

* fix stop button toast removal issue by using toastr.clear force option instead of manual removal with timeout

* Fix isLoaderDisplayed() by using double negation operator instead of null comparison

* Add non-blocking loader support with `blocking` parameter for toast-only action loaders

- Add `blocking` option to ActionLoaderHandle (default: true)
- Implement hasBlockingLoaders() helper to check for active blocking loaders
- Show/hide overlay only when blocking loaders are active
- Add `blocking` named argument to /loader-wrap and /loader-show commands
- Update help strings with non-blocking usage examples
- Import commonEnumProviders for boolean enum and isFalseBoolean utility

* Add optional title parameter to action loader toast notifications and reorder constructor parameters for consistency

- Add `title` parameter to ActionLoaderOptions and ActionLoaderHandle constructor
- Pass title to toastr.info() for toast notifications
- Reorder parameters: blocking, toastMode, message, title, stopTooltip (grouped by importance)
- Add warning when creating non-blocking loader without toast (invisible to user)
- Update /loader-wrap and /loader-show commands with title argument

* Add loader utility API to action-loader and expose it in ST context for convenient programmatic access

- Create `loader` object with show/hide/active/get methods and ToastMode/Handle exports
- Add JSDoc examples for basic usage, non-blocking tasks, and hiding all loaders
- Import and expose `loader` in ST context alongside existing loader functions

* Split slash command and functional modules

* Create abort controller on app init

* Remove HTML tags from "returns" declaration

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
Wolfsblvt
2026-03-20 00:04:39 +01:00
committed by GitHub
parent bdaadd17dd
commit a6486d7f08
9 changed files with 833 additions and 8 deletions
+24
View File
@@ -29,3 +29,27 @@
align-items: center;
justify-content: center;
}
/* Action loader toast styles */
.action-loader-toast {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
}
.action-loader-message {
flex: 1;
}
.action-loader-stop {
cursor: pointer;
font-size: 1.2em;
opacity: 0.8;
transition: opacity 0.15s ease, color 0.15s ease;
}
.action-loader-stop:hover {
opacity: 1;
color: color-mix(in srgb, currentColor 40%, #e74c3c 60%);
}