uxml.js
v0.1.0
Published
UXML is a lightweight JavaScript library designed to streamline web development by reducing the reliance on embedded JavaScript within HTML files. This library empowers developers to create dynamic and interactive web elements using simple, clean, and scr
Downloads
7
Maintainers
Readme
Unscripted eXtended Markup Language (UXML)
UXML
a lightweight, script-free component library designed specifically for web development within HTML. Whether you're a seasoned developer or new to web development, UXML simplifies the creation of interactive web applications without the need for complex JavaScript frameworks. You can create dynamic web components effortlessly without the need for any JavaScript code. With UXML, you can enhance user interfaces, handle user interactions, and build feature-rich web applications while working within the familiar HTML structure.
Features
- Script-Free HTML UXML enables the creation of dynamic web content directly within HTML, eliminating the need for inline JavaScript.
- Simplified Interactivity Easily add interactive features to your web pages using HTML attributes and minimal configuration.
- Cross-Browser Compatibility UXML is compatible with modern web browsers, ensuring a consistent user experience.
- Lightweight
UXML is incredibly lightweight, weighing in
20 times less
size than popular libraries like ReactJS. - No Virtual DOM UXML doesn't rely on a virtual DOM. This results in a more efficient and simplified rendering process.
- Shallow Learning Curve UXML offers a shallow learning curve, making it accessible to developers of all skill levels. If you know HTML, you can start using UXML right away.
Getting Started
Include the UXML library in your HTML document:
<script src="https://unpkg.com/[email protected]/uxml.js"></script>
Use UXML attributes within your HTML elements to add interactivity:
<body $load="get:/pages" $swap="innerHTML"> <!-- Your HTML body --> </body>
Basic
UXML uses a simple syntax $action="event:selector"
similar on how we do a basic onclick="click()"
event handler in plain HTML. This is consist of three(3) parts, a declaration $action
, an assignment =
and a handler "event:selector"
.
- A
$
sign to define/accessUXML
inspired by jquery - A
action
to be performed on the element inspired by angularjs - A
event
to emit anUXMLEvent
or trigger anhttp
request inspired by htmx - A
:
to separate event and selector - A
selector
to "query" HTML elements or "value" of a given event i.e.url
for http request
Usage
UXML provides a range of attributes to enhance interactivity, such as $click
, $submit
, $load
, $component
and more. These attributes allow you to define behaviors without the need for JavaScript code.
<button $click="show:#hello">Show message!</button>
<div id="hello">Hello, UXML!</div>
Contributions
We welcome contributions from the community to improve UXML. If you have ideas for improvements or encounter any issues, please consider opening an issue or submitting a pull request on our GitHub repository.
License
UXML is distributed under the MIT License. Feel free to use, modify, and distribute this library in your projects.
Acknowledgments
UXML stands on the shoulders of giants, drawing inspiration from jquery, htmx, angularjs and the need for more simplified, cleaner, and maintainable web code. Their pioneering work has illuminated our path, empowering us to develop this project. We thank the open-source community for their contributions and support in making this project possible.