Sexel is a webcomponent framework that makes building dynamic distributed web applications easy. Using Web Components to build interfaces, Sexel combines block like construction with a distributed Finite State Machine to model all application state transitions as messages.
By building pages out of Sexel components (as seen on the left) it is easy to put together polished user interfaces without having to code html, css, and javascript. Using Sexel's finite state machine to model the interactions between the components, provides an easy to reason about approach to managing application state. And using mesgd messaging, encryption, and authentication natively, you can produce secure distributed application out of the box.
The list of supported components is changing on a regular basis. And writing new components is easy enough that even ChatGPT can write them for you! The current list available on this page are:
Sexel uses HTML5 import links to include components on a page. As long as you include
It will make the component on the page. You can then create instances in the page using the custom HTML tags registered by each component. For example, we can create two buttons using the following HTML:
All interactive components send messages to the Finite State Machine (fsm) which models all of the state changes in the application. You can register your own even handlers with the handler function as follows:
To send a message to the handler it is done wiht the _ function which takes arbitrary arguments. Ususally, the first element passed is the sending component, but it doesn't need to be.
The above code sample could invoke the handler's 'ok' state, and the 'OK Pressed' alert would be shown as a result. These messages can also be subscribed to by functions using the hub. A common pattern is for websocket connections to send messages directly to the FSM and the components are then updated according to the centralized logic.
Some of the components use external 3rd party Javascript Libraries. If you want to use the charting components or the code component you should include the following in your webpage:
If you would like to get the latest source code of the framework it can be found at: https://github.com/cthulhuology/sexel
The following entires show the code of the components to the right
The address component currently takes name, email, and address.
The audio component has a src url and a controls flag. The component comes with a Play and Stop button.
The avatar component shows the user image, but contains user meta-data.
The chart widget can be used to generate bar charts. See Chart.js for data docs.
The breadcrumb component tracks a path heirarchy it takes an items list and a separator character.
The button component has a label and an action. The action invokes the named fsm action when clicked. Image buttons coming soon.
The canvas component wraps the HTML5 canvas API with a Postscript / Turtle style drawing API. Currently it supports:
The card component is used to contain other components with a bounding box and a header.
The carousel component takes a set of child elements and will cycle through them based on the specified delay.
The chat component is an experimental websocket based chat window, with file upload, unicode selector, and download link. This widget is a work in progress and likely to change. Currently the template is not configurable enough.
The clock component displays the current date and time and updates as time progresses. The component also has an optional dateStamp attribute which will display a fixed date and time. Both use toLocaleString under the hood to use the user's locale specific format, defaulting to en-US.
The code component displays source code using Highlight.js for syntax highlighting.
A color picker component that can trigger the given action when the color is selected. NB: uses HSV to compute the RGB values.
The data component displays tabular data as a table.
The date component displays a date picker and the picked date. It has an optional datestamp attribute to set the date to other than today's.
The dialog component is meant for popup dialogs that have an ok and cancel labels, and each of the buttons can have an associated okAction or cancelAction to specify which FSM state to invoke. The default behavior for each is just to hide the dialog.
The footer component show the footer as seen on this page. You can change the text blurb by setting that optional attribute
The form component generates a form element from a fields object. It supports different input types such as:
The chart component can also be used to create line charts. Like with bar charts, the blurb (title), labels, data, and legend take objects following the Chart.js documentation.
The list component supports multi-dimensional data driven lists from JSON objects. It aslo supports both ordered and unordered lists along with custom decorators for each list level.
The auth component is a form for handling user logins, it invokes the "auth" action of the FSM by default.
The menu component produces both horizontal and vertical menus based on the orientation attribute. Each takes a list of items and creates a bunch of buttons. Each button triggers the FSM action of the same name as the menu item.
The notification component displays a color coded message based on the type attribute. It supports they typical notifation types: error, warning, info, success.
The chart component can also be used to create pie charts. Like with bar charts, the blurb (title), labels, data, and legend take objects following the Chart.js documentation.
The progress bar component displays a value and a label from zero to max.
The rating component provides a basic 5 star rating setup, but also has the ability to change the size and specify an alternative character for display. If the action attribute is specified with will invoke the FSM action with the new rating.
The search component is just a search box with a FSM action.
The slider component divides the bar between min and max steps and a default value. If you attach an action to it, the FMS action will be invoked on value chagne. You can specify a label and an initial value as well.
This is a spinner component. The shown attribute controls visibility.
Content for Tab 1
" }, { "label": "Tab 2", "color": "#e6ffed", "content": "<sexel-button label=\"Click Me\" action=\"Home\"></sexel-button>" }, { "label": "Tab 3", "color": "#fff3cd", "content": "<img src=\"images/sexel.png\" width=64 height=64>" } ]'> </sexel-tabs>The tabs component is a sort of modal diaglog box that is data driven. The content of the tab is typically provided programmatically, and encoded as escaped HTML. Changing tabs doesn't currently have an action associated, but may in the future.
The upload component allows you to specify a list of file extensions you'll accept, and if you allow multiple files or just one. Typically, one needs another form to process the actual upload.
The video component plays basic video playback, you can enable or disable native controls.
MIT License Copyright (c) 2025 David J. Goehrig <dave@dloh.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This card can contain any HTML content.
|
|
|
|
|
|
|