{"id":19584155,"url":"https://github.com/octacian/libuix","last_synced_at":"2025-07-24T19:06:21.236Z","repository":{"id":85212267,"uuid":"230378154","full_name":"octacian/libuix","owner":"octacian","description":"A model-view-viewmodel (MVVM) approach to Minetest formspecs.","archived":false,"fork":false,"pushed_at":"2020-04-09T04:30:56.000Z","size":230,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T14:25:40.309Z","etag":null,"topics":["formspec","gui","library","minetest","minetest-apis","minetest-mod","mvvm"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/octacian.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-27T05:22:30.000Z","updated_at":"2024-07-09T04:24:22.000Z","dependencies_parsed_at":"2023-03-16T20:45:39.272Z","dependency_job_id":null,"html_url":"https://github.com/octacian/libuix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/octacian/libuix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octacian%2Flibuix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octacian%2Flibuix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octacian%2Flibuix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octacian%2Flibuix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octacian","download_url":"https://codeload.github.com/octacian/libuix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octacian%2Flibuix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266890332,"owners_count":24001529,"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-07-24T02:00:09.469Z","response_time":99,"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":["formspec","gui","library","minetest","minetest-apis","minetest-mod","mvvm"],"created_at":"2024-11-11T07:46:56.758Z","updated_at":"2025-07-24T19:06:21.167Z","avatar_url":"https://github.com/octacian.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"MVVM Formspec UI Library [libuix]\n=================================\n\nlibuix is a user interface library for Minetest, designed to replace the messy, error-prone combination of string-based formspec definitions and catch-all `on_receive_fields` callbacks with a simplistic [Model-view-viewmodel \\(MVVM\\)](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel) approach inspired by [Vue.js](https://vuejs.org/).\n\n**Wait!** This library is in super-early developmental stages. It can't be used at all yet in the real world. But do not fear! There is not much more to be done.\n\nIn the meantime, **contributors would be greatly appreciated**. There is no public todo list at the moment, so if you are interested please contact [octacian](https://github.com/octacian).\n\n## Example\n\nLet's create and show a very simple formspec with just three elements:\n- A field that takes an arbitrary message.\n- A button that prints to the log when it is clicked.\n- A label repeating back the message entered, as long as it is not blank.\n\n```lua\nuix:formspec(\"example\") { w = 5, h = 5 } {\n\tui.field { x = 0, y = 1, w = 5, h = 1, label = \"Message:\", bind = model.message },\n\tui.button { x = 0, y = 2.5, w = 5, h = 1, label = \"Submit\", click = model.submit },\n\tui.text { x = 0, y = 4, visible = ne(model.message, \"\"), text = \"You said: \" .. model.message }\n} {\n\tmessage = \"\",\n\tsubmit = function()\n\t\tprint(\"Hey! \" .. model._player_name .. \" submitted our form!\")\n\tend\n}\n\nuix:formspec(\"example\"):show(\"singleplayer\")\n```\n\nAnd just in case you're not a fan of having to type the name of each property, you don't have to:\n\n```lua\n{\n\tui.field { 0, 1, 5, 1, \"Message:\", bind = model.message }\n}\n```\n\n## Comparison\n\nThe formspec we created above seems very simple, and that's because it is! But what does it look like using just core Minetest APIs?\n\n```lua\nlocal function render(player, message)\n\tlocal formstring = [[\n\t\tsize[5,5]\n\t\treal_coordinates[true]\n\t\tfield[0,1;5,1;message;Message;]\n\t\tbutton[0,2.5;5,1;submit;Submit]\n\t]]\n\n\tif message ~= \"\" then\n\t\tformstring = formstring .. \"label[0,4;You said: \" .. message .. \"]\"\n\tend\n\n\tminetest.show_formspec(player, \"example:example\", formstring)\nend\n\nminetest.register_on_player_receive_fields(function(player, formname, fields)\n\tif formname == \"example:example\" then\n\t\tif fields.submit then\n\t\t\tprint(\"Hey! \" .. player .. \" submitted our form!\")\n\t\tend\n\n\t\tif fields.message then\n\t\t\trender(player, message)\n\t\tend\n\tend\nend)\n\nrender(\"singleplayer\", \"\")\n```\n\nWith such a simple formspec it is not at all complex to achieve the same result with the core Minetest APIs, however, it is without question much more logically complex than is the libuix iteration, besides requiring more code and being less concise.\n\nFor those of you more numerically inclined, here are some raw lines-of-code statistics (warning: they may be somewhat biased due to stylization).\n\n| Task                   | libuix | Minetest | % less code necessary |\n| ---------------------- | ------ | -------- | --------------------- |\n| Showing the formspec   | 5      | 12       | 41.6%                 |\n| Handling submissions   | 4      | 10       | 40%                   |\n| Overall                | 11     | 23       | 47.8%                 |\n\nAnd this is just with a very simple formspec. As an interface scales and becomes more complex with many pages and interactive elements, the differences observed above will become more established and a greater gap in lines-of-code will quickly materialize. On top of all this is the increased quality-of-life for the developer: libuix allows complex tasks to be achieved with only the absolutely necessary logic, leaving fewer things to go wrong and decreasing overall complexity.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctacian%2Flibuix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctacian%2Flibuix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctacian%2Flibuix/lists"}