mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-16 11:26:08 +00:00
Formatting fixes
This commit is contained in:
parent
6a226ce3a7
commit
bcc861ae95
@ -13,7 +13,7 @@ import Data.Singletons.TH
|
||||
-- Widget properties
|
||||
singletons
|
||||
[d|
|
||||
|
||||
|
||||
data Field = ViewModule
|
||||
| ViewName
|
||||
| ModelModule
|
||||
|
@ -89,8 +89,8 @@ import qualified IHaskell.Display.Widgets.Singletons as S
|
||||
import IHaskell.Display.Widgets.Common
|
||||
|
||||
-- Classes from IPython's widget hierarchy. Defined as such to reduce code duplication.
|
||||
type WidgetClass = '[S.ViewModule, S.ViewName, S.ModelModule, S.ModelName, S.MsgThrottle, S.Version,
|
||||
S.DisplayHandler]
|
||||
type WidgetClass = '[S.ViewModule, S.ViewName, S.ModelModule, S.ModelName,
|
||||
S.MsgThrottle, S.Version, S.DisplayHandler]
|
||||
|
||||
type DOMWidgetClass = WidgetClass :++ '[S.Visible, S.CSS, S.DOMClasses, S.Width, S.Height, S.Padding,
|
||||
S.Margin, S.Color, S.BackgroundColor, S.BorderColor, S.BorderWidth,
|
||||
@ -128,7 +128,7 @@ type BoxClass = DOMWidgetClass :++ '[S.Children, S.OverflowX, S.OverflowY, S.Box
|
||||
type SelectionContainerClass = BoxClass :++ '[S.Titles, S.SelectedIndex, S.ChangeHandler]
|
||||
|
||||
-- Types associated with Fields.
|
||||
|
||||
|
||||
type family FieldType (f :: Field) :: * where
|
||||
FieldType S.ViewModule = Text
|
||||
FieldType S.ViewName = Text
|
||||
@ -239,8 +239,9 @@ data WidgetType = ButtonType
|
||||
| TextAreaType
|
||||
| CheckBoxType
|
||||
| ToggleButtonType
|
||||
-- TODO: Add 'Valid' widget
|
||||
| DropdownType
|
||||
|
|
||||
-- TODO: Add 'Valid' widget
|
||||
DropdownType
|
||||
| RadioButtonsType
|
||||
| SelectType
|
||||
| ToggleButtonsType
|
||||
@ -255,8 +256,9 @@ data WidgetType = ButtonType
|
||||
| FloatSliderType
|
||||
| FloatProgressType
|
||||
| FloatRangeSliderType
|
||||
-- TODO: Add Proxy and PlaceProxy
|
||||
| BoxType
|
||||
|
|
||||
-- TODO: Add Proxy and PlaceProxy
|
||||
BoxType
|
||||
| FlexBoxType
|
||||
| AccordionType
|
||||
| TabType
|
||||
@ -290,7 +292,8 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
|
||||
WidgetFields IntSliderType =
|
||||
BoundedIntClass :++
|
||||
'[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor]
|
||||
WidgetFields IntProgressType = BoundedIntClass :++ '[S.Orientation, S.BarStyle]
|
||||
WidgetFields IntProgressType =
|
||||
BoundedIntClass :++ '[S.Orientation, S.BarStyle]
|
||||
WidgetFields IntRangeSliderType =
|
||||
BoundedIntRangeClass :++
|
||||
'[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor]
|
||||
|
@ -97,11 +97,12 @@ instance ToJSON Message where
|
||||
object ["prompt" .= prompt]
|
||||
|
||||
toJSON req@CommOpen{} =
|
||||
object [ "comm_id" .= commUuid req
|
||||
, "target_name" .= commTargetName req
|
||||
, "target_module" .= commTargetModule req
|
||||
, "data" .= commData req
|
||||
]
|
||||
object
|
||||
[ "comm_id" .= commUuid req
|
||||
, "target_name" .= commTargetName req
|
||||
, "target_module" .= commTargetModule req
|
||||
, "data" .= commData req
|
||||
]
|
||||
|
||||
toJSON req@CommData{} =
|
||||
object ["comm_id" .= commUuid req, "data" .= commData req]
|
||||
|
@ -65,8 +65,8 @@ class IHaskellDisplay a where
|
||||
|
||||
-- | Display as an interactive widget.
|
||||
class IHaskellDisplay a => IHaskellWidget a where
|
||||
-- | Target name for this widget. The actual input parameter should be ignored. By default
|
||||
-- evaluate to "ipython.widget", which is used by IPython for its backbone widgets.
|
||||
-- | Target name for this widget. The actual input parameter should be ignored. By default evaluate
|
||||
-- to "ipython.widget", which is used by IPython for its backbone widgets.
|
||||
targetName :: a -> String
|
||||
targetName _ = "ipython.widget"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user