[{"name":"VirtualList","comment":" Efficiently displays large lists by **only rendering the visible items** within the viewport, plus a configurable buffer.\n\nIt does so by **dynamically measuring** the height of the displayed elements.\n\nIn case you **know the heights in advance** you might get a better performance by using [`FabienHenon/elm-infinite-list-view`](https://package.elm-lang.org/packages/FabienHenon/elm-infinite-list-view/latest/).\n\n## Usage\n\n### Model Setup\n\nInclude `VirtualList.Model` in your app's **model:**\n\n    import VirtualList\n\n    type alias Model =\n        { virtualList : VirtualList.Model\n        -- other fields\n        }\n\n    defaultModel : Model\n    defaultModel =\n        { virtualList = VirtualList.init\n        -- other fields\n        }\n\n### Update Function\n\nInclude `VirtualList.Msg` in your app’s **update function:**\n\n    type Msg\n        = VirtualListMsg VirtualList.Msg\n        -- other messages\n\n    update : Msg -> Model -> ( Model, Cmd Msg )\n    update msg model =\n        case msg of\n            VirtualListMsg virtualListMsg ->\n                let\n                    ( virtualListModel, virtualListCmd ) =\n                        VirtualList.update virtualListMsg model.virtualList\n                in\n                    ( { model | virtualList = virtualListModel }, Cmd.map VirtualListMsg virtualListCmd )\n            -- other cases\n\n### Rendering\n\nRender the virtual list in your **view:**\n\n    view : Model -> Html Msg\n    view model =\n        VirtualList.view (renderRow model) model.virtualList VirtualListMsg\n\n    renderRow : Model -> String -> Html Msg\n    renderRow model id =\n        div [] [text id]\n\n# Model & Initialization\n\n@docs Model, defaultConfig, init, initWithConfig, Msg, update\n\n# Rendering\n\n@docs view\n\n# Updating the Items\n\n@docs setItems, setItemsAndRemeasureAll, setItemsAndRemeasure\n\n# Scrolling\n\n@docs scrollToItem, Alignment\n","unions":[{"name":"Alignment","comment":" Defines where an item should **appear in the viewport** when scrolled to.\n\n### Variants:\n\n  - **`Top`:** Scrolls the item to the top.\n  - **`Center`:** Scrolls the item to the center.\n  - **`Bottom`:** Scrolls the item to the bottom.\n","args":[],"cases":[["Top",[]],["Center",[]],["Bottom",[]]]},{"name":"Msg","comment":" **Messages** handled by the virtual list.\n\nYou need to **include** `VirtualList.Msg` in your app’s `Msg` type and handle it in `update`.\n\n    type Msg\n       = VirtualListMsg VirtualList.Msg\n       -- other messages\n","args":[],"cases":[]}],"aliases":[{"name":"Model","comment":" `Model` for maintaining the **virtual list state.** You need to include it in your model:\n\n    type alias Model =\n        { virtualList : VirtualList.Model\n        -- other fields\n        }\n\nYou **create** one with the `init` function.\n","args":[],"type":"{ listId : String.String, ids : List.List String.String, height : Basics.Float, defaultItemHeight : Basics.Float, baseBuffer : Basics.Int, dynamicBuffer : Basics.Bool, buffer : Basics.Int, showList : Basics.Bool, visibleRange : ( Basics.Int, Basics.Int ), firstRender : Basics.Bool, unmeasuredRows : Set.Set Basics.Int, rowHeights : Dict.Dict Basics.Int VirtualList.RowHeight, cumulativeHeights : Dict.Dict Basics.Int Basics.Float, scrollTop : Basics.Float, previousScrollTop : Basics.Float }"}],"values":[{"name":"defaultConfig","comment":" Provides a **default configuration** with sensible initial values.\n\n- **`listId`:** The ID of the list container in the DOM.\n- **`initialHeight`:** Estimated height of the list before it is measured.\n- **`defaultItemHeight`:** Default height assigned to items before they are measured.\n- **`showListDuringInitialMeasure`:** If `True`, the list is visible while measuring (potentially causing spacing issues).\n- **`buffer`:** Number of items rendered outside the visible range to ensure smooth scrolling.\n- **`dynamicBuffer`:** If `True`, increases buffer size when scrolling quickly.\n\n\n    defaultConfig : Config\n    defaultConfig =\n        { listId = \"virtual-list\"\n        , initialHeight = 500\n        , defaultItemHeight = 26\n        , showListDuringInitialMeasure = False\n        , buffer = 5\n        , dynamicBuffer = True\n        }\n","type":"VirtualList.Config"},{"name":"init","comment":" Initializes a virtual list model using the **default configuration.**\n","type":"VirtualList.Model"},{"name":"initWithConfig","comment":" Initializes a virtual list model using a **custom configuration.**\n\n    initWithConfig defaultConfig\n\nYou can **modify** the default configuration:\n\n    config =\n        { defaultConfig | buffer = 10 }\n","type":"VirtualList.Config -> VirtualList.Model"},{"name":"scrollToItem","comment":" Scrolls to the **specified item** in the virtual list.\n\nDoes nothing if the item is **already visible.**\n\n    Cmd.map VirtualListMsg (VirtualList.scrollToItem model.virtualList \"item-42\" VirtualList.Center)\n","type":"VirtualList.Model -> String.String -> VirtualList.Alignment -> Platform.Cmd.Cmd VirtualList.Msg"},{"name":"setItems","comment":" Updates the **list of items** displayed in the virtual list.\n\nOnly **new items** are considered for measurement; existing items retain their cached heights.\n\n    VirtualList.setItems model.virtualList ids\n","type":"VirtualList.Model -> List.List String.String -> ( VirtualList.Model, Platform.Cmd.Cmd VirtualList.Msg )"},{"name":"setItemsAndRemeasure","comment":" Same as `setItems`, but allows specifying which **items should be remeasured.**\n\nThis is useful when only a **subset of items** might have changed in height.\n\n    VirtualList.setItemsAndRemeasure model.virtualList { newIds = newIds, idsToRemeasure = changedIds }\n","type":"VirtualList.Model -> { newIds : List.List String.String, idsToRemeasure : List.List String.String } -> ( VirtualList.Model, Platform.Cmd.Cmd VirtualList.Msg )"},{"name":"setItemsAndRemeasureAll","comment":" Same as `setItems`, but allows **remeasuring** the entire list.\n\nUse this when item heights may have **changed.**\n\n    VirtualList.setItemsAndRemeasureAll model.virtualList newIds\n","type":"VirtualList.Model -> List.List String.String -> ( VirtualList.Model, Platform.Cmd.Cmd VirtualList.Msg )"},{"name":"update","comment":" **Updates** the virtual list model in response to messages.\n\nYou must **integrate** this into your `update` function and map the result back to your own `Msg`.\n\n    update : Msg -> Model -> ( Model, Cmd Msg )\n    update msg model =\n        case msg of\n            VirtualListMsg virtualListMsg ->\n                let\n                    ( virtualListModel, virtualListCmd ) =\n                        VirtualList.update virtualListMsg model.virtualList\n                in\n                    ( { model | virtualList = virtualListModel }, Cmd.map VirtualListMsg virtualListCmd )\n            -- other cases\n","type":"VirtualList.Msg -> VirtualList.Model -> ( VirtualList.Model, Platform.Cmd.Cmd VirtualList.Msg )"},{"name":"view","comment":" **Renders** the virtual list.\n\nYou **provide** it with\n\n- **function** that renders an item given its ID,\n- the virtual list **`Model`** and\n- the virtual list **message** type on your side.\n\nIn **your code** this would look like this:\n\n    view : Model -> Html Msg\n    view model =\n        VirtualList.view (renderRow model) model.virtualList VirtualListMsg\n\n    renderRow : Model -> String -> Html Msg\n    renderRow model id =\n        div [] [text id]\n\n`renderRow` is executed **lazily.**\n","type":"(String.String -> Html.Html msg) -> VirtualList.Model -> (VirtualList.Msg -> msg) -> Html.Html msg"}],"binops":[]}]