Release: `svelte-standard` 0.0.21 - Svelte sidebar apps refinement (final?)
Greets @FVTT ▹ Developer. This update provides what should be the final refinement for
FVTTSidebarControl
. Given some initial feedback a few more features have been added. Usually there isn't this much incremental additions so quickly w/ svelte-standard
, but this update really should finalize FVTTSidebarControl
.
The add
, remove
, replace
methods now take an optional condition
field that can be a boolean or function that returns a truthy value to conditionally run the sidebar action. This allows you to add condition: () => game.user.isGM
for instance to only add / replace, etc. the sidebar for GM users.
Another useful new field particularly for replacing core Foundry sidebars is mergeAppImpl
. This allows you to provide the control / model code that implements whatever API the core sidebar app may provide directly in the add
/ replace
data. Instead of augmenting the globalThis.ui.<SIDEBAR ID>
field via FVTTSidebarControl.wait().then()
you can directly include a custom implementation to merge directly in add
/ replace
.
Other small changes include:
- remove
/ replace
methods data fields removeId
/ replaceId
is now just id
. This makes for a little nicer data defined API.
- Enhanced error handling where an error in loading one sidebar will not affect other sidebar actions.
This should provide a final API that meets the needs currently known for Svelte sidebar addition / replacement.1 Reply
A more complete example for replacing the combat tracker is the following:
Implement API from the core
CombatTracker
sidebar app as necessary. Also provide Svelte stores that are updated with combat related data for the Svelte sidebar component. All your control / model code for combats goes here.
./CombatControl.js
: