{"id":17771312,"url":"https://github.com/lue-bird/elm-rosetree-path","last_synced_at":"2025-08-02T21:14:27.610Z","repository":{"id":62418750,"uuid":"381145748","full_name":"lue-bird/elm-rosetree-path","owner":"lue-bird","description":"navigate rosetrees and forests","archived":false,"fork":false,"pushed_at":"2023-07-26T08:41:38.000Z","size":126,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T01:22:13.771Z","etag":null,"topics":["elm","forest","multiway-tree","navigation","path","rosetree","tree","tree-path"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/lue-bird/elm-rosetree-path/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lue-bird.png","metadata":{"files":{"readme":"README.md","changelog":"changes.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-06-28T19:51:45.000Z","updated_at":"2023-04-23T21:04:41.000Z","dependencies_parsed_at":"2022-11-01T16:46:23.499Z","dependency_job_id":null,"html_url":"https://github.com/lue-bird/elm-rosetree-path","commit_stats":{"total_commits":86,"total_committers":2,"mean_commits":43.0,"dds":"0.39534883720930236","last_synced_commit":"3d16e918c4af90ba41efc182ab03117384eb253e"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/lue-bird/elm-rosetree-path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-rosetree-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-rosetree-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-rosetree-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-rosetree-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lue-bird","download_url":"https://codeload.github.com/lue-bird/elm-rosetree-path/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-rosetree-path/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268455138,"owners_count":24253166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm","forest","multiway-tree","navigation","path","rosetree","tree","tree-path"],"created_at":"2024-10-26T21:31:30.536Z","updated_at":"2025-08-02T21:14:27.566Z","avatar_url":"https://github.com/lue-bird.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rosetree-path\n\nA path is the location of a branch in a tree (or forest).\nWith this package you can use paths to navigate and alter\na [zwilias/elm-rosetree](https://package.elm-lang.org/packages/zwilias/elm-rosetree/latest/) or a list of them, also called a \"forest\".\n\nAn alternative way of\nkeeping track of one focus is a [`Tree.Zipper`](https://package.elm-lang.org/packages/zwilias/elm-rosetree/latest/Tree-Zipper).\nHowever! Paths are nice if you want to\n- keep track of many different locations\n- easily deal with _potentially_ focussed nodes etc.\n- don't want to pollute `Msg`es with potentially large, changing tree content\n\nExample: A big tree on the screen where subtrees can be moved and deleted.\n\n```elm\nimport Tree.Path exposing (TreePath)\nimport Tree.Navigate\n\n\ntype alias Model =\n    { tree : Tree { translate : ( Float, Float ) }\n    , dragged : Maybe TreePath\n    }\n\ntype Msg =\n    = RightClickedOn ForestPath\n    | MouseMoved ( Float, Float )\n  --| ...\n\n\nviewTree =\n    Tree.Navigate.restructure\n        (\\sub -\u003e\n            (...\n                |\u003e onMouseDown (PressedOn sub.path)\n                |\u003e (case sub.path |\u003e Tree.Path.step of\n                        Just childPath -\u003e\n                            onRightClick (RightClickedOn childPath)\n                        Nothing -\u003e\n                            -- top level node should not be removable\n                            identity\n                   )\n            )\n                :: sub.children\n                |\u003e group\n                |\u003e shift sub.label.translate\n        )\n\nupdate msg model =\n    case msg of\n        RightClickedOn path -\u003e\n            { model\n              | tree =\n                  model.tree\n                    |\u003e Tree.mapChildren\n                        (Forest.Navigate.remove path)\n            }\n        \n        MouseMoved mousePosition -\u003e\n            case model.dragged of\n                Just path -\u003e\n                    { model\n                      | tree =\n                          model.tree\n                            |\u003e Tree.Navigate.alter path\n                                (Tree.mapLabel\n                                    (\\l -\u003e { l | translate = ... })\n                                )\n                    }\n\n                Nothing -\u003e\n                    model\n        \n      --...\n```\n\nComplete implementation in [example/](https://github.com/lue-bird/rosetree-path/tree/master/example/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flue-bird%2Felm-rosetree-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flue-bird%2Felm-rosetree-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flue-bird%2Felm-rosetree-path/lists"}