veylo.js is optional. It is plain ES5, has no dependencies, and initialises itself on load. It exposes one global, veylo.
API
Call
Does
veylo.themes
Array of theme names
veylo.setTheme(name)
Sets data-theme on .veylo, sets the page background to --desk, remembers the choice
veylo.theme()
Returns the current theme name
veylo.setCaret(name)
block, bar, underscore or auto
veylo.sort(th)
Sorts the table by the given th[data-sort] header, as if it was clicked
Data attributes
Attribute
On
Effect
data-veylo-theme
select
Theme picker, fills itself
data-veylo-caret
select
Caret picker
data-veylo-mask
input
Shows * per character; real value in input.dataset.value
data-veylo-sort
table
Sortable; mark headers with data-sort or data-sort="num"
data-veylo-select
table
Row selection; ="one" for single
data-veylo-modal="#id"
button
Opens that dialog.veylo-dialog
data-veylo-close
button in a dialog
Closes it
data-veylo-static
dialog
Backdrop click does not close it
data-veylo-dismiss
button in a note, toast or chip
Hides it
data-veylo-tabs + data-veylo-tab="#id"
tab bar and buttons
Tab switching
data-veylo-context="#id"
any element
Right-click menu
data-veylo-one
.veylo-accs
Only one section open
data-veylo-rate="3"
.veylo-rate
Star rating with initial value
data-veylo-all="name"
checkbox
Select-all for checkboxes named name
data-veylo-copy="#id"
button
Copies that element's text
data-value
.veylo-color, .veylo-cal
Initial colour or date
Events
Event
When
Detail
change
A list, table, tree, calendar, rating or colour picker changes
value, values or items
veylo-open
Enter or double-click on a row or leaf
The item
veylo-pick
A menu item is chosen
The item
document.querySelector('.veylo-color').addEventListener('change', function (e) {
console.log('colour', e.detail.value);
});
Without the script
Everything visual works without veylo.js. Without it you lose: theme switching helpers, masked inputs, table sorting and selection, the colour picker, calendars, split bars, dialog and tab wiring, and the keyboard behaviour in Keyboard and mouse. Native details, dialog.showModal() and form controls still work.