Repository navigation
Releases: qvelop/humal
Release list
Humal 1.4.0
Added
- Browser runtime: a
webnamespace for accessing browser functionality from Humal. - DOM helpers:
web.element(),web.text(),web.value(), andweb.button()for working with page elements. - Event handling:
web.on(),web.off(), andweb.button().onClick()for registering and removing event listeners. - Browser API access: access to
window,document,navigator, Fetch, Web Crypto, and other available browser APIs. - Storage support: convenient lowercase aliases for Local Storage, Session Storage, and IndexedDB.
- Asynchronous browser code: browser programs can use Humal's
async fnandawaitsyntax. - Parcel transformer: a custom transformer that compiles
.humfiles and connects browser applications to the Humal Web runtime. - Browser environment configuration: the
envoption inhumal.config.jsonallows projects to select browser-specific tooling behavior. - Browser input compatibility: browser handling for programs that use Humal's
inputsyntax.
Improvements
- Runtime validation: browser-only functionality reports a clear error when used outside a browser.
- Element handling: DOM helpers accept CSS selectors and supported existing element objects.
- Error reporting: missing elements and invalid event callbacks produce explicit errors.
- Browser method binding: callable browser properties are bound to the appropriate context when needed.
- Constructor handling: browser constructors are distinguished from regular methods.
- Cleaner UI code: common DOM operations can be expressed with Humal helpers.
- Tooling integration: browser projects can use browser-specific type declarations and lint configuration when the project tooling is configured for
env: "browser".
Getting started
1. Install Humal
npm install -g @qvelop444/humal2. Create a browser project
Run:
humal init myapp --env browser
cd myapp
npm installHumal initializes the browser project, including the configuration, HTML entry point, Parcel configuration, and npm scripts.
The generated project structure is:
myapp/
├── index.html
├── .parcelrc
├── humal.config.json
├── package.json
├── .gitignore
└── src/
└── main.hum
3. Browser environment configuration
Humal creates humal.config.json with the browser environment enabled:
{
"entry": "src/main.hum",
"sourceDir": "src",
"module": "esm",
"env": "browser",
"webEntry": "index.html"
}The env option enables browser-specific tooling behavior. The webEntry option identifies the HTML entry point used by Parcel.
4. Write your first browser application
The generated index.html references src/main.hum. Replace the contents of src/main.hum with:
web.document.title = "Humal Web"
web.text("#status", "Ready")
fn saveName()
let name = web.value("#name")
web.localstorage.setItem("name", name)
web.text("#status", "Saved: " + name)
web.value("#name", web.localstorage.getItem("name") ?? "")
web.button("#save").onClick(saveName)This example demonstrates DOM manipulation, event handling, and persistent browser storage using Humal syntax.
5. Run the development server
Start Parcel through Humal:
npm run dev:webOpen the local URL printed by Parcel in your terminal, usually http://localhost:1234/.
Create a production build with:
npm run build:webThe production build is written to Parcel's output directory, normally dist/.
Manual Parcel configuration
This section is intended for existing projects that want to add Humal Web without using the browser project template.
Install the required packages:
npm install --save-dev parcel @qvelop444/humalCreate a .parcelrc file in the project root:
{
"extends": "@parcel/config-default",
"transformers": {
"*.hum": [
"./node_modules/@qvelop444/humal/src/parcel.js"
]
}
}The relative path points to Humal's Parcel transformer inside the installed npm package. Parcel uses this transformer to compile .hum files into JavaScript.
Configure the npm scripts in package.json:
{
"scripts": {
"dev:web": "humal dev:web",
"build:web": "humal build:web"
}
}Ensure that humal.config.json specifies "env": "browser" and that index.html references the correct .hum entry point.
The web API
DOM helpers
| API | Description |
|---|---|
web.document |
Access the browser document |
web.window |
Access the browser window |
web.element(target) |
Resolve a selector or element |
web.text(target, value) |
Set an element's text |
web.value(target) |
Read an element's value |
web.value(target, value) |
Set an element's value |
web.button(target) |
Access button helper methods |
web.on(target, event, callback, options) |
Register an event listener |
web.off(target, event, callback, options) |
Remove an event listener |
web.ready(callback) |
Run a callback when the DOM is ready |
web.alert(message) |
Show a browser alert |
The button helper supports .onClick(), .text(), and .disable().
Browser API aliases
Humal Web provides lowercase aliases for selected browser APIs:
web.localstorage
web.sessionstorage
web.indexeddb
web.urlsearchparams
web.abortcontroller
web.intersectionobserver
web.mutationobserver
web.resizeobserver
web.websocket
web.sharedworker
web.broadcastchannel
web.textencoder
web.textdecoder
web.formdata
web.filereader
These aliases expose the corresponding browser objects through the web namespace. Their availability depends on browser support and the execution environment.
Network requests and asynchronous code
async fn loadData()
let response = await web.fetch("/api/data")
if !response.ok
throw new Error("Request failed")
let data = await response.json()
web.text("#status", JSON.stringify(data))
web.button("#load").onClick(loadData)Network errors and HTTP error responses should be handled separately. For example, fetch() does not normally reject just because a server responds with status 404 or 500; check response.ok or response.status.
Install the VS Code extension
Download the .vsix file, then in VS Code go to the Extensions view, click the three dots, select Install from VSIX..., and choose the downloaded .vsix file.

Humal 1.3.0
Added
- Added
switchstatement support. - Added indentation-based
caseclauses. - Added
defaultclause support. - Added support for multiple
caselabels and JavaScript fall-through behavior. - Added support for
breakinsideswitch. - Added support for JavaScript expressions in
caseconditions. - Added support for nested
switchstatements. - Added support for existing Humal constructs inside
casebodies.
Examples
Basic switch
let value = 2
switch value
case 1
print "one"
break
case 2
print "two"
break
default
print "other"
Multiple case labels
let value = 2
switch value
case 1
case 2
case 3
print "one, two or three"
break
default
print "other"
Expressions in case
let value = 10
switch value
case 5 + 5
print "expression works"
break
default
print "no match"
Improvements
- Improved indentation handling for
switchstatements. - Enhanced compiler support for JavaScript control flow constructs.
- Continued focus on keeping Humal syntax close to JavaScript while using indentation instead of block punctuation.
- Improved the VS Code extension: the global Humal Dark theme was removed, and syntax handling was enhanced.
Install the VS Code extension
Download the .vsix file, then in VS Code go to the Extensions view, click the three dots, select Install from VSIX..., and choose the downloaded .vsix file.

Humal 1.2.0
Added
- humal check for TypeScript and ESLint validation
- humal fmt for Humal source formatting
- humal watch for automatic rebuilding
- humal dev for development mode with automatic rebuild and restart
- Integrated TypeScript, ESLint and Prettier tooling
Improved
- Improved CLI workflow
- Improved project configuration with humal.config.json
- Improved build and development workflow
Fixed
- Fixed watcher process exiting immediately
- Improved handling of build and tooling errors
- Improved temporary file cleanup
The Humal VS Code extension itself remains unchanged in this release. Below, you will find the .vsix file and installation instructions.
Install the VS Code extension
Download the .vsix file, then in VS Code go to the Extensions view, click the three dots, select Install from VSIX..., and choose the downloaded .vsix file.

Humal 1.1.0
Humal 1.1.0
Compiler
- Improved the compiler's internal architecture and structure.
- Implemented stricter handling of strings, escape sequences, and comments.
- Improved error reporting with line and column indicators in the source code.
- Enhanced indentation checking via a new "Linear Indentation Tracker" mechanism.
- Added structured parsing for Humal language constructs.
- Improved import and export handling for ESM and CommonJS modules.
- Improved input data processing.
- Enhanced compatibility with JavaScript syntax, including object literals and object destructuring.
- Added validation for generated JavaScript code.
- Added basic Source Map support for linking and debugging generated JavaScript against Humal source code.
- Improved preservation of source code line mappings during code transformations.
The Humal VS Code extension itself remains unchanged in this release. Below, you will find the .vsix file and installation instructions.
Install the VS Code extension
Download the .vsix file, then in VS Code go to the Extensions view, click the three dots, select Install from VSIX..., and choose the downloaded .vsix file.

