Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@dwightbcoder/action-ui
Advanced tools
Action UI is a Javascript framework to simplify connecting actions to user interface elements
Action UI is a ES6 Javascript framework for building event-base user interfaces
The goal of this package is to make decoupled event-driven API-powered websites and applications simpler to produce with minimal learning curve.
Please review the documentation via the Wiki
By default actions attached to HTML elements (via a ui-action
attribute) will be configured automatically allowing Action UI to take control of form submission simply be setting an action name to the <form>
:
<script src="https://cdn.jsdelivr.net/npm/@dwightbcoder/action-ui"></script>
<form ui-action="save post" action="/post/store" method="POST">
<label for="title">Title:</label><br>
<input type="text" name="title" placeholder="Post title"><br>
<br>
<label for="body">Body:</label><br>
<textarea name="body"></textarea><br>
<br>
<button type="submit">Save Post</button>
</form>
Whenever an action is triggered any element triggers will receive state CSS classes of loading
, success
, or fail
.
For example disable form elements and show an overlay when it is submitted using CSS:
<style>
form.loading
{
position: relative;
pointer-events: none;
}
form.loading::after
{
content: "Saving...";
top: 0; left: 0;
width: 100%; height: 100%;
background-color: rgba(255,255,255,.75);
position: absolute; display: flex;
align-items: center; justify-content: center;
}
</style>
You can listen for action.after
events for things like informing the user of success or failure:
document.addEventListener('action.after', e => {
if ( e.detail.name == 'save post' )
{
alert( e.detail.success ? 'Success!' : 'Failed!' )
}
})
Setup a simple index.html
:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@dwightbcoder/action-ui"></script>
</head>
<body>
<header>Header</header>
<main ui-view="controller"></main>
<footer>Footer</footer>
<script>
ActionUI.Router.start()
</script>
</body>
</html>
Create your views:
view/
error.html
default/
index.html
You now have a simple SPA that will load view content from your external view html files and respond to to page navigation include reload, back, and forward.
FAQs
Action UI is a Javascript framework to simplify connecting actions to user interface elements
The npm package @dwightbcoder/action-ui receives a total of 79 weekly downloads. As such, @dwightbcoder/action-ui popularity was classified as not popular.
We found that @dwightbcoder/action-ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.