@tty-pt/joint logo

@tty-pt/joint

npm version License: BSD-2-Clause TypeScript Ready Node.js Native WebAssembly Zero Dependencies

Universal Node.js and Browser bindings for libjoint, the high-performance C99 interval-tree temporal presence engine. Features real-time calendar conflict detection, interval intersections, and reactive timeline controllers. Canonical C header: <ttypt/joint.h>.

๐Ÿ“– Full C & Temporal Engine Documentation: See the main libjoint GitHub README for interval-tree presence transitions (joint_start, joint_stop), constant-presence slice iteration, and C API details.


1. Quickstart & Installation

npm config set @tty-pt:registry https://tty.pt/npm/
npm install @tty-pt/joint

Native OS & Mobile Packages (tty.pt): Prebuilt native C packages (libjoint) for Linux (apt, apk, pacman, dnf), macOS (brew), Windows (winget, MSYS2), and OpenBSD (pkg_add), plus static mobile sysroots for Android (https://tty.pt/android/) and iOS (https://tty.pt/ios/ โ€” libjoint.xcframework) are available via the tty.pt package repositories.

import { JointTimeline, createTimelineController } from "@tty-pt/joint";

// 1. Initialize timeline (file-backed or in-memory)
const timeline = new JointTimeline("./schedule.joint");

// 2. Record presence / booking intervals (entityId, startUnix, endUnix)
timeline.recordInterval(101, 1793400000, 1793428800);
timeline.recordInterval(102, 1793410000, 1793440000);

// 3. Query overlapping entities across a time window
const overlaps = timeline.queryOverlaps(1793405000, 1793415000);
console.log("Conflicting entities:", overlaps); // [101, 102]

timeline.close();

2. Framework-Agnostic Reactive Timeline Controller

Provides 60/120 FPS real-time conflict tracking for interactive UI drag-and-drop calendars without any framework dependencies (works with vanilla DOM, React, Svelte, Vue):

import { JointTimeline, createTimelineController } from "@tty-pt/joint";

const timeline = new JointTimeline();
timeline.recordInterval(201, 1000, 2000);

const controller = createTimelineController(timeline);

// Subscribe to conflict changes during slider drag
const unsubscribe = controller.subscribe(({ hasConflict, conflicts }) => {
  badge.innerText = hasConflict ? `Conflict with ${conflicts.join(", ")}` : "Available";
  badge.className = hasConflict ? "text-red-500" : "text-green-500";
});

// Update range on user interaction:
slider.addEventListener("input", (e) => {
  controller.checkRange(startTime, endTime);
});

3. JavaScript / TypeScript API Reference

JointTimeline

C99 Interval-tree temporal presence engine wrapping joint_node.node / joint.wasm.

createTimelineController(timeline: JointTimeline)

Factory providing reactive state management for per-frame 60/120 FPS calendar sliders:

JointTemporalAxis

Plug-and-play CormAxis adapter for the Corm Recall Kernel (@tty-pt/corm):

getJointWasm(): WebAssembly.Instance

Returns the WebAssembly instance loaded on the Stele shared-memory substrate.


4. Dual-Engine Runtime


5. C Development Headers & Native Integration

CFLAGS += -I./node_modules/@tty-pt/joint/include
LDLIBS += -ljoint

License

BSD-2-Clause โ€” Copyright (c) 2026, Paulo Quirino <quirinpa@gmail.com>. See LICENSE.