diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index dfcf031..da1a408 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,7 +25,7 @@ jobs: matrix: version: - '1' - - '1.9' + - 'lts' os: - ubuntu-latest - windows-latest diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f130a4d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +This file contains the changelog for the PlutoExtras package. It follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format. + +## [Unreleased] +Changelog was introduced in this version. Only changes w.r.t. version v0.7.14 are listed + +### Added +- Added an option to the `@NTBond` macro to provide a function as third argument which is applied via `PlutoUI.Experimental.transformed_value` to the bond resulting from the `@NTBond` macro. +- Added a new exported type `StructBondSelect` to the module `StructBondModule` which simplifies creating a widget whose value may have different number of fields/parameters depending on a dropdown selector. +- The package now re-exports the names exported by its `StructBondModule` submodule. \ No newline at end of file diff --git a/Project.toml b/Project.toml index ad0fb73..e1f3584 100644 --- a/Project.toml +++ b/Project.toml @@ -22,4 +22,4 @@ Markdown = "1" PlutoUI = "0.7.51" REPL = "1" Random = "1" -julia = "1.9" +julia = "1.10" diff --git a/docs/src/structbond.md b/docs/src/structbond.md index 4b4cb5d..d5dd8f2 100644 --- a/docs/src/structbond.md +++ b/docs/src/structbond.md @@ -37,6 +37,25 @@ The macro simply create a [`StructBond`](@ref) wrapping the desired NamedTuple t ``` +## StructBondSelect +Sometimes, one wants to create a more complex binding where the number of parameters to control a bond can vary depending on some other variable. The `StructBondSelect` can be of help in some of these cases, by providing a way to select out of a number of arbitrary `StructBonds` (which include `@NTBond`) by using a dropdown to select the one to be displayed and used for generating the `StructBondSelect` widget's output. + +This structure can be constructed with a vector of `StructBond` or `transformed_value(f, ::StructBond)` elements, and will take care of generating an appropriate widget to display and process only the selected one. + +The main signature of the constructor is the following: +```julia +StructBondSelect(els::Vector; description = "StructBondSelect", default_idx = 1, selector_text = "Selector") +``` + +The names to select upon will be taken from the `description` of the provided `StructBonds`, while the text displayed next to the _selector_ will default to `Selector` but can be customized with the `selector_text` kwarg to the constructor. +The `description` kwarg can be used to customize the text in the widget container (similar to the same kwarg in `StructBond` and to `@NTBond`). Finally, the `default_idx` should be an integer and will select which of the provided `StructBond`s will be selected as default when instantiating the widget. + +```@raw html + +``` + ## @BondsList In some cases, one does not want to have a single bond wrapping either a Structure or a NamedTuple because single independent bonds are more convenient. diff --git a/html_exports/test_bondstable.jl.html b/html_exports/test_bondstable.jl.html index f8ec184..44ed124 100755 --- a/html_exports/test_bondstable.jl.html +++ b/html_exports/test_bondstable.jl.html @@ -1,15 +1,17 @@
- -