{-# LANGUAGE OverloadedStrings #-}
module Miso.Flow.Constants
(
errorMessage
, error001, error002, error003, error004, error005, error006, error007
, error008, error009, error010, error011, error012, error013, error014
, error015, error016
, infiniteExtent
, elementSelectionKeys
, AriaLabelConfig (..)
, defaultAriaLabelConfig
, mergeAriaLabelConfig
) where
import Prelude
import Miso.String (MisoString, ms)
import Miso.Flow.Types
errorMessage :: ErrorCode -> MisoString -> MisoString
errorMessage :: MisoString -> MisoString -> MisoString
errorMessage MisoString
code MisoString
arg =
case MisoString
code of
MisoString
"001" -> MisoString
error001
MisoString
"002" -> MisoString
error002
MisoString
"003" -> MisoString -> MisoString
error003 MisoString
arg
MisoString
"004" -> MisoString
error004
MisoString
"005" -> MisoString
error005
MisoString
"006" -> MisoString
error006
MisoString
"007" -> MisoString -> MisoString
error007 MisoString
arg
MisoString
"009" -> MisoString -> MisoString
error009 MisoString
arg
MisoString
"010" -> MisoString
error010
MisoString
"011" -> MisoString -> MisoString
error011 MisoString
arg
MisoString
"012" -> MisoString -> MisoString
error012 MisoString
arg
MisoString
"013" -> MisoString
error013
MisoString
"014" -> MisoString
error014
MisoString
"015" -> MisoString
error015
MisoString
"016" -> MisoString -> MisoString
error016 MisoString
arg
MisoString
_ -> MisoString
"Unknown error code: " MisoString -> MisoString -> MisoString
forall a. Semigroup a => a -> a -> a
<> MisoString
code
error001 :: MisoString
error001 :: MisoString
error001 = MisoString
"Seems like you have not used a FlowProvider as an ancestor."
error002 :: MisoString
error002 :: MisoString
error002 = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"It looks like you've created a new nodeTypes or edgeTypes object. "
, MisoString
"If this wasn't on purpose please define the nodeTypes/edgeTypes "
, MisoString
"outside of the component or memoize them."
]
error003 :: MisoString -> MisoString
error003 :: MisoString -> MisoString
error003 MisoString
nodeType = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Node type \"", MisoString
nodeType, MisoString
"\" not found. Using fallback type \"default\"." ]
error004 :: MisoString
error004 :: MisoString
error004 = MisoString
"The parent container needs a width and a height to render the graph."
error005 :: MisoString
error005 :: MisoString
error005 = MisoString
"Only child nodes can use a parent extent."
error006 :: MisoString
error006 :: MisoString
error006 = MisoString
"Can't create edge. An edge needs a source and a target."
error007 :: MisoString -> MisoString
error007 :: MisoString -> MisoString
error007 MisoString
i = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat [ MisoString
"The old edge with id=", MisoString
i, MisoString
" does not exist." ]
error008 :: HandleType -> Maybe MisoString -> EdgeId -> MisoString
error008 :: HandleType -> Maybe MisoString -> MisoString -> MisoString
error008 HandleType
handleType Maybe MisoString
handleId MisoString
edgeId' = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Couldn't create edge for ", HandleType -> MisoString
handleTypeToText HandleType
handleType
, MisoString
" handle id: \"", MisoString
-> (MisoString -> MisoString) -> Maybe MisoString -> MisoString
forall b a. b -> (a -> b) -> Maybe a -> b
maybe MisoString
"null" MisoString -> MisoString
forall a. a -> a
id Maybe MisoString
handleId
, MisoString
"\", edge id: ", MisoString
edgeId', MisoString
"."
]
error009 :: MisoString -> MisoString
error009 :: MisoString -> MisoString
error009 MisoString
t = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat [ MisoString
"Marker type \"", MisoString
t, MisoString
"\" doesn't exist." ]
error010 :: MisoString
error010 :: MisoString
error010 =
MisoString
"Handle: No node id found. Make sure to only use a Handle inside a custom Node."
error011 :: MisoString -> MisoString
error011 :: MisoString -> MisoString
error011 MisoString
edgeType = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Edge type \"", MisoString
edgeType, MisoString
"\" not found. Using fallback type \"default\"." ]
error012 :: MisoString -> MisoString
error012 :: MisoString -> MisoString
error012 MisoString
i = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Node with id \"", MisoString
i, MisoString
"\" does not exist, it may have been removed. "
, MisoString
"This can happen when a node is deleted before the \"onNodeClick\" "
, MisoString
"handler is called."
]
error013 :: MisoString
error013 :: MisoString
error013 = MisoString
"It seems that you haven't loaded the miso-flow styles."
error014 :: MisoString
error014 :: MisoString
error014 = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"useNodeConnections: No node ID found. Call useNodeConnections inside "
, MisoString
"a custom Node or provide a node ID." ]
error015 :: MisoString
error015 :: MisoString
error015 = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"It seems that you are trying to drag a node that is not initialized. "
, MisoString
"Please use onNodesChange as explained in the docs." ]
error016 :: MisoString -> MisoString
error016 :: MisoString -> MisoString
error016 MisoString
i = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Edge with id \"", MisoString
i, MisoString
"\" does not exist, it may have been removed. "
, MisoString
"This can happen when an edge is deleted before the \"onEdgeClick\" "
, MisoString
"handler is called."
]
infiniteExtent :: CoordinateExtent
infiniteExtent :: CoordinateExtent
infiniteExtent = Double -> Double -> Double -> Double -> CoordinateExtent
CoordinateExtent
(-Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0) (-Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0) (Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0) (Double
1 Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
0)
elementSelectionKeys :: [MisoString]
elementSelectionKeys :: [MisoString]
elementSelectionKeys = [ MisoString
"Enter", MisoString
" ", MisoString
"Escape" ]
data AriaLabelConfig = AriaLabelConfig
{ AriaLabelConfig -> MisoString
ariaNodeDescriptionDefault :: MisoString
, AriaLabelConfig -> MisoString
ariaNodeDescriptionKeyboardDisabled :: MisoString
, AriaLabelConfig -> MisoString -> Double -> Double -> MisoString
ariaNodeLiveMessage :: MisoString -> Double -> Double -> MisoString
, AriaLabelConfig -> MisoString
ariaEdgeDescriptionDefault :: MisoString
, AriaLabelConfig -> MisoString
ariaControlsLabel :: MisoString
, AriaLabelConfig -> MisoString
ariaControlsZoomInLabel :: MisoString
, AriaLabelConfig -> MisoString
ariaControlsZoomOutLabel :: MisoString
, AriaLabelConfig -> MisoString
ariaControlsFitViewLabel :: MisoString
, AriaLabelConfig -> MisoString
ariaControlsInteractiveLabel :: MisoString
, AriaLabelConfig -> MisoString
ariaMinimapLabel :: MisoString
, AriaLabelConfig -> MisoString
ariaHandleLabel :: MisoString
}
defaultAriaLabelConfig :: AriaLabelConfig
defaultAriaLabelConfig :: AriaLabelConfig
defaultAriaLabelConfig = AriaLabelConfig
{ ariaNodeDescriptionDefault :: MisoString
ariaNodeDescriptionDefault = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Press enter or space to select a node. "
, MisoString
"Press delete to remove it and escape to cancel." ]
, ariaNodeDescriptionKeyboardDisabled :: MisoString
ariaNodeDescriptionKeyboardDisabled = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Press enter or space to select a node. "
, MisoString
"You can then use the arrow keys to move the node around. "
, MisoString
"Press delete to remove it and escape to cancel." ]
, ariaNodeLiveMessage :: MisoString -> Double -> Double -> MisoString
ariaNodeLiveMessage = \MisoString
direction Double
x Double
y -> [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Moved selected node ", MisoString
direction
, MisoString
". New position, x: ", Int -> MisoString
forall str. ToMisoString str => str -> MisoString
ms (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round Double
x :: Int)
, MisoString
", y: ", Int -> MisoString
forall str. ToMisoString str => str -> MisoString
ms (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round Double
y :: Int) ]
, ariaEdgeDescriptionDefault :: MisoString
ariaEdgeDescriptionDefault = [MisoString] -> MisoString
forall a. Monoid a => [a] -> a
mconcat
[ MisoString
"Press enter or space to select an edge. "
, MisoString
"You can then press delete to remove it or escape to cancel." ]
, ariaControlsLabel :: MisoString
ariaControlsLabel = MisoString
"Control Panel"
, ariaControlsZoomInLabel :: MisoString
ariaControlsZoomInLabel = MisoString
"Zoom In"
, ariaControlsZoomOutLabel :: MisoString
ariaControlsZoomOutLabel = MisoString
"Zoom Out"
, ariaControlsFitViewLabel :: MisoString
ariaControlsFitViewLabel = MisoString
"Fit View"
, ariaControlsInteractiveLabel :: MisoString
ariaControlsInteractiveLabel = MisoString
"Toggle Interactivity"
, ariaMinimapLabel :: MisoString
ariaMinimapLabel = MisoString
"Mini Map"
, ariaHandleLabel :: MisoString
ariaHandleLabel = MisoString
"Handle"
}
mergeAriaLabelConfig
:: (AriaLabelConfig -> AriaLabelConfig)
-> AriaLabelConfig
mergeAriaLabelConfig :: (AriaLabelConfig -> AriaLabelConfig) -> AriaLabelConfig
mergeAriaLabelConfig AriaLabelConfig -> AriaLabelConfig
override = AriaLabelConfig -> AriaLabelConfig
override AriaLabelConfig
defaultAriaLabelConfig