~jaro/balkon

74594e80185c479dd7d4b10db0864ff580f3cb1d — Jaro 1 year, 2 months ago 1555a8c
Use internal library to hide non-public modules.
6 files changed, 50 insertions(+), 20 deletions(-)

M balkon.cabal
R src/Data/Text/ParagraphLayout.hs => lib/Data/Text/ParagraphLayout.hs
A lib/Data/Text/ParagraphLayout/Rect.hs
M src/Data/Text/ParagraphLayout/Internal/Fragment.hs
M src/Data/Text/ParagraphLayout/Internal/Plain.hs
R src/Data/Text/ParagraphLayout/{Rect.hs => Internal/Rect.hs}
M balkon.cabal => balkon.cabal +30 -17
@@ 87,34 87,30 @@ common language
common warnings
    ghc-options:      -Wall

-- TODO: Utilise internal libraries
--       (https://cabal.readthedocs.io/en/3.4/cabal-package.html#sublibs)
--       to avoid exposing modules solely for tests.
library
library balkon-internal
    import:           language, warnings

    -- Directories containing source files.
    -- Directories containing source files of the internal library.
    hs-source-dirs:   src

    -- Modules exported by the library.
    -- Modules exported to tests and to the public part of the library.
    exposed-modules:
        Data.Text.ParagraphLayout,
        Data.Text.ParagraphLayout.Internal.Break,
        Data.Text.ParagraphLayout.Internal.Fragment,
        Data.Text.ParagraphLayout.Internal.LineHeight,
        Data.Text.ParagraphLayout.Internal.Plain,
        Data.Text.ParagraphLayout.Internal.ProtoFragment
        Data.Text.ParagraphLayout.Internal.Rect,
        Data.Text.ParagraphLayout.Internal.ResolvedSpan,
        Data.Text.ParagraphLayout.Internal.Run,
        Data.Text.ParagraphLayout.Internal.Script,
        Data.Text.ParagraphLayout.Internal.Span,
        Data.Text.ParagraphLayout.Internal.TextContainer,
        Data.Text.ParagraphLayout.Internal.Zipper,
        Data.Text.ParagraphLayout.Rect
        Data.Text.ParagraphLayout.Internal.Zipper

    -- Modules included in this library but not exported.
    other-modules:    Data.Text.ParagraphLayout.Internal.Script
    -- Modules used purely internally and not in any tests.
    other-modules:
        Data.Text.ParagraphLayout.Internal.ProtoFragment

    -- Other library packages from which modules are imported.
    build-depends:
        base ^>=4.15.1.0,
        harfbuzz-pure ^>=1.0.2.0,


@@ 122,6 118,22 @@ library
        text-icu ^>=0.8.0.2,
        unicode-data-scripts ^>=0.2.0.1

library
    import:           language, warnings

    -- Directories containing source files.
    hs-source-dirs:   lib

    -- Modules exported by the library.
    exposed-modules:
        Data.Text.ParagraphLayout,
        Data.Text.ParagraphLayout.Rect

    -- Other library packages from which modules are imported.
    build-depends:
        base ^>=4.15.1.0,
        balkon-internal

test-suite balkon-test
    import:           language, warnings



@@ 148,16 160,17 @@ test-suite balkon-test

    -- Test dependencies.
    build-depends:
        base ^>=4.15.1.0,
        base,
        balkon,
        balkon-internal,
        bytestring ^>=0.11.4.0,
        filepath ^>=1.4.100.0,
        harfbuzz-pure,
        hspec,
        hspec-discover,
        hspec-golden ^>=0.2.0.0,
        harfbuzz-pure ^>=1.0.2.0,
        text ^>=2.0.1,
        text-icu ^>=0.8.0.2
        text,
        text-icu

    build-tool-depends:
        hspec-discover:hspec-discover

R src/Data/Text/ParagraphLayout.hs => lib/Data/Text/ParagraphLayout.hs +0 -0
A lib/Data/Text/ParagraphLayout/Rect.hs => lib/Data/Text/ParagraphLayout/Rect.hs +17 -0
@@ 0,0 1,17 @@
-- | Representation of an axis-aligned rectangle on a 2D plane, with one of its
-- corners being a designated origin point.
module Data.Text.ParagraphLayout.Rect
    (Rect(Rect, x_origin, y_origin, x_size, y_size)
    ,height
    ,union
    ,width
    ,x_max
    ,x_min
    ,x_terminus
    ,y_max
    ,y_min
    ,y_terminus
    )
where

import Data.Text.ParagraphLayout.Internal.Rect

M src/Data/Text/ParagraphLayout/Internal/Fragment.hs => src/Data/Text/ParagraphLayout/Internal/Fragment.hs +1 -1
@@ 4,7 4,7 @@ where
import Data.Int (Int32)
import Data.Text.Glyphize (GlyphInfo, GlyphPos)

import Data.Text.ParagraphLayout.Rect
import Data.Text.ParagraphLayout.Internal.Rect

-- | Box fragment or fragment (CSS3), except that continuous text even within
-- one line can be split into multiple fragments because of spans or changes in

M src/Data/Text/ParagraphLayout/Internal/Plain.hs => src/Data/Text/ParagraphLayout/Internal/Plain.hs +1 -1
@@ 44,11 44,11 @@ import Data.Text.ParagraphLayout.Internal.Break
import Data.Text.ParagraphLayout.Internal.Fragment
import Data.Text.ParagraphLayout.Internal.LineHeight
import qualified Data.Text.ParagraphLayout.Internal.ProtoFragment as PF
import Data.Text.ParagraphLayout.Internal.Rect
import qualified Data.Text.ParagraphLayout.Internal.ResolvedSpan as RS
import Data.Text.ParagraphLayout.Internal.Run
import Data.Text.ParagraphLayout.Internal.Span
import Data.Text.ParagraphLayout.Internal.TextContainer
import Data.Text.ParagraphLayout.Rect

-- | Text to be laid out as a paragraph.
--

R src/Data/Text/ParagraphLayout/Rect.hs => src/Data/Text/ParagraphLayout/Internal/Rect.hs +1 -1
@@ 1,6 1,6 @@
-- | Representation of an axis-aligned rectangle on a 2D plane, with one of its
-- corners being a designated origin point.
module Data.Text.ParagraphLayout.Rect
module Data.Text.ParagraphLayout.Internal.Rect
    (Rect(Rect, x_origin, y_origin, x_size, y_size)
    ,height
    ,union