Some updates to 5.0

This commit is contained in:
David Davó 2021-07-01 11:25:21 +02:00
parent 3dd254a4e4
commit cfc3821542
4 changed files with 3 additions and 9 deletions

View File

@ -31,7 +31,6 @@ pattern ViewName = S.SViewName
pattern ModelModule = S.SModelModule
pattern ModelModuleVersion = S.SModelModuleVersion
pattern ModelName = S.SModelName
pattern MsgThrottle = S.SMsgThrottle
pattern DisplayHandler = S.SDisplayHandler
pattern Visible = S.SVisible
pattern CSS = S.SCSS

View File

@ -35,7 +35,6 @@ singletons
| ModelModule
| ModelModuleVersion
| ModelName
| MsgThrottle
| DisplayHandler
| Visible
| CSS

View File

@ -119,7 +119,7 @@ type (a :++ b) = a ++ b
-- Classes from IPython's widget hierarchy. Defined as such to reduce code duplication.
type WidgetClass = ['S.ViewModule, 'S.ViewModuleVersion, 'S.ViewName,
'S.ModelModule, 'S.ModelModuleVersion, 'S.ModelName, 'S.MsgThrottle, 'S.DisplayHandler]
'S.ModelModule, 'S.ModelModuleVersion, 'S.ModelName, '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,
@ -165,7 +165,6 @@ type family FieldType (f :: Field) :: * where
FieldType 'S.ModelModule = Text
FieldType 'S.ModelModuleVersion = Text
FieldType 'S.ModelName = Text
FieldType 'S.MsgThrottle = Integer
FieldType 'S.DisplayHandler = IO ()
FieldType 'S.Visible = Bool
FieldType 'S.CSS = [(Text, Text, Text)]
@ -395,9 +394,6 @@ instance ToPairs (Attr 'S.ModelModuleVersion) where
instance ToPairs (Attr 'S.ModelName) where
toPairs x = ["_model_name" .= toJSON x]
instance ToPairs (Attr 'S.MsgThrottle) where
toPairs x = ["msg_throttle" .= toJSON x]
instance ToPairs (Attr 'S.DisplayHandler) where
toPairs _ = [] -- Not sent to the frontend
@ -657,7 +653,6 @@ defaultControlWidget viewName modelName = (ViewModule =:: "@jupyter-widgets/cont
:& (ModelModule =:: "@jupyter-widgets/controls")
:& (ModelModuleVersion =:: "1.4.0")
:& (ModelName =:: modelName)
:& (MsgThrottle =:+ 3)
:& (DisplayHandler =:: return ())
:& RNil

View File

@ -580,7 +580,8 @@ instance ToJSON Message where
toJSON PublishStatus { executionState = executionState } =
object ["execution_state" .= executionState]
toJSON PublishStream { streamType = streamType, streamContent = content } =
object ["data" .= content, "name" .= streamType]
-- Since 5.0 "data" key was renamed to "text"
object ["text" .= content, "name" .= streamType, "output_type" .= string "stream"]
toJSON r@PublishDisplayData { displayData = datas }
= object
$ case transient r of