Laszlo,
What is not entirely clear is what it means by “send an action back up to its parent”. Suppose I have 2 Elm files: GUI.elm and Select.elm, and GUI.elm implements 2 components, which are defined in Select.elm. This is similar to a pair of counters from Elm Architecture Tutorial (
https://github.com/evancz/elm-architecture-tutorial/#example-2-a-pair-of-counters).
Select.elm contains three HTML elements: a <select> tag (list of items), an <input> to add new items, and add <button>. In other words, instead of a pair of counters, as in Elm Architecture Tutorial, I have a pair of lists of items.
The first list (pane) is list of players. The second list is a list of possible moves in a game. What this mean doesn't matter, the point is, I can add new players, and in the second pane I can add new actions for a player.
The second list changes, when you select different players. Different players have different actions. So ever time I select a player from the left pane, the list of actions is changed in the right pane.
Now how do I do that? If Select.elm has a model:
{ options : List String, selected : Maybe Int, inputField : String }
than I know how to update this Select.elm-local model - by using its local update function. But how do I tell GUI.elm to update its model of all players and actions to update correctly, once I add a new player or action? Suppose GUI.elm's model is:
{ game : { players : List String, actions : Dict String (List String) }
, playerPane : Select.Model
, actionPane : Select.Model
} ---- where Select.Model is the previous model