packages feed

brick 0.29.1 → 0.30

raw patch · 9 files changed

+89/−57 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Brick.Focus: focusSetCurrent :: (Eq n) => n -> FocusRing n -> FocusRing n
+ Brick.Main: simpleApp :: Widget n -> App s e n
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1hBV a_a1hCv. Lens (Dialog a_a1hBV) (Dialog a_a1hCv) [(String, a_a1hBV)] [(String, a_a1hCv)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1hEm a_a1hEW. Lens (Dialog a_a1hEm) (Dialog a_a1hEW) [(String, a_a1hEm)] [(String, a_a1hEW)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1hBV. Lens' (Dialog a_a1hBV) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1hEm. Lens' (Dialog a_a1hEm) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1hBV. Lens' (Dialog a_a1hBV) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1hEm. Lens' (Dialog a_a1hEm) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1hBV. Lens' (Dialog a_a1hBV) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1hEm. Lens' (Dialog a_a1hEm) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a1jmN n_a1jmO t_a1jnp. Lens (Editor t_a1jmN n_a1jmO) (Editor t_a1jnp n_a1jmO) (TextZipper t_a1jmN) (TextZipper t_a1jnp)
+ Brick.Widgets.Edit: editContentsL :: forall t_a1jpl n_a1jpm t_a1jpX. Lens (Editor t_a1jpl n_a1jpm) (Editor t_a1jpX n_a1jpm) (TextZipper t_a1jpl) (TextZipper t_a1jpX)
- Brick.Widgets.List: listElementsL :: forall n_a1lb3 e_a1lb4 e_a1lkY. Lens (List n_a1lb3 e_a1lb4) (List n_a1lb3 e_a1lkY) (Vector e_a1lb4) (Vector e_a1lkY)
+ Brick.Widgets.List: listElementsL :: forall n_a1ldB e_a1ldC e_a1lo2. Lens (List n_a1ldB e_a1ldC) (List n_a1ldB e_a1lo2) (Vector e_a1ldC) (Vector e_a1lo2)
- Brick.Widgets.List: listItemHeightL :: forall n_a1lb3 e_a1lb4. Lens' (List n_a1lb3 e_a1lb4) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1ldB e_a1ldC. Lens' (List n_a1ldB e_a1ldC) Int
- Brick.Widgets.List: listNameL :: forall n_a1lb3 e_a1lb4 n_a1lkZ. Lens (List n_a1lb3 e_a1lb4) (List n_a1lkZ e_a1lb4) n_a1lb3 n_a1lkZ
+ Brick.Widgets.List: listNameL :: forall n_a1ldB e_a1ldC n_a1lo3. Lens (List n_a1ldB e_a1ldC) (List n_a1lo3 e_a1ldC) n_a1ldB n_a1lo3
- Brick.Widgets.List: listSelectedL :: forall n_a1lb3 e_a1lb4. Lens' (List n_a1lb3 e_a1lb4) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1ldB e_a1ldC. Lens' (List n_a1ldB e_a1ldC) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,14 @@ Brick changelog --------------- +0.30+----++API changes:+ * `Brick.Focus`: added `focusSetCurrent` to make it easy to set the+    focus of a focus ring+ * `Brick.Main`: added a simple polymorphic `App` value, `simpleApp`+ 0.29.1 ------ 
README.md view
@@ -20,8 +20,6 @@ [vty](http://hackage.haskell.org/package/vty), so some knowledge of Vty will be helpful in using this library. -This library deprecates [vty-ui](https://github.com/jtdaugherty/vty-ui).- Example ------- @@ -51,7 +49,7 @@ To get an idea of what some people have done with `brick`, take a look at these projects: - * `tetris`: https://github.com/SamTay/tetris+ * `tetris`, an implementation of the Tetris game: https://github.com/SamTay/tetris  * `gotta-go-fast`, a typing tutor: https://github.com/hot-leaf-juice/gotta-go-fast  * `haskell-player`, an `afplay` frontend: https://github.com/potomak/haskell-player  * `mushu`, an `MPD` client: https://github.com/elaye/mushu@@ -61,16 +59,17 @@  * `silly-joy`, an interpreter for Joy in Haskell: https://github.com/rootmos/silly-joy  * `herms`, a command-line tool for managing kitchen recipes: https://github.com/jackkiefer/herms  * `purebred`, a mail user agent: https://github.com/purebred-mua/purebred+ * `2048Haskell`, an implementation of the 2048 game: https://github.com/8Gitbrix/2048Haskell  Getting Started --------------- -TLDR:+Check out the many demo programs to get a feel for different aspects of+the library:  ```-$ cabal sandbox init-$ cabal install -j -f demos-$ .cabal-sandbox/bin/brick-???-demo+$ cabal new-build -f demos+$ find dist-newstyle -type f -name \*-demo ```  To get started, see the [user guide](https://github.com/jtdaugherty/brick/blob/master/docs/guide.rst).@@ -80,7 +79,7 @@  Documentation for `brick` comes in a variety of forms: -* [The brick user guide](https://github.com/jtdaugherty/brick/blob/master/docs/guide.rst)+* [The official brick user guide](https://github.com/jtdaugherty/brick/blob/master/docs/guide.rst) * [Samuel Tay's brick tutorial](https://github.com/jtdaugherty/brick/blob/master/docs/samtay-tutorial.md) * Haddock (all modules) * [Demo programs](https://github.com/jtdaugherty/brick/blob/master/programs)@@ -122,10 +121,10 @@ ------  There are some places were I have deliberately chosen to worry about-performance later for the sake of spending more time on the design (and-to wait on performance issues to arise first). `brick` is also something-of an experimental project of mine and some aspects of the design-involve trade-offs that may are not entirely settled. In addition you+performance later for the sake of spending more time on the design+(and to wait on performance issues to arise first). `brick` is also+something of an experimental project of mine and some aspects of the+design involve trade-offs that are not entirely settled. In addition you can expect this library to follow a principle of fearless improvement: new versions will make (sometimes substantial) API changes if those changes really do make the library better. I will place more importance
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             0.29.1+version:             0.30 synopsis:            A declarative terminal user interface library description:   Write terminal applications painlessly with 'brick'! You write an
docs/guide.rst view
@@ -50,8 +50,7 @@     $ git clone https://github.com/jtdaugherty/brick.git    $ cd brick-   $ cabal sandbox init-   $ cabal install -j+   $ cabal new-build  Building the Demonstration Programs -----------------------------------@@ -1383,7 +1382,7 @@ or ``mapAttrNames`` to convert its custom names to the names that the sub-widget uses for rendering its output. -.. _vty: https://github.com/coreyoconnor/vty+.. _vty: https://github.com/jtdaugherty/vty .. _Hackage: http://hackage.haskell.org/ .. _microlens: http://hackage.haskell.org/package/microlens .. _bracketed paste mode: https://cirw.in/blog/bracketed-paste
programs/MouseDemo.hs view
@@ -125,7 +125,7 @@      void $ M.customMain buildVty Nothing app $ St [] Nothing            "Press Ctrl-up and Ctrl-down arrow keys to scroll, ESC to quit.\n\-           \Observe the click coordinates identify the\n\+           \Observe that the click coordinates identify the\n\            \underlying widget coordinates.\n\            \\n\            \Lorem ipsum dolor sit amet,\n\
src/Brick.hs view
@@ -1,5 +1,8 @@ -- | This module is provided as a convenience to import the most--- important parts of the API all at once.+-- important parts of the API all at once. Note that the Haddock+-- documentation for this library is for /reference/ usage; if you+-- are looking for an introduction or tutorial, see the README for links+-- to plenty of material! module Brick   ( module Brick.Main   , module Brick.Types
src/Brick/Focus.hs view
@@ -8,6 +8,7 @@   , focusNext   , focusPrev   , focusGetCurrent+  , focusSetCurrent   , focusRingCursor   , withFocusRing   , focusRingModify@@ -66,6 +67,14 @@ -- is emtpy, return 'Nothing'. focusGetCurrent :: FocusRing n -> Maybe n focusGetCurrent (FocusRing l) = C.focus l++-- | Set the currently-focused resource name in the ring, provided the+-- name is in the ring. Otherwise return the ring unmodified.+focusSetCurrent :: (Eq n) => n -> FocusRing n -> FocusRing n+focusSetCurrent n r@(FocusRing l) =+    case C.rotateTo n l of+        Nothing -> r+        Just l' -> FocusRing l'  -- | Modify the internal circular list structure of a focus ring -- directly. This function permits modification of the circular list
src/Brick/Main.hs view
@@ -4,6 +4,7 @@   , customMain   , simpleMain   , resizeOrQuit+  , simpleApp    -- * Event handler functions   , continue@@ -74,6 +75,7 @@ import Brick.Types.Internal import Brick.Widgets.Internal import Brick.AttrMap+import qualified Brick.Widgets.Core as C  -- | The library application abstraction. Your application's operations -- are represented here and passed to one of the various main functions@@ -129,14 +131,24 @@            => Widget n            -- ^ The widget to draw.            -> IO ()-simpleMain w =-    let app = App { appDraw = const [w]-                  , appHandleEvent = resizeOrQuit-                  , appStartEvent = return-                  , appAttrMap = const $ attrMap defAttr []-                  , appChooseCursor = neverShowCursor-                  }-    in defaultMain app ()+simpleMain w = defaultMain (simpleApp w) ()++-- | A simple application with reasonable defaults to be overridden as+-- desired:+--+-- * Draws only the specified widget+-- * Quits on any event other than resizes+-- * Has no start event handler+-- * Provides no attribute map+-- * Never shows any cursors+simpleApp :: Widget n -> App s e n+simpleApp w =+    App { appDraw = const [w]+        , appHandleEvent = resizeOrQuit+        , appStartEvent = return+        , appAttrMap = const $ attrMap defAttr []+        , appChooseCursor = neverShowCursor+        }  -- | An event-handling function which continues execution of the event -- loop only when resize events occur; all other types of events trigger
src/Brick/Themes.hs view
@@ -6,43 +6,45 @@ -- theme customizations in INI-style files. -- -- The file format is as follows:--- * Customization files are INI-style files with two sections, both---   optional: "default" and "other".--- * The "default" section specifies three optional fields:---   * "default.fg" - a color specification---   * "default.bg" - a color specification---   * "default.style" - a style specification--- * A color specification can be any of the values (no quotes)---   "black", "red", "green", "yellow", "blue", "magenta", "cyan",---   "white", "brightBlack", "brightRed", "brightGreen", "brightYellow",---   "brightBlue", "brightMagenta", "brightCyan", or "brightWhite".--- * A style specification can be either one of the following values---   (without quotes) or a comma-delimited list of one or more of the---   following values (e.g. "[bold,underline]") indicating that all of---   the specified styles be used.---   * "standout"---   * "underline"---   * "reverseVideo"---   * "blink"---   * "dim"---   * "bold"--- * The "other" section specifies for each attribute name in the theme---   the same "fg", "bg", and "style" settings as for the default---   attribute. Furthermore, if an attribute name has multiple---   components, the fields in the INI file should use periods as---   delimiters. For example, if a theme has an attribute name ("foo" <>---   "bar"), then the file may specify three fields:---   * "foo.bar.fg" - a color specification---   * "foo.bar.bg" - a color specification---   * "foo.bar.style" - a style specification --+-- Customization files are INI-style files with two sections, both+-- optional: @"default"@ and @"other"@.+--+-- The @"default"@ section specifies three optional fields:+--+--  * @"default.fg"@ - a color specification+--  * @"default.bg"@ - a color specification+--  * @"default.style"@ - a style specification+--+-- A color specification can be any of the strings @black@, @red@,+-- @green@, @yellow@, @blue@, @magenta@, @cyan@, @white@, @brightBlack@,+-- @brightRed@, @brightGreen@, @brightYellow@, @brightBlue@,+-- @brightMagenta@, @brightCyan@, @brightWhite@, or @default@.+--+-- A style specification can be either one of the following values+-- (without quotes) or a comma-delimited list of one or more of the+-- following values (e.g. @"[bold,underline]"@) indicating that all+-- of the specified styles be used. Valid styles are @standout@,+-- @underline@, @reverseVideo@, @blink@, @dim@, and @bold@.+--+-- The @other@ section specifies for each attribute name in the theme+-- the same @fg@, @bg@, and @style@ settings as for the default+-- attribute. Furthermore, if an attribute name has multiple components,+-- the fields in the INI file should use periods as delimiters. For+-- example, if a theme has an attribute name (@"foo" <> "bar"@), then+-- the file may specify three fields:+--+--  * @foo.bar.fg@ - a color specification+--  * @foo.bar.bg@ - a color specification+--  * @foo.bar.style@ - a style specification+-- -- Any color or style specifications omitted from the file mean that -- those attribute or style settings will use the theme's default value -- instead. ----- Attribute names with multiple components (e.g. attr1 <> attr2) can+-- Attribute names with multiple components (e.g. @attr1 <> attr2@) can -- be referenced in customization files by separating the names with--- a dot. For example, the attribute name "list" <> "selected" can be+-- a dot. For example, the attribute name @"list" <> "selected"@ can be -- referenced by using the string "list.selected". module Brick.Themes   ( CustomAttr(..)