packages feed

nano-ui-0.2.0.0: nano-ui.cabal

cabal-version:      3.4
name:               nano-ui
version:            0.2.0.0
synopsis:           Immediate-mode GUI toolkit for Haskell
description:
    Widgets, layout, and input handling for immediate-mode interfaces. A view
    is a function that runs every frame, and widgets return what the user did.
    Pair it with a window backend such as nano-ui-sdl or nano-ui-rgfw.
license:            MIT
license-file:       LICENSE
author:             goolord
maintainer:         zacharyachurchill@gmail.com
homepage:           https://github.com/goolord/nano-ui
bug-reports:        https://github.com/goolord/nano-ui/issues
category:           Graphics
build-type:         Simple
tested-with:        GHC ==9.10.3 || ==9.14.1
extra-doc-files:
    CHANGELOG.md
    GUIDE.md
    README.md

source-repository head
    type:     git
    location: https://github.com/goolord/nano-ui.git
    subdir:   packages/nano-ui

common extensions
    default-language: GHC2024
    default-extensions:
        DuplicateRecordFields
        MagicHash
        OverloadedStrings
        UnboxedTuples

common rts-options
    ghc-options:
        -rtsopts
        -threaded
        "-with-rtsopts=-N1 -A64m -T -I0"

common test-rts-options
    ghc-options: -rtsopts -threaded "-with-rtsopts=-A8m -H64m -K128m -T"

common warnings
    ghc-options:
        -Wall
        -Wextra
        -Wcompat
        -Widentities
        -Wincomplete-record-updates
        -Wincomplete-uni-patterns
        -Wmissing-export-lists
        -Wmissing-home-modules
        -Wpartial-fields
        -Wredundant-constraints
        -Wunused-packages

-- Tests, benchmarks and executables build against the library.
common downstream
    import:           extensions
    import:           warnings
    build-depends:
        base >=4.20 && <4.23,
        nano-ui

library
    import:           extensions
    import:           warnings
    -- The public API is every exposed module outside NanoUI.Internal. The
    -- exposed NanoUI.Internal modules are for backends, tests and tools that
    -- need more than the API, and change without notice.
    exposed-modules:
        NanoUI
        NanoUI.Adornment
        NanoUI.Backend
        NanoUI.Bidi
        NanoUI.Chrome
        NanoUI.Effectful
        NanoUI.Input
        NanoUI.Monad
        NanoUI.Path
        NanoUI.Runner
        NanoUI.Runner.Windows
        NanoUI.Shader.Raw
        NanoUI.Shortcut
        NanoUI.Svg
        NanoUI.Testing
        NanoUI.Testing.Assert
        NanoUI.Testing.Harness
        NanoUI.Testing.Runner
        NanoUI.Testing.Sim
        NanoUI.Themes
        NanoUI.Var
        NanoUI.Widgets.Combo
        NanoUI.Widgets.Custom
        NanoUI.Widgets.PaneGrid
        NanoUI.Widgets.RichText
        NanoUI.Widgets.TextArea
        NanoUI.Widgets.TextBuffer
        NanoUI.Widgets.TextCommand
        NanoUI.Widgets.TextDocument
        NanoUI.Widgets.TextEditor
        NanoUI.Widgets.TextField
        NanoUI.Internal.Canvas
        NanoUI.Internal.Context
        NanoUI.Internal.Context.Types
        NanoUI.Internal.Debug
        NanoUI.Internal.Frame.Hit
        NanoUI.Internal.Frame.TextArea
        NanoUI.Internal.Frame.Window
        NanoUI.Internal.Id
        NanoUI.Internal.Id.Cursor
        NanoUI.Internal.Image
        NanoUI.Internal.Input
        NanoUI.Internal.Layout.Arena
        NanoUI.Internal.Layout.Solve
        NanoUI.Internal.Monad
        NanoUI.Internal.Path
        NanoUI.Internal.RichText.Types
        NanoUI.Internal.Shader
        NanoUI.Internal.SIMD
        NanoUI.Internal.Store
        NanoUI.Internal.Store.Types
        NanoUI.Internal.Uniforms
        NanoUI.Internal.Var
        NanoUI.Internal.Var.Cell
        NanoUI.Internal.Var.Generic
        NanoUI.Internal.Var.Types
        NanoUI.Internal.Widgets.Custom
        NanoUI.Internal.Widgets.SplitPane
        NanoUI.Internal.Widgets.TextArea
        NanoUI.Internal.Widgets.TextDocument
    other-modules:
        NanoUI.Internal.Monad.Core
        NanoUI.Internal.Monad.Explain
        NanoUI.Internal.Monad.Focus
        NanoUI.Internal.Monad.Scroll
        NanoUI.Internal.Equality
        NanoUI.Internal.Var.List
        NanoUI.Internal.Var.Map
        NanoUI.Internal.Derived
        NanoUI.Internal.Resource
        NanoUI.Internal.Host
        NanoUI.Internal.BackendSession
        NanoUI.Internal.NativeWindow.Types
        NanoUI.Internal.Sensor.Types
        NanoUI.Internal.TextEditor.Types
        NanoUI.Internal.TextCluster
        NanoUI.Internal.Animatable
        NanoUI.Internal.Animation
        NanoUI.Internal.Atlas
        NanoUI.Internal.Compact
        NanoUI.Internal.Context.Animation
        NanoUI.Internal.Context.Core
        NanoUI.Internal.Context.Drawing
        NanoUI.Internal.Context.Overlay
        NanoUI.Internal.Context.Scroll
        NanoUI.Internal.Damage
        NanoUI.Internal.Draw
        NanoUI.Internal.EffectDriver
        NanoUI.Internal.Font
        NanoUI.Internal.Font.Types
        NanoUI.Internal.GenCache
        NanoUI.Internal.Metrics
        NanoUI.Internal.Frame
        NanoUI.Internal.Frame.Cursor
        NanoUI.Internal.Draw.Arena
        NanoUI.Internal.Draw.Shapes
        NanoUI.Internal.Draw.Types
        NanoUI.Internal.Frame.Input
        NanoUI.Internal.Frame.Chrome
        NanoUI.Internal.Frame.Explain
        NanoUI.Internal.Frame.Paint
        NanoUI.Internal.Frame.Paint.Widgets
        NanoUI.Internal.Frame.Scroll
        NanoUI.Internal.Layout.ScrollGeometry
        NanoUI.Internal.Frame.Select
        NanoUI.Internal.Frame.Node
        NanoUI.Internal.Frame.Spans
        NanoUI.Internal.Frame.SpanArena
        NanoUI.Internal.Frame.TextEdit
        NanoUI.Internal.Frame.TextInput
        NanoUI.Internal.Layout.Arena.Cache
        NanoUI.Internal.Layout.Arena.Query
        NanoUI.Internal.Layout.Arena.Types
        NanoUI.Internal.Layout.Solve.Flex
        NanoUI.Internal.Layout.Solve.Measure
        NanoUI.Internal.Layout.Solve.Position
        NanoUI.Internal.Style
        NanoUI.Internal.Style.Layout
        NanoUI.Internal.Style.Presets
        NanoUI.Internal.Style.Theme
        NanoUI.Internal.StyleBits
        NanoUI.Internal.GridNode
        NanoUI.Internal.Store.Slots
        NanoUI.Internal.Types
        NanoUI.Internal.WidgetText
        NanoUI.Internal.Widgets.Node
        NanoUI.Internal.Widgets.Caption
        NanoUI.Internal.Widgets.Layout
        NanoUI.Internal.Widgets.Tabs
        NanoUI.Internal.Widgets.Radio
        NanoUI.Internal.Widgets.Tree
        NanoUI.Internal.Widgets.ColorPicker
        NanoUI.Internal.Widgets.Cursor
        NanoUI.Internal.Widgets.Drawing
        NanoUI.Internal.Widgets.TextInput
        NanoUI.Internal.Widgets.NumericInput
        NanoUI.Internal.Widgets.Animate
        NanoUI.Internal.Widgets.Overlay
        NanoUI.Internal.Widgets.Popup
        NanoUI.Internal.Widgets.Menu
        NanoUI.Internal.Widgets.Table
        NanoUI.Internal.Widgets.Behavior
        NanoUI.Internal.Widgets.Combinators
        NanoUI.Internal.Widgets.Drop
        NanoUI.Internal.Widgets.Adornment
        NanoUI.Internal.Widgets.Button
        NanoUI.Internal.Widgets.Checkbox
        NanoUI.Internal.Widgets.Disclosure
        NanoUI.Internal.Widgets.Display
        NanoUI.Internal.Widgets.Select
        NanoUI.Internal.Widgets.Slider
        NanoUI.Internal.Widgets.Image
        NanoUI.Internal.Widgets.Sensor
        NanoUI.Internal.Widgets.Shader
        NanoUI.Internal.Shortcut
        NanoUI.Internal.Widgets.Shortcut
        NanoUI.Internal.NativeWindow
        NanoUI.Internal.ChildWindow
        NanoUI.Internal.Tasks
    build-depends:
        base >=4.20 && <4.23,
        bytestring ^>=0.12,
        colonnade ^>=1.2,
        containers >=0.7 && <0.9,
        effectful-core >=2.6 && <2.8,
        exceptions ^>=0.10,
        ghc-compact ^>=0.1,
        hashable ^>=1.5,
        monad-control ^>=1.0,
        nano-svg ^>=0.2,
        primitive ^>=0.9,
        text ^>=2.1,
        text-short ^>=0.1.6,
        transformers ^>=0.6,
        transformers-base ^>=0.4,
        unliftio-core ^>=0.2,
        unordered-containers ^>=0.2,
        vector ^>=0.13
    hs-source-dirs:   lib

benchmark nano-ui-id-bench
    import:           downstream
    import:           test-rts-options
    type:             exitcode-stdio-1.0
    main-is:          IdBench.hs
    build-depends:
        tasty-bench ^>=0.4
    hs-source-dirs:   benchmark

test-suite text-buffer-spec
    import:           downstream
    type:             exitcode-stdio-1.0
    main-is:          NanoUI/TextBufferSpec.hs
    build-depends:
        hspec ^>=2.11,
        QuickCheck >=2.15 && <2.19,
        text ^>=2.1
    hs-source-dirs:   test

-- Compiles NanoUI.Internal.StyleBits from the library's source (it imports
-- only base) and checks that the style-index fields of each node type are
-- disjoint and fit in 64 bits.
test-suite style-bits-spec
    import:           extensions
    import:           warnings
    type:             exitcode-stdio-1.0
    main-is:          StyleBitsSpec.hs
    other-modules:    NanoUI.Internal.StyleBits
    ghc-options:      -Wunused-packages
    build-depends:
        base >=4.20 && <4.23
    hs-source-dirs:   test/style-bits lib

test-suite nano-ui-test
    import:           downstream
    import:           test-rts-options
    type:             exitcode-stdio-1.0
    -- Every module of this suite starts with {-# OPTIONS_GHC -O0 #-}. At -O1
    -- the simplifier inlines the library's views into every test view: about
    -- 280 s to compile at -j1, against 20 s at -O0. (-O0 in ghc-options
    -- would do the same, but cabal check warns about it.)
    main-is:          Main.hs
    other-modules:
        BackendApi
        Spec
        TestSupport
        Cases.Animation
        Cases.Atlas
        Cases.Combo
        Cases.Damage
        Cases.DamageProps
        Cases.SimFuzz
        Cases.ApiSmoke
        Cases.Demo
        Cases.Grid
        Cases.HostDraw
        Cases.Keyboard
        Cases.Cache
        Cases.LayoutReuse
        Cases.LayoutProps
        Cases.Runner
        Cases.RichText
        Cases.SIMD
        Cases.Shader
        Cases.Shaping
        Cases.Styling
        Cases.Svg
        Cases.Adornment
        Cases.State
        Cases.Passes
        Cases.Table
        Cases.Modal
        Cases.NoThunks
        Cases.Scroll
        Cases.Select
        Cases.Tabs
        Cases.TextInput
        Cases.NumericInput
        Cases.ContextMenu
        Cases.PointerOwnership
        Cases.PointerRelease
        Cases.CustomWidget
        Cases.Tooltip
        Cases.ViewApi
        Cases.PaneGrid
        Cases.Labels
        Cases.Reorder
        Cases.Window
        Cases.WidgetIdIndex
        Cases.Paths
        Cases.LayoutFlow
        Cases.Images
        Cases.Focus
        Cases.TooltipDelay
        Cases.Visibility
        Cases.Cursors
        Cases.Explain
        Cases.Shortcut
        Cases.Ime
        Cases.PointerExtra
        Cases.Theming
        Cases.NativeWindow
        Cases.Tasks
    build-depends:
        bytestring ^>=0.12,
        containers >=0.7 && <0.9,
        directory ^>=1.3,
        effectful >=2.6 && <2.8,
        hashable ^>=1.5,
        filepath ^>=1.5,
        nothunks ^>=0.3,
        primitive ^>=0.9,
        QuickCheck >=2.15 && <2.19,
        vector ^>=0.13,
        text ^>=2.1
    hs-source-dirs:   test/integration

executable nano-ui-profile
    import:           downstream
    import:           rts-options
    main-is:          Profile.hs
    hs-source-dirs:   examples
    build-depends:
        bytestring ^>=0.12,
        primitive ^>=0.9,
        text ^>=2.1

-- Compile-time verification of optimization invariants (inspection-testing).
-- Assertions fail the build if GHC stops inlining or starts allocating in the
-- checked bindings, converting silent performance regressions into errors.
test-suite nano-ui-inspection
    import:           downstream
    type:             exitcode-stdio-1.0
    main-is:          Inspection.hs
    ghc-options:      -fplugin=Test.Inspection.Plugin
    build-depends:
        containers >=0.7 && <0.9,
        inspection-testing ^>=0.6,
        primitive ^>=0.9,
        vector ^>=0.13,
        text ^>=2.1
    hs-source-dirs:   test/inspection