{"$format":"search@1","sections":[{"route":"/","anchor":"","title":"omui","trail":[],"text":"Live Design"},{"route":"/","anchor":"a-ui-framework-where-one-semantic-tree-drives-the-pixels-the-motion-accessibility-agents-and-tests","title":"A UI framework where one semantic tree drives the pixels, the motion, accessibility, agents and tests.","trail":[],"text":"Install\nagent\nCopy\nInstall omui (after the release; until then build it from GitHub), run `omui connect ····-····`, then call `describe` and follow it.\nGitHub"},{"route":"/docs/","anchor":"the-minimal-documents","title":"The minimal documents","trail":[],"text":"A small site of documents, built by oweb: every page here is one semantic tree, written as HTML for a reader and as Markdown for an agent.\nThis set is deliberately small and complete: it holds every kind of content a documentation site has to carry, so one corpus checks the writings, the search and the questions an agent is asked. It is not the user documentation.\nEach page is also plain text: add index.md to its address."},{"route":"/docs/","anchor":"pages","title":"Pages","trail":["The minimal documents"],"text":"Start: from installing the tools to a first window.\nInterfaces: one tree, three ways to write it.\ncode in three languages, and one block with none\na picture and a quotation\nAgents: what an agent reads and what it may do.\nThe command's operations, generated from its catalog.\nIn Chinese: 中文."},{"route":"/docs/","anchor":"how-to-read-this-site","title":"How to read this site","trail":["The minimal documents"],"text":""},{"route":"/docs/","anchor":"as-a-person","title":"As a person","trail":["The minimal documents","How to read this site"],"text":"Open a page. It reads before any script runs: headings, links, tables and code are HTML's own."},{"route":"/docs/","anchor":"as-an-agent","title":"As an agent","trail":["The minimal documents","How to read this site"],"text":"Fetch llms.txt, then a page's index.md; site.search.xdef.json holds every section's text. See what an agent may do."},{"route":"/docs/","anchor":"as-a-search-engine","title":"As a search engine","trail":["The minimal documents","How to read this site"],"text":"sitemap.xml lists the routes; each page's <title> is its first heading."},{"route":"/start/","anchor":"start","title":"Start","trail":[],"text":"Ten minutes: the tools, an application, running it."},{"route":"/start/","anchor":"1-tools","title":"1. Tools","trail":["Start"],"text":"Building is mcpp's, installed through xlings; the compiler and the rest are pinned by the project and fetched at the first build.\nxlings install mcpp"},{"route":"/start/","anchor":"2-a-project-running","title":"2. A project, running","trail":["Start"],"text":"omui new hello\ncd hello\nomui dev\napp/main.ts is the whole application:\nimport { signal, fmt, column, text, button, mount } from \"openmui\";\n\nconst clicks = signal(0);\n\nexport const App = () =>\n  column({ padding: 24, gap: 12 }, [\n    // The page's heading too (role and level): its document's h1 on the Web, a reader's first heading.\n    text({ text: \"Hello from subscription\", style: \"title\", role: \"heading\", level: 1 }),\n    text({ id: \"count\", text: fmt(\"Clicked {} times\", clicks), style: \"heading\" }),\n    button({ id: \"click\", text: \"Click me\", variant: \"primary\", onActivated: () => clicks.update((n: number) => n + 1) }),\n  ]);\n\nmount(\"main\", App());\nChange the file while the window is open and save: the interface changes, and the count stays."},{"route":"/start/","anchor":"3-the-everyday-commands","title":"3. The everyday commands","trail":["Start"],"text":"Command\nWhat it does\nomui dev\nruns in development mode (--headless for no window)\nomui run\nruns as it ships\nomui test\nruns the tests\nomui build\nbuilds\nNext: interfaces, or what an agent reads."},{"route":"/ui/","anchor":"interfaces","title":"Interfaces","trail":[],"text":"An interface is a tree: each node has a role, a name, a value, states and the actions it offers. You describe the tree in code; the framework draws it, gives it to screen readers, and gives it to agents.\nThe mark: a circle around the word mui\nOne semantic tree, many renderings: pixels, accessibility, agents and tests are views of the same tree."},{"route":"/ui/","anchor":"three-ways-to-write-it","title":"Three ways to write it","trail":["Interfaces"],"text":"In TypeScript, the default:\nimport { column, text, button, mount } from \"openmui\";\n\nmount(\"main\", column({ gap: 8 }, [text({ text: \"Saved\" }), button({ id: \"undo\", text: \"Undo\" })]));\nIn C++, for what must be fast:\nimport omui;\n\nomui::Element view() {\n    return omui::column({.gap = 8}, {omui::text({.text = \"Saved\"}), omui::button({.id = \"undo\", .text = \"Undo\"})});\n}\nAs a view document, for interfaces a tool generates:\n{ \"type\": \"column\", \"gap\": 8, \"children\": [{ \"type\": \"text\", \"text\": \"Saved\" }, { \"type\": \"button\", \"id\": \"undo\", \"text\": \"Undo\" }] }\nWhat an agent reads of all three is the same tree:\ncolumn\n  text \"Saved\"\n  button#undo \"Undo\""},{"route":"/ui/","anchor":"identity","title":"Identity","trail":["Interfaces"],"text":"A node an agent or a test must find has an explicit id, and the id never depends on the text shown: undo stays undo when the label is translated."},{"route":"/agent/","anchor":"agents","title":"Agents","trail":[],"text":"Every application reads to an agent as it reads to a person: the agent reads the semantic tree and performs the actions its nodes offer. There is no screenshot to interpret and no second interface to write."},{"route":"/agent/","anchor":"what-an-agent-reads","title":"What an agent reads","trail":["Agents"],"text":"It asks for\nIt gets\nCost\nthe tree\nevery node: role, name, value, states, actions\none request\na part of it\na subtree, by id and depth\none request\nwhat changed\nthe difference since it last looked\none request\nthe pixels\nany region, as the renderer drew it\nwhen it must look"},{"route":"/agent/","anchor":"what-an-agent-may-do","title":"What an agent may do","trail":["Agents"],"text":"An action says its effect before it is performed:\nreading changes nothing and asks nothing\na reversible action is performed, and can be taken back\nan irreversible action needs the answer that confirms it\nan action that reaches outside the application needs the person's answer\nThe person decides how far an agent may go: in development everything declared is open; in a release, what the developer allows and the user's settings both permit.\nBack to the pages."},{"route":"/live/","anchor":"a-live-example","title":"A live example","trail":[],"text":"A document can show an example running. A block of the language view is a view document — an interface written as data: its components, its state, what an event sets — and the page shows it twice: the example itself, and under it the source that makes it."},{"route":"/live/","anchor":"a-counter","title":"A counter","trail":["A live example"],"text":"{\n  \"omui\": \"0.1\",\n  \"imports\": [\"omui.ui.base\"],\n  \"view\": {\n    \"name\": \"Counter\",\n    \"signals\": { \"count\": { \"type\": \"int\", \"value\": 0 } },\n    \"root\": {\n      \"type\": \"row\",\n      \"id\": \"counter\",\n      \"props\": { \"gap\": 12, \"align\": \"center\" },\n      \"children\": [\n        {\n          \"type\": \"button\",\n          \"id\": \"add\",\n          \"props\": { \"text\": \"Add one\", \"variant\": \"primary\" },\n          \"on\": { \"activated\": [{ \"set\": \"count\", \"expr\": \"count + 1\" }] }\n        },\n        {\n          \"type\": \"text\",\n          \"id\": \"said\",\n          \"props\": { \"text\": { \"expr\": \"count == 0 ? 'Not pressed yet' : format('Presses: {}', count)\" } }\n        },\n        {\n          \"type\": \"button\",\n          \"id\": \"reset\",\n          \"props\": { \"text\": \"Reset\", \"variant\": \"ghost\", \"disabled\": { \"expr\": \"count == 0\" } },\n          \"on\": { \"activated\": [{ \"set\": \"count\", \"value\": 0 }] }\n        }\n      ]\n    }\n  }\n}\nPress Add one: the text beside it counts, and Reset becomes available."},{"route":"/live/","anchor":"what-each-reader-gets","title":"What each reader gets","trail":["A live example"],"text":"Before the page's program is there, the example is shown as it starts — its buttons, its text — with its source under it. Nothing is lost if the program never comes.\nWhen the program is there (this page takes it once the page is idle), the example runs: the same nodes, now answering.\nAn agent that fetches the page's Markdown gets the block as it is written: a view document it can check and run.\nThe source is data, so the page's program carries no script engine to run it."},{"route":"/reference/ops/","anchor":"oweb-operations","title":"oweb operations","trail":[],"text":"A site states its title, address, languages, routes and budget in its oweb.config.ts; every operation reads it and a request's options stand over it. Build a directory of pages into a site whose every route is its semantic tree written as HTML and as Markdown. Ask a site what it is, list its routes, read one page as an agent that only fetches would, and search every page's sections — of its source, without building it, or of the site as built: the directory a build wrote, read as it was published.\nGenerated by ops-gen from the catalog; the effect is openas's.\nOperation\nEffect\nParameters\nResult\nCost\nUndo\nCancel\nsite.build — Build the site: each page of pages/ a route with its index.html (the tree as HTML: readable with no script) and index.md (the tree as Markdown), the routes table, llms.txt, the search index, 404.html for a lost address, given the site's address sitemap.xml, and the delivery manifest — every file as stored and as a static host sends it, each route's bytes before it reads held to a budget (over it: written, and failed with where). A link inside the site that leads nowhere fails the build with each one said, and nothing is written\nreversible\nsite: path, config: path (optional), out: path, title: string (optional), languages: string (optional), url: string (optional), readable: string (optional), engine: path (optional), load: string (optional)\njson\nbounded\ndelete the directory written\nno\nsite.describe — What a site is, as it says it at each of its doors: its title, address and languages, each route with its title and its Markdown's address, the requests to go on with — and the text a build writes as llms.txt, the same words an agent that only fetches is given\nread\nsite: path, config: path (optional), languages: string (optional), url: string (optional)\njson\ninstant\n—\nno\nroutes.list — The routes a site's pages give: each its address, source, title, language and headings with their anchors\nread\nsite: path, config: path (optional), languages: string (optional)\njson\ninstant\n—\nno\npage.read — One route as it is written — evaluated now from a site's source, or read from a site as built: its Markdown (what an agent that only fetches reads) or its HTML\nread\nsite: path, config: path (optional), route: string, as: string (optional), languages: string (optional)\njson\nbounded\n—\nno\ndocs.search — The sections of a site's pages that hold every word asked for, best first: each its route, its anchor, the headings it is under and the line that says so — the same index a built site serves as site.search.xdef.json\nread\nsite: path, config: path (optional), query: string, limit: string (optional), languages: string (optional)\njson\nbounded\n—\nno"},{"route":"/zh/","anchor":"最小文档集","title":"最小文档集","trail":[],"text":"一个由文档组成的小站，由 oweb 构建：这里的每一页都是一棵语义树，给读者写成 HTML，给 Agent 写成 Markdown。\n这组文档有意做得小而全：文档站要承载的每一种内容它都有，所以同一份语料可以用来检查两种写法、搜索，以及拿来问 Agent 的问题。"},{"route":"/zh/","anchor":"页面","title":"页面","trail":["最小文档集"],"text":"开始：从安装工具到第一个窗口。\n英文版。"},{"route":"/zh/","anchor":"怎样读这个站","title":"怎样读这个站","trail":["最小文档集"],"text":"人直接打开页面；Agent 先取 llms.txt，再取页面的 index.md。"},{"route":"/zh/start/","anchor":"开始","title":"开始","trail":[],"text":"十分钟：工具、一个应用、把它跑起来。"},{"route":"/zh/start/","anchor":"1-工具","title":"1. 工具","trail":["开始"],"text":"构建用 mcpp，经 xlings 安装；编译器等由项目钉住，第一次构建时取回。\nxlings install mcpp"},{"route":"/zh/start/","anchor":"2-一个项目，跑起来","title":"2. 一个项目，跑起来","trail":["开始"],"text":"omui new hello\ncd hello\nomui dev\n窗口开着的时候改 app/main.ts 并保存：界面随之改变，计数保留。"},{"route":"/zh/start/","anchor":"3-日常的命令","title":"3. 日常的命令","trail":["开始"],"text":"命令\n做什么\nomui dev\n以开发模式运行（--headless 不开窗口）\nomui run\n按发布的样子运行\nomui test\n运行测试\nomui build\n构建\n回到首页。"}]}
