packages feed

brick-tabular-list 2.0.1.0 → 2.1.0.0

raw patch · 7 files changed

+18/−12 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Brick.Widgets.TabularList.Types: BlankCHRH :: ColHdrRowHdr n
- Brick.Widgets.TabularList.Types: data ColHdrRowHdr n
+ Brick.Widgets.TabularList.Types: newtype ColHdrRowHdr n
- Brick.Widgets.TabularList.Grid: GridRenderers :: (ListFocused -> WidthDeficit -> GridCtxt -> e -> Widget n) -> Maybe (RowHdr n e r) -> Maybe (GridColHdr n) -> ColHdrRowHdr n -> GridRenderers n e r
+ Brick.Widgets.TabularList.Grid: GridRenderers :: (ListFocused -> WidthDeficit -> GridCtxt -> e -> Widget n) -> Maybe (RowHdr n e r) -> Maybe (GridColHdr n) -> Maybe (ColHdrRowHdr n) -> GridRenderers n e r
- Brick.Widgets.TabularList.Grid: [$sel:colHdrRowHdr:GridRenderers] :: GridRenderers n e r -> ColHdrRowHdr n
+ Brick.Widgets.TabularList.Grid: [$sel:colHdrRowHdr:GridRenderers] :: GridRenderers n e r -> Maybe (ColHdrRowHdr n)
- Brick.Widgets.TabularList.Mixed: MixedRenderers :: (ListFocused -> MixedCtxt -> e -> Widget n) -> Maybe (RowHdr n e r) -> Maybe (MixedColHdr n w) -> ColHdrRowHdr n -> MixedRenderers n e w r
+ Brick.Widgets.TabularList.Mixed: MixedRenderers :: (ListFocused -> MixedCtxt -> e -> Widget n) -> Maybe (RowHdr n e r) -> Maybe (MixedColHdr n w) -> Maybe (ColHdrRowHdr n) -> MixedRenderers n e w r
- Brick.Widgets.TabularList.Mixed: [$sel:colHdrRowHdr:MixedRenderers] :: MixedRenderers n e w r -> ColHdrRowHdr n
+ Brick.Widgets.TabularList.Mixed: [$sel:colHdrRowHdr:MixedRenderers] :: MixedRenderers n e w r -> Maybe (ColHdrRowHdr n)

Files

CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for brick-tabular-list +## 2.1.0.0 -- 2023-03-16++* Wrap `ColHdrRowHdr` in `Maybe` for semantic correctness.+* This should be the last version that intentionally introduces brekaing changes due to design decisions.+* After this version, it should take many years before any unexpected breaking change is deemed necessary.+ ## 2.0.1.0 -- 2023-03-14  * Name the single field in `RowHdrCtxt` newtype for semantic correctness.
brick-tabular-list.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: brick-tabular-list-version: 2.0.1.0+version: 2.1.0.0  synopsis: Tabular list widgets for brick. 
demo/GridTabularList.hs view
@@ -157,7 +157,7 @@       _ -> fill ' ' , rowHdr = Just rowHdr , colHdr = Just colHdr-, colHdrRowHdr = CHRH $ \_ _ -> vLimit 1 (fill ' ') <=> hBorder+, colHdrRowHdr = Just $ CHRH $ \_ _ -> vLimit 1 (fill ' ') <=> hBorder }  theList :: LibraryList
demo/MixedTabularList.hs view
@@ -168,7 +168,7 @@           cell = dc         , rowHdr = Just rowHdr         , colHdr = Just colHdr-        , colHdrRowHdr = CHRH $ \_ _ -> vLimit 1 (fill ' ') <=> hBorder+        , colHdrRowHdr = Just $ CHRH $ \_ _ -> vLimit 1 (fill ' ') <=> hBorder         }       , listWidth = 80       }
src/Brick/Widgets/TabularList/Grid.hs view
@@ -98,7 +98,7 @@   cell :: ListFocused -> WidthDeficit -> GridCtxt -> e -> Widget n , rowHdr :: Maybe (RowHdr n e r) , colHdr :: Maybe (GridColHdr n)-, colHdrRowHdr :: ColHdrRowHdr n+, colHdrRowHdr :: Maybe (ColHdrRowHdr n) } deriving Generic  -- | * [Type Variables]("Brick.Widgets.TabularList#g:TypeVariables")@@ -262,8 +262,8 @@         Just (GridColHdr {draw, height=ColHdrH chh}) -> let           col wd c (ColW w) = sz (w, chh) $ draw (LstFcs f) wd $ GColC c $ Sel (c == curCol)           chrw = case r ^. #colHdrRowHdr of-            BlankCHRH -> fill ' '-            CHRH dchrw -> dchrw (LstFcs f) (WdthD rhwd)+            Nothing -> fill ' '+            Just (CHRH chrh) -> chrh (LstFcs f) (WdthD rhwd)           in sz (rhw, chh) chrw <+> renderColumns l vCs col (H chh)       row vCs i f r = let         col wd c (ColW w) = let gc = GrdCtxt (GRowC (Ix i) (Sel f)) $ GColC c $ Sel (c == curCol)
src/Brick/Widgets/TabularList/Mixed.hs view
@@ -88,7 +88,7 @@   cell :: ListFocused -> MixedCtxt -> e -> Widget n , rowHdr :: Maybe (RowHdr n e r) , colHdr :: Maybe (MixedColHdr n w)-, colHdrRowHdr :: ColHdrRowHdr n+, colHdrRowHdr :: Maybe (ColHdrRowHdr n) } deriving Generic  -- | Calculate widths per row kind from visible list rows and the width available after row header.@@ -140,8 +140,8 @@         Just (MixedColHdr {draw, widths, height=ColHdrH chh}) -> let           col ci (ColW w) = sz (w, chh) $ draw (LstFcs f) (MColC ci)           chrw = case r ^. #colHdrRowHdr of-            BlankCHRH -> fill ' '-            CHRH chrw -> chrw (LstFcs f) (WdthD rhwd)+            Nothing -> fill ' '+            Just (CHRH chrw) -> chrw (LstFcs f) (WdthD rhwd)           in sz (rhw, chh) chrw <+> hBox (zipWith col [Ix 0..] $ widths wprk)       row wprk i f r = let         col ci (ColW w) = sz (w, iH) $ cell (LstFcs f) (MxdCtxt (MRowC (Ix i) (Sel f)) $ MColC ci) r
src/Brick/Widgets/TabularList/Types.hs view
@@ -93,6 +93,6 @@  -- | The renderer for column header row header. ----- If row headers and column headers exist and 'ColHdrRowHdr' is 'BlankCHRH', then column header row header is--- filled with empty space. 'ColHdrRowHdr' merely allows you to customize column header row header.-data ColHdrRowHdr n = BlankCHRH | CHRH (ListFocused -> WidthDeficit -> Widget n) deriving Generic+-- If row headers and column headers exist and 'ColHdrRowHdr' doesn't exist, then column header row header is filled+-- with empty space. 'ColHdrRowHdr' merely allows you to customize column header row header.+newtype ColHdrRowHdr n = CHRH (ListFocused -> WidthDeficit -> Widget n) deriving Generic