{"id":21353421,"url":"https://github.com/feathersui/feathersui-xml","last_synced_at":"2025-07-12T21:31:43.542Z","repository":{"id":145394403,"uuid":"243859083","full_name":"feathersui/feathersui-xml","owner":"feathersui","description":"Experimental Haxe macros for creating Feathers UI components from markup, similar to MXML from Adobe Flex","archived":false,"fork":false,"pushed_at":"2023-12-14T22:21:26.000Z","size":102,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-26T09:05:39.277Z","etag":null,"topics":["cross-platform","feathers-ui","frontend","gui","haxe","mxml","openfl","ui","user-interface","xml"],"latest_commit_sha":null,"homepage":"","language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/feathersui.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"joshtynjala","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-02-28T21:39:11.000Z","updated_at":"2024-03-26T09:05:39.278Z","dependencies_parsed_at":"2023-04-21T15:16:56.632Z","dependency_job_id":null,"html_url":"https://github.com/feathersui/feathersui-xml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feathersui%2Ffeathersui-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feathersui%2Ffeathersui-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feathersui%2Ffeathersui-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feathersui%2Ffeathersui-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feathersui","download_url":"https://codeload.github.com/feathersui/feathersui-xml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225834622,"owners_count":17531534,"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","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":["cross-platform","feathers-ui","frontend","gui","haxe","mxml","openfl","ui","user-interface","xml"],"created_at":"2024-11-22T03:17:33.834Z","updated_at":"2024-11-22T03:17:34.570Z","avatar_url":"https://github.com/feathersui.png","language":"Haxe","funding_links":["https://github.com/sponsors/joshtynjala"],"categories":[],"sub_categories":[],"readme":"# XML Components for Feathers UI\n\nAn **experimental** library containing [Haxe macros](https://haxe.org/manual/macro.html) to create [Feathers UI](https://feathersui.com/) components at compile-time using markup.\n\nThis markup is inspired by MXML, which is an XML dialect designed for creating user interfaces with Apache Flex (originally developed at Macromedia and Adobe).\n\n## Installation\n\nThis library is not yet available on Haxelib, so you'll need to install it from Github.\n\n```sh\nhaxelib git feathersui-xml https://github.com/feathersui/feathersui-xml.git\n```\n\n## Usage\n\nThe `XmlComponent` class contains some macro functions, like `withMarkup()` and `withFile()`, that may be used to create custom components from markup.\n\nBy default, the `XmlComponent` class doesn't know anything about Feathers UI. It is meant to be a generic library that can be used with other UI component frameworks too. To add Feathers UI components to the set of available tags, a special build macro must be added to the project.\n\nYou can add it in your _project.xml_ file:\n\n```xml\n\u003chaxeflag name=\"--macro\" value=\"com.feathersui.xml.FeathersUICoreNamespace.setup()\"/\u003e\n```\n\nOr you can add it as a build macro to your application class:\n\n```haxe\nimport feathers.core.Application;\n\n@:build(com.feathersui.xml.FeathersUICoreNamespace.setup())\nclass Main extends Application {\n\tpublic function new() {\n\t\tsuper();\n\t}\n}\n```\n\nBe sure to import the `XmlComponent` class to use the methods demonstrated below.\n\n```haxe\nimport com.feathersui.xml.XmlComponent;\n```\n\n### `withMarkup()`\n\nCalling the `XmlComponent.withMarkup()` macro generates a Haxe class from inline markup (or from a string), and then it returns a new instance.\n\n```haxe\nvar instance = XmlComponent.withMarkup(\n\t'\u003cf:LayoutGroup xmlns:f=\"http://ns.feathersui.com/xml\"\u003e\n\t\t\u003cf:layout\u003e\n\t\t\t\u003cf:HorizontalLayout gap=\"10\" horizontalAlign=\"RIGHT\"/\u003e\n\t\t\u003c/f:layout\u003e\n\t\t\u003cf:Button id=\"okButton\" text=\"OK\"/\u003e\n\t\t\u003cf:Button id=\"cancelButton\" text=\"Cancel\"/\u003e\n\t\u003c/f:LayoutGroup\u003e'\n);\ncontainer.addChild(instance);\ninstance.okButton.addEventListener(TriggerEvent.TRIGGER, (event) -\u003e {\n\ttrace(\"triggered the OK button\");\n});\n```\n\n### `withFile()`\n\nCalling the `XmlComponent.withFile()` macro works similarly to `withMarkup()`, but the XML is loaded from a separate file. Relative paths are resolved from the folder containing the _.hx_ file where the macro is used.\n\n```haxe\nvar instance = XmlComponent.withFile(\"path/to/file.xml\");\n```\n\n## Haxe primitive types\n\nA subset of core Haxe types may be used in markup by defining the following namespace:\n\n```\nxmlns:hx=\"http://ns.haxe.org/4/xml\"\n```\n\n### `Bool`\n\nThe value must be `true` or `false`, and it is case-sensitive.\n\n```xml\n\u003chx:Bool\u003etrue\u003c/hx:Bool\u003e\n```\n\n### `Float`\n\nA float may be a positive or negative numeric value which may have a decimal portion.\n\n```xml\n\u003chx:Float\u003e123.4\u003c/hx:Float\u003e\n```\n\n### `Int`\n\nAn integer may be a positive or negative numeric value, and it must not have a decimal portion. Validated by `Std.parseInt()`.\n\n```xml\n\u003chx:Int\u003e-456\u003c/hx:Int\u003e\n```\n\n### `String`\n\nA sequence of characters.\n\n```xml\n\u003chx:String\u003eHello World\u003c/hx:String\u003e\n```\n\nIf the string value would make the XML invalid, wrap it with CDATA.\n\n```xml\n\u003chx:String\u003e\u003c![CDATA[Some inline HTML\u003cbr\u003ethat is not valid XML]]\u003e\u003c/hx:String\u003e\n```\n\n### `Dynamic`\n\nAn anonymous structure. Properties may be set using XML attributes, child elements, or a combination of both.\n\n```xml\n\u003chx:Dynamic name=\"Daredevil\"\u003e\n\t\u003chx:secretIdentity\u003eMatt Murdock\u003c/hx:secretIdentity\u003e\n\u003c/hx:Dynamic\u003e\n```\n\n### `Any`\n\nAn anonymous structure. Properties may be set using XML attributes, child elements, or a combination of both.\n\n```xml\n\u003chx:Any name=\"Iron Fist\"\u003e\n\t\u003chx:secretIdentity\u003eDanny Rand\u003c/hx:secretIdentity\u003e\n\u003c/hx:Any\u003e\n```\n\n### `Array`\n\nAn collection of items, which are added as child elements.\n\n```xml\n\u003chx:Array\u003e\n\t\u003chx:Dynamic name=\"Matt Murdock\"/\u003e\n\t\u003chx:Dynamic name=\"Foggy Nelson\"/\u003e\n\t\u003chx:Dynamic name=\"Karen Page\"/\u003e\n\u003c/hx:Array\u003e\n```\n\n## Tips \u0026 Tricks\n\nWhen using [haxe-formatter](https://github.com/HaxeCheckstyle/haxe-formatter), you may want to disable formatting for sections of _.hx_ files that contain embedded markup.\n\n```haxe\nvar instance = XmlComponent.withMarkup(\n\t// @formatter:off\n\t'\u003cf:LayoutGroup xmlns:f=\"http://ns.feathersui.com/xml\"\u003e\n\t\u003c/f:LayoutGroup\u003e'\n\t// @formatter:on\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeathersui%2Ffeathersui-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeathersui%2Ffeathersui-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeathersui%2Ffeathersui-xml/lists"}