@@ -7,8 +7,9 @@ import Data.String.Common (trim)
77import Data.String.Regex (regex , match )
88import Data.String.Regex.Flags (ignoreCase )
99import Data.Either (either )
10+ import Data.List (List (..))
1011import Data.Maybe (Maybe (..), fromMaybe , maybe )
11- import Data.Traversable (traverse )
12+ import Data.Traversable (traverse , for )
1213import Effect (Effect )
1314import Effect.Aff (Aff )
1415import Effect.Class (liftEffect )
@@ -26,8 +27,11 @@ import Web.HTML.Event.EventTypes (message) as ET
2627import Web.Event.EventTarget (addEventListener , eventListener )
2728import Web.MessageEvent as MessageEvent
2829
29- import View.App ( Action (UpdateContext, UpdatePixels) )
30+ import Model ( Box , Selection )
3031import View.App as App
32+ import View.App (Action (UpdateContext, UpdatePixels))
33+ import View.Bricks as Bricks
34+ import View.Term as Term
3135
3236
3337initialPixels :: String
@@ -91,6 +95,26 @@ runJs2 initialInput selector = do
9195
9296-- ------------------------------------------------------------------------------
9397
98+ runBricksComponent :: ∀ q . Bricks.Input -> String -> Aff (Maybe (HalogenIO q Bricks.Output Aff ))
99+ runBricksComponent input selector = do
100+ elemMaybe <- selectElement (QuerySelector selector)
101+ for elemMaybe $ runUI Bricks .bricksView input
102+
103+ toBricksInput :: App.Input -> Box -> Bricks.Input
104+ toBricksInput = App .toBricksInput
105+
106+ -- ------------------------------------------------------------------------------
107+
108+ runTermComponent :: ∀ q . Term.Input -> String -> Aff (Maybe (HalogenIO q Void Aff ))
109+ runTermComponent input selector = do
110+ elemMaybe <- selectElement (QuerySelector selector)
111+ for elemMaybe $ runUI Term .termView input
112+
113+ emptySelection :: Selection
114+ emptySelection = { path: Nil , count: 0 }
115+
116+ -- ------------------------------------------------------------------------------
117+
94118parseHash :: String -> App.Input
95119parseHash hash =
96120 let defaultInput = { pixels: initialPixels, context: initialContext } in
0 commit comments