[{"name":"Webbhuset.Actor","comment":"\n\n# Actor\n\nWhen a component is incorporated in a system it becomes an Actor. The actor module\nimplements the connections to the other components in the system.\nIn practice that means mapping and sending the component's out messages to other\nactors in the system.\n\nHere is an example of wrapping a login form component to an actor in a system.\n\n\nThis is the global model for the System:\n```\nmodule AppModel exposing (..)\n\ntype AppModel\n    = LoginFormModel LoginForm.Model\n    | OtherComponent ...\n```\n\nThis is the global appMsg type for the System:\n```\nmodule AppMsg exposing (..)\n\ntype AppMsg\n    = FormMsg LoginForm.MsgIn\n    | AuthServiceMsg AuthService.MsgIn\n    | OtherComponent ...\n\n```\n\nThis is the login form actor:\n```\nmodule Actor.LoginForm exposing (..)\n\nimport Webbhuset.ActorSystem as System\nimport Webbhuset.Actor as Actor exposing (Actor)\nimport Component.LoginForm as LoginForm\nimport Component.AuthService as AuthService\nimport AppMsg exposing (AppMsg)\nimport AppModel exposing (AppModel)\n\n\nactor : Actor LoginForm.Model AppModel AppMsg\nactor =\n    Actor.fromUI\n        { wrapModel = AppModel.LoginFormModel\n        , wrapMsg = AppMsg.FormMsg\n        , mapIn = mapFormIn\n        , mapOut = mapFormOut\n        }\n        LoginForm.component\n\n\nmapFormIn : AppMsg -> Maybe LoginForm.MsgIn\nmapFormIn appMsg =\n    case appMsg of\n        AppMsg.FormMsg formMsg ->\n            Just formMsg\n\n        _ ->\n            Nothing\n\n\nmapFormOut : PID -> LoginForm.MsgOut -> System.SysMsg name AppMsg\nmapFormOut self formMsg =\n    case formMsg of\n        LoginForm.Submit user password ->\n            AuthService.Login user password self\n                |> AppMsg.AuthServiceMsg\n                |> System.toAppMsg\n                |> System.sendToSingleton AuthService\n\n```\n\n@docs PID\n\n## Create Actors from Components\n\n@docs fromUI, fromService, fromLayout\n\n## Bootstrap\n\n@docs Actor\n\n","unions":[],"aliases":[{"name":"Actor","comment":" An actor is acomponent where the types are wrapped\nto fit the System types.\n\n","args":["compModel","appModel","msg"],"type":"{ init : Webbhuset.Actor.PID -> ( appModel, msg ), update : compModel -> msg -> Webbhuset.Actor.PID -> ( appModel, msg ), view : compModel -> Webbhuset.Actor.PID -> (Webbhuset.Actor.PID -> Html.Html msg) -> Html.Html msg, kill : compModel -> Webbhuset.Actor.PID -> msg, subs : compModel -> Webbhuset.Actor.PID -> Platform.Sub.Sub msg }"},{"name":"PID","comment":" A PID is an identifier for a Process.\n\n","args":[],"type":"Webbhuset.Internal.PID.PID"}],"values":[{"name":"fromLayout","comment":" Create an actor from a Layout Component\n\n","type":"{ wrapModel : compModel -> appModel, wrapMsg : msgIn -> appMsg, mapIn : appMsg -> Maybe.Maybe msgIn, mapOut : Webbhuset.Actor.PID -> msgOut -> Webbhuset.Actor.SysMsg name appMsg } -> Webbhuset.Component.Layout compModel msgIn msgOut (Webbhuset.Actor.SysMsg name appMsg) -> Webbhuset.Actor.Actor compModel appModel (Webbhuset.Actor.SysMsg name appMsg)"},{"name":"fromService","comment":" Create an actor from a Service Component\n\n","type":"{ wrapModel : compModel -> appModel, wrapMsg : msgIn -> appMsg, mapIn : appMsg -> Maybe.Maybe msgIn, mapOut : Webbhuset.Actor.PID -> msgOut -> Webbhuset.Actor.SysMsg name appMsg } -> Webbhuset.Component.Service compModel msgIn msgOut -> Webbhuset.Actor.Actor compModel appModel (Webbhuset.Actor.SysMsg name appMsg)"},{"name":"fromUI","comment":" Create an actor from a UI Component\n\n\n","type":"{ wrapModel : compModel -> appModel, wrapMsg : msgIn -> appMsg, mapIn : appMsg -> Maybe.Maybe msgIn, mapOut : Webbhuset.Actor.PID -> msgOut -> Webbhuset.Actor.SysMsg name appMsg } -> Webbhuset.Component.UI compModel msgIn msgOut -> Webbhuset.Actor.Actor compModel appModel (Webbhuset.Actor.SysMsg name appMsg)"}],"binops":[]},{"name":"Webbhuset.ActorSystem","comment":"\n\n@docs PID\n\n## Build and Initialize the System\n\n@docs element\n    , application\n\n## System Messages\n\nUse these to send messages between actors in your system.\n\n@docs none\n    , batch\n    , kill\n    , toAppMsg\n    , sendToPID\n    , sendToSingleton\n    , spawn\n    , spawnSingleton\n    , addView\n\n## Bootstrap\n\nDon't worry about these for now.\n\n@docs AppliedActor\n    , Model\n    , SysMsg\n    , applyModel\n","unions":[{"name":"AppliedActor","comment":" An actor after the model has been applied\n\n","args":["appModel","msg"],"cases":[]},{"name":"Model","comment":" The Global Model\n\n","args":["name","appModel"],"cases":[]}],"aliases":[{"name":"PID","comment":" A PID is an identifier for a Process.\n\n","args":[],"type":"Webbhuset.Internal.PID.PID"},{"name":"SysMsg","comment":" Your Elm Program will have this as its Msg type.\n\n","args":["name","appMsg"],"type":"Webbhuset.Internal.Msg.Msg name appMsg"}],"values":[{"name":"addView","comment":" Add a process to the global output.\n\n","type":"Webbhuset.ActorSystem.PID -> Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"application","comment":" Create a [Browser.application] from your Actor System\n\n[Browser.application]: https://package.elm-lang.org/packages/elm/browser/latest/Browser#application\n\n","type":"{ init : flags -> Url.Url -> Browser.Navigation.Key -> Webbhuset.ActorSystem.SysMsg name appMsg, spawn : name -> Webbhuset.ActorSystem.PID -> ( appModel, Webbhuset.ActorSystem.SysMsg name appMsg ), apply : appModel -> Webbhuset.ActorSystem.AppliedActor appModel (Webbhuset.ActorSystem.SysMsg name appMsg), onUrlRequest : Browser.UrlRequest -> Webbhuset.ActorSystem.SysMsg name appMsg, onUrlChange : Url.Url -> Webbhuset.ActorSystem.SysMsg name appMsg } -> Platform.Program flags (Webbhuset.ActorSystem.Model name appModel) (Webbhuset.ActorSystem.SysMsg name appMsg)"},{"name":"applyModel","comment":" Apply the compModel to an actor.\n\n","type":"Webbhuset.Actor.Actor compModel appModel msg -> compModel -> Webbhuset.ActorSystem.AppliedActor appModel msg"},{"name":"batch","comment":" Batch control messages\n\nSimilar concept to `Cmd.batch`\n","type":"List.List (Webbhuset.ActorSystem.SysMsg name appMsg) -> Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"element","comment":" Create a [Browser.element] from your Actor System\n\n[Browser.element]: https://package.elm-lang.org/packages/elm/browser/latest/Browser#element\n\n","type":"{ init : flags -> Webbhuset.ActorSystem.SysMsg name appMsg, spawn : name -> Webbhuset.ActorSystem.PID -> ( appModel, Webbhuset.ActorSystem.SysMsg name appMsg ), apply : appModel -> Webbhuset.ActorSystem.AppliedActor appModel (Webbhuset.ActorSystem.SysMsg name appMsg) } -> Platform.Program flags (Webbhuset.ActorSystem.Model name appModel) (Webbhuset.ActorSystem.SysMsg name appMsg)"},{"name":"kill","comment":" Kill a process\n\n","type":"Webbhuset.ActorSystem.PID -> Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"none","comment":" Don't send anything.\n\nSimilar concept to `Cmd.none`\n","type":"Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"sendToPID","comment":" Send a message to a Process\n\n","type":"Webbhuset.ActorSystem.PID -> Webbhuset.ActorSystem.SysMsg name appMsg -> Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"sendToSingleton","comment":" Send a message to a Singleton Process\n\n","type":"name -> Webbhuset.ActorSystem.SysMsg name appMsg -> Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"spawn","comment":" Spawn a process. The PID will be send as a reply msg.\n\n","type":"name -> (Webbhuset.ActorSystem.PID -> Webbhuset.ActorSystem.SysMsg name appMsg) -> Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"spawnSingleton","comment":" Spawn a singleton process.\n\n","type":"name -> Webbhuset.ActorSystem.SysMsg name appMsg"},{"name":"toAppMsg","comment":" Wrapper for you app's msg type\n\n","type":"appMsg -> Webbhuset.ActorSystem.SysMsg name appMsg"}],"binops":[]},{"name":"Webbhuset.Component","comment":"\n\n@docs PID\n\n# Components\n\nA component is a independent part in the system and has a single responsibility. They\ncan not import other components.\n\nComponents are like normal elm programs. They have their own\nmodel, they can do commands and subscriptions. In addition to that\nthey also have out messages.\n\nThis means you will have two `Msg` types: `MsgIn` and `MsgOut`. MsgIn\nis conceptually the same as your normal `Msg` type would be.\n\nMsgOut is a way to \"tell\" the rest of the system that something happened in your component.\n\nFor Example, the msg types for a  login form component could look like this:\n\n    type MsgIn\n        = EmailFieldChanged String\n        | PasswordFieldChanged String\n        | SubmitbuttonClicked\n\n    type MsgOut\n        = FormWasSubmitted\n            { email : String\n            , password : String\n            }\n\nFrom the system's perspective, this is all you need to care about. This\nis the public API for the component.\n\nThe normal output tuple from the `init` and `update` functions are replaced with\na 3-Tuple:\n\n    ( Model, List MsgOut, Cmd MsgIn )\n\n## UI Component\n\nA UI-component is very similar in concept to a Browser.element program.\n\n@docs UI\n\n## Service Component\n\nThe service component does not have any view function. Remember `Platform.worker`?\n\n@docs Service\n\n## Layout Component\n\nA layout component can render other components using their PID as a reference.\nThe difference comparing to a UI component is the view function.\n\n@docs Layout\n\n## Helpers for the output 3-Tuple\n\nThere is no native elm module for a Tuple with three arguments.\n\n@docs mapFirst\n    , mapSecond\n    , mapThird\n    , andThen\n    , addOutMsg\n    , addCmd\n    , toCmd\n    , toCmdWithDelay\n\n## Helper for Queue\n\nSometimes you'd want to put messages in a queue. Maybe your\ncomponent is in a state where it can't process them at this point, eg. an InitState.\n\n@docs Queue\n    , emptyQueue\n    , addToQueue\n    , runQueue\n","unions":[{"name":"Queue","comment":" Store messages in a queue.\n\n","args":["msgIn"],"cases":[]}],"aliases":[{"name":"Layout","comment":" Layout Component Type\n\nThe `view` function of a layout component:\n\n    view : (MsgIn -> msg) -> Model -> (PID -> Html msg) -> Html msg\n    view toSelf model renderPID =\n        div\n            []\n            [ renderPID model.child\n            , button [ onClick (toSelf ButtonWasClicked) ] [ text \"Button!\" ]\n            ]\n\nThe `view` function has three arguments:\n\n- `toSelf` is used to wrap all event-handlers from Html.Events\n- `renderPID` is used to render other components.\n\nAs you can see, the output type of the `view` function is `Html msg`. This is\nnecessary to allow components to be composed. What would the return type be on\n`renderPID` if they were not mapped to the same type?\n","args":["model","msgIn","msgOut","msg"],"type":"{ init : Webbhuset.Component.PID -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ), update : msgIn -> model -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ), view : (msgIn -> msg) -> model -> (Webbhuset.Component.PID -> Html.Html msg) -> Html.Html msg, kill : model -> List.List msgOut, subs : model -> Platform.Sub.Sub msgIn }"},{"name":"PID","comment":" A PID is an identifier for a Process.\n\n","args":[],"type":"Webbhuset.Internal.PID.PID"},{"name":"Service","comment":" Service Component Type\n\n","args":["model","msgIn","msgOut"],"type":"{ init : Webbhuset.Component.PID -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ), update : msgIn -> model -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ), kill : model -> List.List msgOut, subs : model -> Platform.Sub.Sub msgIn }"},{"name":"UI","comment":" UI Component Type\n\n- **init**: Is called everytime the component is instantiated.\n- **update**: When the component recieves a message.\n- **view**: Is called when the app needs to re-render.\n- **kill**: Is called when the component is no longer needed.\n- **subs**: Normal Elm Subscriptions.\n\n","args":["model","msgIn","msgOut"],"type":"{ init : Webbhuset.Component.PID -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ), update : msgIn -> model -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ), view : model -> Html.Html msgIn, kill : model -> List.List msgOut, subs : model -> Platform.Sub.Sub msgIn }"}],"values":[{"name":"addCmd","comment":" Add a Cmd to the output 3-Tuple.\n\n    ( model, [], Cmd.none )\n        |> Component.addCmd cmd\n","type":"Platform.Cmd.Cmd msg -> ( x, y, Platform.Cmd.Cmd msg ) -> ( x, y, Platform.Cmd.Cmd msg )"},{"name":"addOutMsg","comment":" Add an out message to the output 3-Tuple.\n\n    ( model, [], Cmd.none )\n        |> Component.addOutMsg SomeOutMsg\n","type":"msg -> ( x, List.List msg, y ) -> ( x, List.List msg, y )"},{"name":"addToQueue","comment":" Add a msg to the queue\n\n    { model\n        | queue = Component.addToQueue msgIn model.queue\n    }\n","type":"msgIn -> Webbhuset.Component.Queue msgIn -> Webbhuset.Component.Queue msgIn"},{"name":"andThen","comment":" Run a series of updates on the model\n\nThe msgOut's and Cmd's will be composed using `System.batch` and \n`Cmd.batch`.\n\n    ( model, [], Cmd.none )\n        |> Component.andThen doSomethingWithModel\n","type":"(model -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn )) -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ) -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn )"},{"name":"emptyQueue","comment":" Create an Empty Queue\n\n    { model\n        | queue = Component.emptyQueue\n    }\n","type":"Webbhuset.Component.Queue msgIn"},{"name":"mapFirst","comment":" Map the first argument (Model).\n\n","type":"(input -> out) -> ( input, x, y ) -> ( out, x, y )"},{"name":"mapSecond","comment":" Map the second argument (List MsgOut).\n\n","type":"(input -> out) -> ( x, input, y ) -> ( x, out, y )"},{"name":"mapThird","comment":" Map the third argument (Cmd).\n\n","type":"(input -> out) -> ( x, y, input ) -> ( x, y, out )"},{"name":"runQueue","comment":" Run the `update` function on all messages in the queue\nand compose all output.\n\n    ( model, [], Cmd.none )\n        |> Component.runQueue queue update\n","type":"Webbhuset.Component.Queue msgIn -> (msgIn -> model -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn )) -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn ) -> ( model, List.List msgOut, Platform.Cmd.Cmd msgIn )"},{"name":"toCmd","comment":" Convert a msg to Cmd.\n\n","type":"msg -> Platform.Cmd.Cmd msg"},{"name":"toCmdWithDelay","comment":" Convert a msg to Cmd with a timeout in milliseconds.\n\n","type":"Basics.Float -> msg -> Platform.Cmd.Cmd msg"}],"binops":[]},{"name":"Webbhuset.Component.Sandbox","comment":"\n\n# Sandbox\n\nThe sandbox module is helpful when developing components. It lets you\nrun the component using `elm reactor` outside the system and define several test cases.\n\n@docs SandboxProgram\n\n@docs TestCase\n\n## Sandbox UI Components\n\n@docs ui\n\nYou can also use the ui sandbox on a Service component.\nJust add a `view` function.\n\n    { init = service.init\n    , update = service.update\n    , kill = service.kill\n    , subs = service.subs\n    , view = view\n    }\n\n    view : Model -> Html MsgIn\n    view model =\n        Html.text \"Service Component\"\n","unions":[],"aliases":[{"name":"SandboxProgram","comment":" The Program type of your main function.\n\n","args":["model","msgIn"],"type":"Platform.Program () (Webbhuset.Component.Sandbox.Model model msgIn) (Webbhuset.Component.Sandbox.Msg msgIn)"},{"name":"TestCase","comment":" A test case for the Component\n\nEach test case contains a list of in-messages that will be sent to the component\nwhen the sandbox is started.\n","args":["msgIn"],"type":"{ title : String.String, desc : String.String, init : List.List msgIn }"}],"values":[{"name":"ui","comment":" Wrap a component in a sandbox application.\n\nThis will render each test case and log all messages.\nCreate a test file with a `main` function where you declare all\ntest cases.\n\n    import Component.Form as Form\n    import Webbhuset.Component.Sandbox as Sandbox exposing (SandboxProgram)\n\n    main : SandboxProgram Form.Model Form.MsgIn\n    main =\n        Sandbox.ui\n            Form.component\n            \"Form Component\"\n            [ Sandbox.TestCase\n                \"Empty form\"\n                \"Submit-button should be disabled\"\n                [\n                ]\n            , Sandbox.TestCase\n                \"Form with Errors\"\n                \"You should see an error message\"\n                [ Form.ErrorMsg \"Error message\"\n                ]\n            ]\n\n","type":"{ title : String.String, component : Webbhuset.Component.UI model msgIn msgOut, cases : List.List (Webbhuset.Component.Sandbox.TestCase msgIn), stringifyMsgIn : msgIn -> String.String, stringifyMsgOut : msgOut -> String.String } -> Webbhuset.Component.Sandbox.SandboxProgram model msgIn"}],"binops":[]},{"name":"Webbhuset.PID","comment":"\n\n## PID\n\n@docs PID, toString, null\n\n","unions":[],"aliases":[{"name":"PID","comment":" A PID is an identifier for a Process.\n\nA process is an instance of an Actor / Component\n","args":[],"type":"Webbhuset.Internal.PID.PID"}],"values":[{"name":"null","comment":" PID for testing purposes.\n\n","type":"Webbhuset.PID.PID"},{"name":"toString","comment":" Stringify PID\n\nThis is useful when you need to make a unique string id, for example\nto use as html ids.\n\nThe string is unique for the component instance.\n\n","type":"Webbhuset.PID.PID -> String.String"}],"binops":[]},{"name":"Webbhuset.PID.Set","comment":"\n\n## Set of PID\n\nSince PIDs are not comparable they can not be used with the Set in elm/core.\n\nWhen using an event/observer pattern in the actor model it is useful\nto gather PIDs that are observing an event in a Set.\n\n@docs Set\n    , PID\n    , empty\n    , insert\n    , isEmpty\n    , remove\n    , toList\n","unions":[{"name":"Set","comment":" Store PIDs in a Set\n\n","args":[],"cases":[]}],"aliases":[{"name":"PID","comment":" A PID is an identifier for a Process.\n\nA process is an instance of an Actor / Component\n","args":[],"type":"Webbhuset.Internal.PID.PID"}],"values":[{"name":"empty","comment":" Create an empty set\n\n","type":"Webbhuset.PID.Set.Set"},{"name":"insert","comment":" Insert PID in a Set\n\n","type":"Webbhuset.PID.Set.PID -> Webbhuset.PID.Set.Set -> Webbhuset.PID.Set.Set"},{"name":"isEmpty","comment":" Check if a Set is empty.\n\n","type":"Webbhuset.PID.Set.Set -> Basics.Bool"},{"name":"remove","comment":" Remove a PID from a Set\n\n","type":"Webbhuset.PID.Set.PID -> Webbhuset.PID.Set.Set -> Webbhuset.PID.Set.Set"},{"name":"toList","comment":" Get all pids as a List\n\n","type":"Webbhuset.PID.Set.Set -> List.List Webbhuset.PID.Set.PID"}],"binops":[]}]