No worries, SoixamUI keeps your foundational knowledge intact.
License
SoixamUI is developed by Soixam, primarily to support internal projects at soixam.org. However, SoixamUI is open source under the Apache License 2.0. You are free to use, modify, and distribute it, including for commercial purposes — as long as you retain the original copyright and attribution.
Setup
SoixamUI consists of two files, SoixamUI.min.css and SoixamUI.min.js. You’re free to download and place them anywhere — just don’t forget to update the file paths in your HTML.
Although SoixamUI embraces minimalism and coding freedom, it requires your HTML structure to be well-formed for optimal performance (sample.html).
Hook
SoixamUI offers hooks at critical stages of the application lifecycle.
SXInit: Triggered immediately when SoixamUI initializes, before any assets are loaded.
SXReady: Triggered on DOMContentLoaded, when the document is fully loaded and ready for scripts to execute.
SXLoaded: Triggered when the user interacts with the page for the first time — through actions like clicking, scrolling, or typing.
SXUserActive: Triggered when the user starts interacting with the page. Ideal for loading third-party scripts, such as Google Tag Manager, Turnstile, and more.
Example: One of the cool things about SoixamUI is that you can inject code at any point on the page.
SoixamUI includes a set of essential utility functions designed for your convenience.
SX.version(): Returns the current version of SoixamUI in use.
SX.uuid(): Generates a random UUID string.
SX.range(int:from,int:to): Creates an array of numbers from 'from' to 'to' (inclusive).
SX.rand(int:min,int:max): Returns a random integer between min and max (inclusive).
SX.randFloat(float:min,float:max): Returns a random floating-point number between min and max.
SX.randText(int:length): Generates a random alphanumeric string with the specified length.
SX.shuffle(array:data,int:seed): Randomly shuffles the elements in the 'data' array, optionally using a seed for consistent results.
SX.chance(float:percent): Returns true or false based on the probability percentage. For example, if percent = 25, approximately 25 out of 100 calls will return true.
SX.escape(string:data): Escapes the input string to prevent XSS attacks.
SX.attrEscape(string:data): Escapes the input string for safe use in HTML attributes.
await SX.hash(string:algorithm,string:data): Returns a hashed string of the data using the specified algorithm. Supports CRC32, SHA-1, SHA-256, SHA-384, and SHA-512.
await SX.sleep(int:milliseconds): Pauses code execution for the specified number of milliseconds.
AJAX
SoixamUI provides simplified AJAX utilities that extend beyond the native fetch() API. These tools offer better error handling, built-in loaders, progress tracking, and request cancellation features.
SX.showError(string:message): Displays a full-screen error message overlay (recommended for critical errors).
SX.showLoader(): Displays a loading spinner overlay to indicate ongoing processes.
SX.hideLoader(): Hides the loading spinner overlay.
await SX.fetch(object:options): An enhanced fetch() function supporting upload progress tracking, request cancellation, and automatic timeout handling.
Dialog
SoixamUI offers a fully customizable dialog system for creating alerts, confirmations, prompts, and custom modal dialogs with ease.
SX.dialog(object:options): Creates a fully custom dialog box with flexible configuration options.
await SX.alert(string:message,string:title): Quickly creates an alert dialog with a title and message.
await SX.warn(string:message,string:title): Quickly creates a warning dialog with a title and message.
await SX.error(string:message,string:title): Quickly creates an error dialog with a title and message.
await SX.confirm(string:message,string:title): Quickly creates a confirmation dialog to capture user decision.
await SX.prompt(string:message,string:title): Quickly creates a prompt dialog to capture user input.
Namespaces
SoixamUI organizes related functions into namespaces to keep your code clean and structured.
SX.XOR
Provides basic XOR-based encryption and random number generation using the Xorshift algorithm.
SX.XOR.shift(int:seed) or SX.XOR.rand(int:seed): Generates a pseudo-random number based on the provided seed using the Xorshift algorithm.
SX.XOR.encrypt(string:data,string:key): Encrypts a string using XOR encryption with the specified key.
SX.XOR.decrypt(string:data,string:key): Decrypts a string that was encrypted with XOR encryption.
SX.AES
Offers AES-GCM encryption utilities for secure data handling.
await SX.AES.iv(): Generates a random Initialization Vector (IV) for AES encryption and decryption.
await SX.AES.encrypt(string:data,string:key,string:iv): Encrypts data using AES-GCM with the provided key and IV.
await SX.AES.decrypt(string:data,string:key,string:iv): Decrypts data using AES-GCM with the provided key and IV.
SX.Cookie
Provides a simple API for managing browser cookies.
SX.Cookie.get(string:name): Retrieves the value of a cookie by its name.
SX.Cookie.set(string:name,string:value,object:options): Sets or updates a cookie with optional parameters like expires, path, domain, secure, and sameSite.
SX.Cookie.list(): Returns an object containing all current cookies.
SX.Cookie.delete(string:name,object:options): Deletes a specific cookie by its name.
SX.Cookie.clear(object:options): Deletes all cookies available in the current scope.
SX.LocalStorage
Provides a structured API for managing browser LocalStorage with auto-parsing and safe operations.
SX.LocalStorage.get(string:key): Retrieves the value associated with the specified key, parsed from JSON.
SX.LocalStorage.set(string:key,mixed:value): Stores a value under the specified key, automatically stringifying it as JSON.
SX.LocalStorage.list(): Returns an object containing all key-value pairs in LocalStorage.
SX.LocalStorage.delete(string:key): Deletes a specific key from LocalStorage.
SX.LocalStorage.clear(): Clears all data from LocalStorage.
SX.LocalStorage.size(): Returns the number of stored items in LocalStorage.
SX.SessionStorage
Provides a similar API to LocalStorage but scoped to the current browser session only.
SX.SessionStorage.get(string:key): Retrieves the value associated with the specified key from SessionStorage.
SX.SessionStorage.set(string:key,mixed:value): Stores a value under the specified key in SessionStorage.
SX.SessionStorage.list(): Returns an object containing all key-value pairs in SessionStorage.
SX.SessionStorage.delete(string:key): Deletes a specific key from SessionStorage.
SX.SessionStorage.clear(): Clears all data from SessionStorage.
SX.SessionStorage.size(): Returns the number of stored items in SessionStorage.
Customize Functions and Namespaces
You can extend SoixamUI by defining your own custom functions or namespaces using the following methods:
SoixamUI provides a variety of form control components that are fully styled and responsive out of the box. These controls are designed to maintain consistency across your application, with built-in support for light/dark modes, disabled states, and different visual themes.
@soixam.org
Disabled Button:
Dark / Light Mode:
Loader:
Notification Dialogs:
Prompt Dialogs:
Note
Notes are used to highlight important messages or reminders within the application. They come in multiple color variations to represent different types of alerts or information.