Sigil
- Package
- purescript-sigil
- Repository
- afcondon/purescript-sigil
purescript-sigil — Typographic rendering for type signatures (HTML + SVG).
Re-exports the public API.
Re-exports from Sigil.Color
#isEffectName Source
isEffectName :: String -> BooleanRe-exports from Sigil.Html
#renderTypeSynonymInto Source
renderTypeSynonymInto :: String -> { body :: RenderType, name :: String, typeParams :: Array String } -> Effect UnitRender a type synonym into a container element.
#renderTypeSynonym Source
renderTypeSynonym :: { body :: RenderType, name :: String, typeParams :: Array String } -> StringRender a type synonym to an HTML string. Shows header (type + name + type params), then = body.
#renderSignetInto Source
renderSignetInto :: String -> { ast :: RenderType } -> Effect UnitRender a signet into a container element.
#renderSignet Source
renderSignet :: { ast :: RenderType } -> StringRender a signet (dots with rotated identifier labels) to HTML. Same dot layout as the siglet, but each dot has a 45-degree rotated label beneath it showing the type identifier name.
#renderSignatureInto Source
renderSignatureInto :: String -> { ast :: RenderType, className :: Maybe String, name :: String, typeParams :: Array String } -> Effect UnitRender a full-size signature into a container element.
#renderSignature Source
renderSignature :: { ast :: RenderType, className :: Maybe String, name :: String, typeParams :: Array String } -> StringRender a full-size type signature to an HTML string. Uses Swiss typographic layout: preamble (∀ left, constraints right), declaration (name ::), body (indented with left rule).
#renderSigletInto Source
renderSigletInto :: String -> { ast :: RenderType } -> Effect UnitRender a siglet into a container element.
#renderSiglet Source
renderSiglet :: { ast :: RenderType } -> StringRender a siglet (miniature signature) to HTML. Constrained type variables get pill style; unconstrained get colored text.
#renderForeignImportInto Source
renderForeignImportInto :: String -> { ast :: RenderType, name :: String } -> Effect UnitRender a foreign import into a container element.
#renderForeignImport Source
renderForeignImport :: { ast :: RenderType, name :: String } -> StringRender a foreign import to an HTML string. Shows header (foreign import + name), then :: body with preamble.
#renderDataDecl Source
renderDataDecl :: { constructors :: Array { args :: Array RenderType, name :: String }, keyword :: Maybe String, name :: String, typeParams :: Array String } -> StringRender a data/newtype declaration to an HTML string. Shows header (keyword + name + type params), then constructor branches in a rail layout, or an opaque indicator if no constructors.
#renderClassDeclInto Source
renderClassDeclInto :: String -> { methods :: Array { ast :: Maybe RenderType, name :: String }, name :: String, superclasses :: Array SuperclassInfo, typeParams :: Array String } -> Effect UnitRender a class declaration into a container element.
#renderClassDecl Source
renderClassDecl :: { methods :: Array { ast :: Maybe RenderType, name :: String }, name :: String, superclasses :: Array SuperclassInfo, typeParams :: Array String } -> StringRender a type class definition to an HTML string. Shows header (class + name + type params), superclass row, own methods, and inherited methods grouped by superclass.
#renderBodyInto Source
renderBodyInto :: String -> { ast :: RenderType } -> Effect UnitRender a sigil body (no header) into a container element.
#renderBody Source
renderBody :: { ast :: RenderType } -> StringRender the sigil body only (no name header, no ::) to HTML. Used for inline rendering in value cells when there's enough space. Still shows preamble (quantifier + constraints) if present.
#peelSignature Source
peelSignature :: RenderType -> PeeledSigPeel outermost forall quantifiers and constraints from the AST. Nested foralls/constraints (rank-N, inside parens) are left intact.
#escapeHtml Source
escapeHtml :: String -> StringEscape HTML special characters.
Re-exports from Sigil.Parse
#parseToRenderType Source
parseToRenderType :: String -> Maybe RenderTypeParse a type signature string to RenderType. Sanitizes loader artifacts (e.g. trailing comma before row variable) before parsing.
#extractCtorRenderTypes Source
extractCtorRenderTypes :: String -> Array RenderTypeExtract constructor argument types as RenderType values. Constructor sigs look like "a -> b -> MyType a b" — returns [TVar "a", TVar "b"].
#extractCtorArgs Source
extractCtorArgs :: String -> Array StringExtract constructor argument types from a constructor signature string. Constructor sigs look like "a -> b -> MyType a b" — returns ["a", "b"] as text.
#elideAST Source
elideAST :: RenderType -> RenderTypePrepare AST for siglet rendering.
Preserves record/row structure (with elided field types) so the siglet
renderer can show { ○ ○ ○ } notation. Forall, constraints, and parens
are kept. Normalizes Record (row) application to TRecord.
Re-exports from Sigil.Svg.Attrs
#SvgPrimitive Source
type SvgPrimitive = { attrs :: Array { key :: String, value :: String }, children :: Array LayoutNode, tag :: String, textContent :: Maybe String }#fontFamily Source
fontFamily :: StringRe-exports from Sigil.Svg.Emit
#renderClassDeclIntoSvg Source
renderClassDeclIntoSvg :: String -> { methods :: Array { ast :: Maybe RenderType, name :: String }, name :: String, superclasses :: Array SuperclassInfo, typeParams :: Array String } -> Effect UnitRender a class definition into a DOM element selected by CSS selector.
#emit Source
emit :: LayoutNode -> Dimensions -> Effect ElementEmit a layout tree as a detached SVG element with the given dimensions.
Re-exports from Sigil.Svg.Layout.ADT
#layoutADT Source
layoutADT :: { constructors :: Array { args :: Array RenderType, name :: String }, keyword :: Maybe String, name :: String, typeParams :: Array String } -> { dimensions :: Dimensions, layout :: LayoutNode }Lay out a data type with constructor branches.
Re-exports from Sigil.Svg.Layout.ClassDef
#layoutClassDef Source
layoutClassDef :: { methods :: Array { ast :: Maybe RenderType, name :: String }, name :: String, superclasses :: Array SuperclassInfo, typeParams :: Array String } -> { dimensions :: Dimensions, layout :: LayoutNode }Lay out a type class definition.
Re-exports from Sigil.Svg.Layout.Siglet
#layoutSiglet Source
layoutSiglet :: { ast :: RenderType, maxHeight :: Number, maxWidth :: Number } -> Maybe { layout :: LayoutNode, scaledHeight :: Number, scaledWidth :: Number }Lay out a siglet (elided miniature type signature). TCon names render as small circles; TVar pills keep colors. Layout mirrors the full-size sigil: constraint pile above, body middle, forall row below. Returns Nothing if the type can't fit.
Re-exports from Sigil.Svg.Layout.Signature
#layoutSignature Source
layoutSignature :: { ast :: RenderType, className :: Maybe String, name :: String, sig :: String, typeParams :: Array String } -> { dimensions :: Dimensions, layout :: LayoutNode }Lay out a value/type-synonym signature.
Re-exports from Sigil.Svg.Layout.Sparkline
#layoutSparkline Source
layoutSparkline :: { ast :: RenderType, maxHeight :: Number, maxScale :: Maybe Number, maxWidth :: Number } -> Maybe { layout :: LayoutNode, scaledHeight :: Number, scaledWidth :: Number }Lay out a sparkline miniature.
Re-exports from Sigil.Svg.Measure
#measure Source
measure :: RenderContext -> RenderType -> DimensionsMeasure a RenderType node's dimensions.
Re-exports from Sigil.Svg.Types
#RenderResult Source
type RenderResult = { nodes :: Array LayoutNode, width :: Number }Internal result from node-level layout: positioned nodes + consumed width.
#LayoutNode Source
data LayoutNodeA positioned SVG primitive. The entire layout pipeline produces these;
only Emit touches the DOM.
Constructors
LText { fontSize :: Number, style :: String, text :: String, x :: Number, y :: Number }LRect { height :: Number, rx :: Number, style :: String, width :: Number, x :: Number, y :: Number }LLine { stroke :: String, strokeDasharray :: String, strokeLinecap :: String, strokeWidth :: Number, x1 :: Number, x2 :: Number, y1 :: Number, y2 :: Number }LCircle { cx :: Number, cy :: Number, fill :: String, r :: Number, stroke :: String, strokeWidth :: Number }LGroup { children :: Array LayoutNode, transform :: String }
#Dimensions Source
type Dimensions = { height :: Number, width :: Number }Re-exports from Sigil.Text
#renderTypeToText Source
renderTypeToText :: RenderType -> StringRender a RenderType back to plain text.
#collectTypeVars Source
collectTypeVars :: RenderType -> Set StringCollect all type variable names from a RenderType.
#collectForallVars Source
collectForallVars :: RenderType -> Array StringCollect all forall-quantified variable names (including nested foralls).
#collectArrowParams Source
collectArrowParams :: RenderType -> Array RenderTypeCollect all params of an arrow chain (including return type at end).
Re-exports from Sigil.Types
#SuperclassInfo Source
type SuperclassInfo = { methods :: Array { ast :: Maybe RenderType, name :: String }, name :: String }Superclass info for class definition rendering. Contains the class name and its required methods with optional parsed types.
#RowField Source
type RowField = { label :: String, value :: RenderType }#RenderType Source
data RenderTypeConstructors
TVar StringTCon StringTApp RenderType (Array RenderType)TArrow RenderType RenderTypeTConstrained (Array Constraint) RenderTypeTForall (Array String) RenderTypeTRecord (Array RowField) (Maybe String)TRow (Array RowField) (Maybe String)TParens RenderTypeTKinded RenderType RenderTypeTString StringTWildcardTOperator RenderType String RenderType
#Constraint Source
type Constraint = { args :: Array RenderType, className :: String }