lib

Changelog

All notable changes to CrootJS. Versions are git tags, served by jsDelivr as https://cdn.jsdelivr.net/gh/crootjs/lib@<version>/<module>.js; each is also a GitHub release.

0.0.43 - 2026-11-25

Our own .min.css files, with SRI hashes

0.0.42 - 2026-11-25

SRI hashes in every release, and bump-pins.py for your own project

0.0.41 - 2026-11-24

ui.css, themes.css and tabs.js: app components, four themes, and page patterns

0.0.40 - 2026-11-24

Release commits on the dist branch, modulepreload lists, paused results

0.0.39 - 2026-11-24

api.js: rewrap the getJSON comment; regenerate crootjs.d.ts (0.0.38 shipped a stale comment)

0.0.38 - 2026-11-24

.min.js files that import .min.js, typed api.js options, rate-limit pause for first visitors

0.0.37 - 2026-11-24

getJSON cache fixes: callbacks always asynchronous, select errors, rate-limit pause

0.0.36 - 2026-11-24

openapi.js: API documentation without Swagger UI, and yaml.js

0.0.35 - 2026-11-24

getJSON cache: stale data on failure, entries tied to their URL, select

0.0.34 - 2026-11-24

toast.js is announced by screen readers and readable in dark mode

0.0.33 - 2026-11-24

Dashboard modules (router, table, chart, icons), markdown, QR codes, PWA, and auth.js without third-party scripts

0.0.32 - 2026-11-23

croot.min.css is minified again

0.0.31 - 2026-11-23

croot.css: a small, green CSS framework

0.0.30 - 2026-11-23

Uploads with progress, form validation, offline tile cache, vector PMTiles, keyboard drawing, 3D measuring and in-page AR

0.0.29 - 2026-11-23

api.js options and response headers, storage.js survives blocked storage

Based on feedback from using api.js and storage.js on a static landing page.

0.0.28 - 2026-11-11

PMTiles on servers that break HTTP Range

0.0.27 - 2026-11-11

Address search, offline PMTiles maps, 3D models on the map, skinning, Draco, AR, English docs

0.0.26 - 2026-11-11

Map drawing, awaitable api.js, tests and type declarations

0.0.25 - 2026-11-11

3D animation, exploded view and cross-sections

Tools for interactive 3D learning material.

model3dtools.js

model3d.js - clip plane support in the shader and in picking; fitView accepts an array of part names.

Example: 3D learning material - anatomy of a BTS tower.

0.0.24 - 2026-11-11

3D model viewer without Three.js

model3d.js (new) - a glTF 2.0 viewer (.glb and .gltf) written from scratch, with no Three.js: its own binary GLB parser, matrix math and shaders, on WebGL2 with an automatic WebGL1 fallback. About 14 KB gzipped.

model3dtools.js (new) - addHotspot (HTML labels pinned to a part or point, dimmed when hidden behind the model), enableTransform (translate/rotate/scale gizmo for mouse and touch, Shift snaps rotation to 15°), and exportGLB / downloadGLB (the edited model, with transforms, colors and hidden parts, as a single .glb).

Examples: 3D model viewer and BTS antenna editor.

0.0.23 - 2026-10-31

Right-click context menu for maps

mapcontrol.js - addContextMenu(id, items, options): a right-click menu for GIS actions. It opens on right-click, a 0.5 s touch long-press (also on iPhone) or Menu/Shift+F10 on the focused map. items may be a function (position, feature) => [...] so the menu changes with what is under the pointer. Items support icons, disabled, danger, separators and submenus, plus built-ins "coordinates" (shows and copies lat, lng), "center", "zoom-in" and "zoom-out". Keyboard navigation, ARIA, dark mode, edge flipping and larger touch targets.

map.js - onMapContextMenu(id, fn) for building your own menu. The browser’s menu is only suppressed while a listener exists, and never inside popups or controls. A tap followed by a long-press no longer zooms the map.

mapheat.js - addGridMap returns cellAt(position), for showing a cell’s value in the context menu.

0.0.22 - 2026-10-31

Heatmaps and coverage grids

mapheat.js (new) - heatmaps and coverage grids from point data (GeoJSON points or [lng, lat, value] arrays), drawn on one canvas above the basemap and below addGeoJSON layers.

Both return { setData, setOptions, show, hide, remove }.

maptools.js - exportMapImage includes heatmaps and grids in the PNG.

0.0.21 - 2026-10-31

Wider basemap cards

Reported by the NetDet maps team: “OpenStreetMap” was cut in the middle of the word.

mapcontrol.js - basemap cards are 92 px wide by default (thumbnail 72 px), set by one CSS variable, --crootjs-map-card-width. Names wrap between words and only break a word that cannot fit a line by itself.

0.0.20 - 2026-10-31

Picture-card basemap picker

Requested by the NetDet maps team: a basemap picker like the layer picker in Google Maps / nPerf.

mapcontrol.js - addBasemapControl(id, basemaps, { style: "cards" }) shows the active basemap as a picture card; hovering (mouse) or tapping opens a grid of cards. Card images come from a basemap’s thumbnail, or its own tile at thumbnailCenter/thumbnailZoom, with its label tiles on top. Options trigger, columns (at most 2 on screens up to 640 px), keyboard and ARIA support, and dark mode. The default style stays "list".

New setBasemap(id, nameOrIndex) switches through the map’s picker, keeping it in sync and calling onChange.

0.0.19 - 2026-10-30

Boxed labels in PNG export

Reported by the NetDet maps team: labels with a background box were exported as white text without the box.

maptools.js - exportMapImage draws labels and overlay HTML from their computed CSS: background, border, border-radius, padding, multi-line text, opacity and ::before/::after content, each word where the browser laid it out. text-shadow becomes the halo. Cluster bubbles and the location dot are included too.

All map modules - the injected <style> now goes at the start of <head> instead of the end, so page CSS with the same specificity overrides the map’s defaults without !important.

0.0.18 - 2026-10-30

Canvas renderer, measuring, image overlays and PNG export

The rest of the NetDet maps brief: technical and survey maps.

map.js - canvas renderer and simplification - addGeoJSON(..., { renderer: "canvas" }) draws a layer on one canvas instead of one SVG element per shape; style (including dashes), popups, hoverStyle, tooltips, labels and onMapClick still work. 5,600 lines pan/zoom in less than half the time of SVG. simplify applies Douglas-Peucker per zoom level (a 2,000-point line becomes 36 points at zoom 10). New setZoomRange(id, minZoom, maxZoom).

maptools.js (new) - addMeasureControl / measure (distance and area by clicking points), addImageOverlay (georeferenced images by bounds + rotation, or three corners for rotate/scale/skew), and exportMapImage / downloadMapImage (PNG of the basemap, overlays, SVG and canvas layers, labels, markers, measurements, scale bar and attribution).

mapcontrol.js - addCoordinateControl (cursor coordinates, click to pin and copy, format hook for local grids) and addFullscreenButton (Fullscreen API, full-window fallback on iPhone Safari).

geomeasure.js - createAffineTransform(from, to) fits an affine transform from three or more control points (least squares), with inverse and RMS error: CAD grid or image pixels to [lng, lat] and back.

0.0.17 - 2026-10-30

Named layers, labels and basemap switching

Requested by the NetDet maps team, whose app had to work around these.

map.js - basemaps - maxNativeZoom (overzoom: tiles of that level are scaled up instead of left blank), labels (transparent label tiles over the base tiles, for satellite + labels = hybrid), {s}/{r}/{-y} in tile URLs with a subdomains option, and errorTiles for tiles that fail to load. New setTiles(id, tiles, options) swaps the basemap without recreating the map: layers, markers, the open popup and the view stay, and the old tiles stay until the new ones have loaded, so the map never blinks. Attribution reads “CrootJS basemap layer sources” (attributionPrefix: false drops the CrootJS part).

map.js - named layers, labels, hover - addGeoJSON options name, minZoom/maxZoom, order, visible, attribution, hoverStyle, tooltip, label + labelOptions. Labels sit at the point, the middle of a line or a polygon’s centroid; colliding labels are hidden, top layer first. New showLayer, hideLayer, setLayerStyle, setLayerOrder, removeLayer, getLayers. Styles gain strokeDasharray, lineCap, lineJoin; fitMap padding may be per side.

mapmarker.js - anchor accepts top, left, right and the four corners, plus offset: [dx, dy].

mapcontrol.js - addBasemapControl (radio list calling setTiles) and addLayerControl (checkboxes for named layers), both with a collapsed mode.

0.0.16 - 2026-10-13

Clustering and live tracking

mapcluster.js (new) - addCluster(id, geojson, options?) draws the Point/MultiPoint features of very large datasets as count bubbles that split as the map zooms in. Grid clustering per zoom level, computed lazily, and only clusters in view get DOM elements, so 100,000 points pan smoothly. Options: radius, color, popup, onClick; returns remove().

mapcontrol.js - live tracking - trackUser(id, responseFunction?, options?) watches the position continuously and returns stop(); the callback gets { position, accuracy, speed, heading, timestamp } on every fix (speed m/s and heading degrees may be null), or null once if permission is denied. The map follows the position (options.follow, default true) until the user pans it manually. addTrackButton(id, responseFunction?, options?, corner?) is a toggle button for it.

map.js - onTap - onTap(element, fn) lets an overlay element handle its own tap: the map does not treat it as a map click and does not close the open popup, while a drag that starts on it still pans the map. The cluster bubbles are built on it.

0.0.15 - 2026-10-13

Map add-ons: markers, controls, measuring, routing

Optional map add-ons, 1-2 KB gzipped each. Add-ons reach the map through element.crootjsMap instead of importing map.js, so a page loading map.min.js never gets a second copy.

map.js gains onMapMove, getMapBounds, mapToPoint / pointToPosition, and addMapControl for your own element in a map corner.

0.0.14 - 2026-10-13

New module: map.js

map.js (new) - a slippy map written from scratch, with no Leaflet.

0.0.13 - 2026-10-13

New module: geo.js

geo.js (new) - read GeoJSON from a URL or a local file.

0.0.12 - 2026-09-14

QR login no longer drops late scans

auth.js - QR login no longer drops late scans - when the QR code rotated, the old socket was closed at the same instant, so a scan sent in the last seconds of a cycle reached a session with nothing behind it and the backend answered “session expired”. The old socket now stays open for wauthparam.graceperiod seconds (default 15) so a late scan still logs in.

A dropped connection (flaky network, backgrounded tab, backend redeploy) is now reported: the QR is swapped for a refresh button, rotation stops, and the new optional wauthparam.onconnectionlost callback is called. Also fixes a socket that rotated before its handshake finished and was never closed.

0.0.11 - 2026-09-11

Error callback for insertHTML and renderHTML

Both functions only had a success callback, so after v0.0.10 a failed load no longer hung but the caller still could not detect it. An optional last parameter has been added:

insertHTML(url, id, runFunction, errorFunction)
renderHTML(id, url, callback, errorCallback)

It is called with an Error when the element does not exist, the reply is non-2xx, the network fails, or the request times out. On failure the element is left unchanged and the success callback is not called. Existing three-argument calls keep working and log failures as before.

An exception thrown inside your own success callback is not reported to the error callback, so a bug in your code is not mistaken for a failed load.

Behavior change: insertHTML now treats a non-2xx reply as a failure. It previously injected the server’s error page, a 404 page for example, into the element and then called runFunction as if the load had succeeded. renderHTML already behaved this way.

Docs: https://croot.js.org/docs/api/ and https://croot.js.org/docs/element/

0.0.10 - 2026-09-11

Failure handling for the remaining api.js and element.js requests

v0.0.9 only covered the four JSON functions. Every other network call in the library had the same problem.

Docs: https://croot.js.org/docs/api/

0.0.9 - 2026-09-10

getJSON and friends no longer fail silently

getJSON, postJSON, putJSON and deleteJSON swallowed every failure: the .catch only wrote to the console and never called responseFunction, so the caller had no way to know a request had failed. A server that accepted the connection but never replied left the call pending indefinitely, because fetch() has no timeout of its own.

Docs: https://croot.js.org/docs/api/

0.0.8 - 2026-09-10

New module: toast.js, plus serializeForm

Docs: https://croot.js.org/docs/toast and https://croot.js.org/docs/element/

0.0.7 - 2026-09-10

New module: debounce.js

Adds debounce.js:

Docs: https://croot.js.org/docs/debounce

0.0.6 - 2026-09-10

New module: storage.js

Adds storage.js for localStorage and sessionStorage:

Values are serialized with JSON automatically, so objects and arrays can be stored directly. localStorage entries support an optional expiry, which the browser’s own API does not provide; expired entries are removed on read.

Docs: https://croot.js.org/docs/storage

0.0.5 - 2026-09-09

Restores the window.catcher fallback

websocket.js again calls a global window.catcher(message) when no onMessage callback is passed. v0.0.4 replaced that global with an explicit callback parameter, which broke the pattern documented for WhatsAuth. Both styles now work: pass onMessage if you have one, otherwise define window.catcher.

0.0.4 - 2026-09-09

Repairs the library so it actually loads

This release fixes bugs that made parts of the library unusable.

Breaking: openWebSocketSetId now returns a Promise that resolves with the WebSocket. It previously returned undefined in every case, so no working code can depend on the old behavior.

0.0.1 - 0.0.3 - 2026-03-03 to 2026-04-13

First releases: element.js, api.js, cookie.js, url.js and the other core helpers, the WhatsAuth QR login (auth.js, WebSocket handling, configuration), and Google Sign-In with SweetAlert2 notifications.