solverforge-ui
Frontend component library for SolverForge constraint-optimization applications. Emerald-themed, zero-framework, vendor-ready. One line to mount, zero npm in the runtime integration path, zero webpack.
// Cargo.toml
solverforge-ui =
// main.rs
let app = router
.merge // serves /sf/*
.fallback_service;
That's it. Every asset is compiled into the binary via include_dir!.
Shipped vs Planned
This repository keeps both shipped UI code and design exploration in the same tree.
- Shipped features are the ones implemented in
js-src/, or exposed as documented optional modules understatic/sf/modules/, and described in the API reference below. - Planned or exploratory ideas may appear in CSS or wireframes before the public API is finished. Those should not be treated as supported integration surface until they are wired into a shipped asset and described in the README API reference.
- When adding new surface area, update the JavaScript API, README, and runnable examples in the same change so the public contract stays explicit.
For production caching, versioned bundle filenames are also emitted as
/sf/sf.<crate-version>.css and /sf/sf.<crate-version>.js. Those versioned
files are served with immutable caching, while the stable sf.css and sf.js
paths remain available for compatibility.
Screenshots
Planner123 — Gantt chart with split panes, project-colored bars, and constraint scoring:

Furnace Scheduler — Timeline rail with resource cards, temperature/load gauges, and positioned job blocks:

Philosophy
Every backend element has a corresponding UI element. The library grows
alongside the solver. When you scaffold a new SolverForge project with
solverforge new, it's already wired in.
Testing
Repository coverage now includes the embedded Rust asset routes plus Node-based
frontend tests for backend adapters, focused solver lifecycle suites, and core
component rendering. Use make test for the full suite, make test-quick for
Rust doctests, Rust unit tests, frontend Node coverage, and browser smoke
tests, or make test-frontend when you only want the JavaScript suite.
Use make lint-frontend for ESLint on js-src/, tests/, and scripts/, or
make lint to run the Rust and JavaScript lint surfaces together.
Quick Start
API Reference
Components
| Factory | Returns | Description |
|---|---|---|
SF.createHeader(config) |
HTMLElement |
Sticky header with logo, title, nav tabs, and optional solve/pause/resume/cancel/analyze actions |
SF.createStatusBar(config) |
{el, bindHeader, updateScore, setSolving, updateMoves, colorDotsFromAnalysis} |
Score display + constraint dot indicators; pass header or call bindHeader() if it should toggle local solve/stop controls |
SF.createButton(config) |
HTMLButtonElement |
Button with variant/size/icon/shape modifiers |
SF.createModal(config) |
{el, body, open, close, setBody} |
Dialog with emerald gradient header, backdrop, Escape key |
SF.createTable(config) |
HTMLElement |
Data table with headers and row click |
SF.createTabs(config) |
{el, show} |
Tab panel container with instance-scoped tab switching |
SF.createFooter(config) |
HTMLElement |
Footer with links and version |
SF.createApiGuide(config) |
HTMLElement |
REST API documentation panel |
SF.showToast(config) |
void |
Toast notification (auto-dismiss) |
SF.showError(title, detail) |
void |
Danger toast shorthand |
SF.showTab(tabId, root?) |
void |
Activate matching tab panels in every tab container, or only within root when provided |
Unsafe HTML APIs (opt-in)
Default content is always text-rendered. Use these fields only with trusted HTML:
| Factory | Unsafe HTML field |
|---|---|
SF.el(tag, attrs, ...) |
unsafeHtml |
SF.createModal(config) |
unsafeBody |
SF.createTabs(config) |
tabs[].content.unsafeHtml |
SF.createTable(config) |
cells[].unsafeHtml |
SF.gantt.create(config) |
unsafePopupHtml, columns[].render(task).unsafeHtml |
Rail Scheduling
| Factory | Returns | Description |
|---|---|---|
SF.rail.createTimeline(config) |
{el, setModel, setViewport, expandCluster, destroy} |
Canonical dense scheduling timeline with sticky time header, sticky lane labels, synchronized horizontal viewport, drag-to-pan, zoom presets, weekend shading, overlays, overview clustering, and packed detailed lanes |
SF.rail.createHeader(config) |
HTMLElement |
Low-level day/period header primitive for furnace-style rail layouts |
SF.rail.createCard(config) |
{el, rail, addBlock, clearBlocks, setSolving, setUnassigned} |
Low-level resource lane primitive with identity, gauges, stats, and block rail |
SF.rail.addBlock(rail, config) |
HTMLElement |
Low-level positioned block (task/job) inside a primitive rail |
SF.rail.addChangeover(rail, config) |
HTMLElement |
Low-level diagonal-striped gap between primitive blocks |
SF.rail.createHeatmap(config) |
HTMLElement | null |
Optional low-level heatmap strip aligned with a rail card |
SF.rail.createUnassignedRail(tasks, onTaskClick) |
HTMLElement |
Optional low-level unassigned-pill row |
Gantt (Frappe Gantt)
| Factory | Returns | Description |
|---|---|---|
SF.gantt.create(config) |
{el, mount, setTasks, refresh, changeViewMode, highlightTask, destroy} |
Split-pane Gantt with grid table + Frappe Gantt chart |
Solver Lifecycle
| Factory | Returns | Description |
|---|---|---|
SF.createBackend(config) |
Backend adapter | HTTP or Tauri IPC transport |
SF.createSolver(config) |
{start, pause, resume, cancel, delete, getSnapshot, analyzeSnapshot, isRunning, getJobId, getLifecycleState, getSnapshotRevision} |
Shared job lifecycle orchestration around typed runtime events, exact paused snapshots, retained analysis, and terminal cleanup |
Startup streams may begin with either a scored progress event or a scored
best_solution event. Consumers must not require progress to arrive first.
Canonical stream payloads:
Runtime rules:
- The first lifecycle event for a newly started solve may be
progressorbest_solution, but it must already be scored. - Backends that bootstrap startup state from a retained snapshot must not follow it with an identical startup
best_solutionduplicate. progressis metadata-only. It must not carry the solution payload.best_solutionmust includesolutionandsnapshotRevision.pause_requesteddoes not imply that a checkpoint is ready yet.paused,completed,cancelled, andfailedare authoritative lifecycle events.SF.createSolver()syncs the retained snapshot before firing the corresponding callbacks.- HTTP
EventSource.onerroris transport state. Reconnecting errors are ignored; a closed stream is surfaced throughonErrorand resets local controls to idle while retaining the job id for snapshot and analysis calls. - The status bar uses
currentScoreas the live score during solving. - Missing or malformed typed lifecycle fields are ignored; they are not silently normalized into the contract.
Utilities
| Function | Description |
|---|---|
SF.score.parseHard(str) |
Extract hard score from "0hard/-42soft" |
SF.score.parseSoft(str) |
Extract soft score |
SF.score.parseMedium(str) |
Extract medium score |
SF.score.getComponents(str) |
{hard, medium, soft} |
SF.score.colorClass(str) |
"score-green" / "score-yellow" / "score-red" |
SF.colors.pick(key) |
Tango palette color for any key (cached) |
SF.colors.project(index) |
{main, dark, light} from 8-color project palette |
SF.colors.reset() |
Clear the color cache |
SF.escHtml(str) |
HTML-escape a string |
SF.el(tag, attrs, ...children) |
DOM element factory |
Button Variants
// white bg, emerald text
// red bg, white text
// emerald-700 bg
// gray border
Rail Scheduling
SF.rail.createTimeline() is the canonical read-only scheduling surface.
It accepts a normalized numeric model only; backend timestamp parsing and
timezone policy stay outside the library.
Every minute field and viewport boundary must already be an integer number of
minutes.
String timestamps, Date objects, numeric strings, and fractional minutes are
rejected instead of being coerced inside the library.
Malformed tick objects and overlay spans are rejected instead of being silently
dropped during normalization.
Layout density is derived from the actual timeline body viewport, not padded
wrappers or outer card chrome.
labelWidth is the preferred sticky-label width; supported embeds with a body
viewport of 500px or wider compact that label column as needed to preserve at
least 320px of visible schedule track.
Use mode: 'overview' for scanable location or resource lanes, and
mode: 'detailed' for precise per-person or per-assignment inspection.
Overview blocks can carry additive summary metadata and expose the same detail
via keyboard focus that hover reveals with a mouse.
Model shape:
model.axis:startMinute,endMinute,days[],ticks[],initialViewportmodel.lanes[]:id,label, optionalbadges, optionalstats, optionaloverlays,mode,items[]items[]:id,startMinute,endMinute,label, optionalmeta, optionalsummary,tone, optionalclusterId, optionaldetailItems[]overlays[]: either numeric spans viastartMinute/endMinuteor full-day bands viadayIndex/dayCount
Additive overview summary contract:
summary.primaryLabel: optional aggregate block headlinesummary.secondaryLabel: optional aggregate block sublinesummary.count: optional explicit total count for the overview blocksummary.openCount: optional explicit open or unassigned countsummary.toneSegments[]: optional additive tone-composition hint with{ tone, count }
These fields are additive per field, not an all-or-nothing summary mode. If a
group mixes summarized and unsummarized items, the library combines the explicit
summary fields with derived count/open/tone data from the remaining grouped
items. Use explicit summary when the app already knows the aggregate staffing
signal it wants overview users to see first.
If a summary item overrides aggregate count beyond the number of concrete
backing items the library can inspect, omitted openCount and omitted
toneSegments remain unknown and are not rendered. In that case, provide
summary.openCount and summary.toneSegments explicitly if you want those
aggregate signals shown.
Integer-only fields remain integer-only:
- all time-bearing minute fields on
axis,days,ticks,items,overlays, andinitialViewport model.lanes[].overlays[].dayIndexmodel.lanes[].overlays[].dayCount
If you want stable programmatic expansion through expandCluster(laneId, clusterId),
provide clusterId on the overlapping overview items that should expand together.
Each lane may produce at most one overview group for a given clusterId; reusing
the same clusterId for disjoint groups is rejected as ambiguous input.
Expanded overview clusters remain clickable inside the component and use the
same block as the collapse affordance.
The example below assumes small consumer-side helpers such as buildDays() and
buildSixHourTicks() that normalize backend timestamps into numeric axis data.
var timeline = SF..;
container.;
timeline.;
timeline.;
Returned timeline API:
elsetModel(model)setViewport(viewport)expandCluster(laneId, clusterId | null)destroy()
Low-Level Rail Primitives
Use these when you want to assemble a custom furnace-style resource rail manually instead of using the higher-level scheduling timeline.
var header = SF..;
container.;
var card = SF..;
container.;
card.;
SF..;
card.;
card.;
Gauge styles: heat (blue→amber→red), load (emerald→amber→red), emerald (solid green).
badges accepts either strings or { label, style } objects for extra resource metadata.
Gantt Chart
Interactive task scheduling with Frappe Gantt. Split-pane layout: task grid on top, SVG timeline chart on bottom. Drag to reschedule, resize to change duration, sortable grid columns, project-colored bars, dependency arrows, and pinned task styling.
var gantt = SF..;
gantt.;
gantt.;
gantt.;
gantt.;
View modes: Quarter Day, Half Day, Day, Week, Month.
Sortable headers are opt-in per column via sortable: true.
Backend Adapters
Axum (default)
var backend = ;
Expects standard SolverForge REST endpoints:
POST /jobs— create a retained jobGET /jobs/{id}— get job summary/statusGET /jobs/{id}/status— get job status summaryGET /jobs/{id}/snapshot— get the latest or requested retained snapshotGET /jobs/{id}/analysis— analyze the latest or requested retained snapshotPOST /jobs/{id}/pause— request an exact runtime-managed pausePOST /jobs/{id}/resume— resume from the retained checkpointPOST /jobs/{id}/cancel— cancel a live or paused jobDELETE /jobs/{id}— delete a terminal retained jobGET /jobs/{id}/events— SSE streamGET /demo-data/{name}— load demo dataset
Backend contract expectations:
createJob()must resolve to a plain job id (string), or an object containing one ofid,jobId, orjob_id.getSnapshot()andanalyzeSnapshot()accept an optionalsnapshotRevision.SF.createSolver()uses the exact revision from paused and terminal events when it syncs the retained state.pauseJob()requests a pause.SF.createSolver().pause()resolves only after the authoritativepausedevent and snapshot sync complete.resumeJob()resolves through the runtime event stream.SF.createSolver().resume()settles on the authoritativeresumedevent.cancelJob()settles through the runtime event stream.SF.createSolver().cancel()resolves when the terminal event has been synchronized.deleteJob()is destructive cleanup for terminal retained jobs only.- Events passed into
streamJobEvents()for a job should include one of the same identifiers if multiple solver runs are possible. - Tauri payloads are ignored only when they carry a different job id than the active run; id-less single-run updates still pass through.
- Solver lifecycle events are canonical camelCase only:
eventType,jobId,eventSequence,lifecycleState,snapshotRevision,currentScore,bestScore,telemetry, andsolutionwhere required. eventTypemust be explicit. Supported values areprogress,best_solution,pause_requested,paused,resumed,completed,cancelled, andfailed.- Raw score-only progress payloads and implicit completion heuristics are not part of the supported stream contract.
Tauri
var backend = ;
Generic fetch (Rails, etc.)
var backend = ;
Optional Modules
Map (Leaflet)
var map = SF..;
map.;
map.;
map.;
map.;
map.;
map.; // dim all routes except this color
map.;
SF..; // Google polyline algorithm
Design System
Colors
| Token | Hex | Usage |
|---|---|---|
--sf-emerald-500 |
#10b981 |
Primary brand, success states |
--sf-emerald-600 |
#059669 |
Primary dark |
--sf-emerald-700 |
#047857 |
Primary buttons, links |
--sf-red-600 |
#dc2626 |
Danger buttons, hard violations |
--sf-amber-500 |
#f59e0b |
Warnings, soft violations |
--sf-gray-50 |
#f9fafb |
Backgrounds |
--sf-gray-900 |
#111827 |
Primary text |
8 project colors for assignment: emerald, blue, purple, amber, pink, cyan, rose, lime.
Fonts
- Space Grotesk (body, headings) — variable weight 300-700, self-hosted WOFF2
- JetBrains Mono (code, scores, data) — variable weight 100-800, self-hosted WOFF2
Spacing
--sf-space-{0,1,2,3,4,5,6,8,10,12,16} — 0 to 4rem in quarter-rem increments.
Shadows
--sf-shadow-{sm,base,md,lg,xl,2xl} — elevation scale.
--sf-shadow-emerald — colored shadow for branded elements.
Animations
sf-spin / sf-dot-pulse / sf-score-flash / sf-dialog-slide-in / sf-breathe / sf-slide-in / sf-fade-in / sf-late-glow
Project Structure
solverforge-ui/
├── Cargo.toml # 2 deps: axum + include_dir
├── src/lib.rs # routes() + asset serving
├── Makefile # bundles css-src/ + js-src/ into sf.css + sf.js
├── .github/workflows/ # CI, release, and publish automation
├── css-src/ # 20 CSS source files (numbered for concat order)
│ ├── 00-tokens.css # design system variables
│ ├── 01-reset.css # box-sizing reset
│ ├── 02-typography.css # @font-face declarations
│ ├── 03-layout.css # .sf-app, .sf-main, tab panels
│ ├── 04-header.css # .sf-header
│ ├── 05-statusbar.css # .sf-statusbar + constraint dots
│ ├── 06-buttons.css # .sf-btn variants
│ ├── 07-modal.css # .sf-modal
│ ├── 08-table.css # .sf-table + constraint analysis table
│ ├── 09-badges.css # .sf-badge variants
│ ├── 10-cards.css # .sf-card, .sf-kpi-card
│ ├── 11-tooltip.css # .sf-tooltip
│ ├── 12-footer.css # .sf-footer
│ ├── 13-scrollbars.css # custom webkit scrollbars
│ ├── 14-animations.css # @keyframes + toast + api guide
│ ├── 15-rail-resources.css # resource cards, gauges, resource layout
│ ├── 16-rail-blocks.css # rail blocks, changeovers, unassigned styles
│ ├── 17-gantt-layout.css # split layout, grid table, view controls
│ ├── 18-gantt-bars.css # Frappe bar overrides, pinned/highlighted bars
│ └── 19-rail-timeline.css # canonical scheduling timeline
├── js-src/ # 17 JS source files
│ ├── 00-core.js # SF namespace, escHtml, el()
│ ├── 01-score.js # score parsing
│ ├── 02-colors.js # Tango palette + project colors
│ ├── 03-buttons.js # createButton()
│ ├── 04-header.js # createHeader()
│ ├── 05-statusbar.js # createStatusBar()
│ ├── 06-modal.js # createModal()
│ ├── 07-tabs.js # createTabs(), showTab()
│ ├── 08-table.js # createTable()
│ ├── 09-toast.js # showToast(), showError()
│ ├── 10-backend.js # createBackend() — axum/tauri/fetch
│ ├── 11-solver.js # createSolver() — SSE state machine
│ ├── 12-api-guide.js # createApiGuide()
│ ├── 13-rail.js # low-level rail header, cards, blocks, changeovers
│ ├── 13a-rail-timeline.js # canonical scheduling timeline
│ ├── 14-gantt.js # Frappe Gantt wrapper (split pane, grid, chart)
│ └── 15-footer.js # createFooter()
└── static/sf/ # Embedded assets (include_dir!)
├── sf.css # concatenated from css-src/
├── sf.js # concatenated from js-src/
├── img/ # SVG logo asset (ouroboros)
├── fonts/ # Space Grotesk + JetBrains Mono WOFF2
├── modules/ # optional: sf-map.js/css
└── vendor/ # FontAwesome 6.5, Leaflet 1.9, Frappe Gantt, Split.js
Integration Paths
| Project Type | How It Works |
|---|---|
| Axum | Add crate dep, call .merge(solverforge_ui::routes()) |
| Tauri | Add crate dep, serve via Tauri's asset protocol or custom command |
| Rails | Copy static/sf/ into public/sf/, reference in layouts |
| Any HTTP server | Copy static/sf/, serve as static files |
solverforge new |
Automatic — wired into generated project |
Non-Rust Projects
The static/sf/ directory is self-contained. Copy it, git-submodule it,
or symlink it into any project that serves static files:
# git submodule
Development
# Edit source files
# Rebuild concatenated files
# Run frontend lint
# Compile the crate (embeds updated assets)
Release Workflow
Consumer integration stays npm-free. Maintainer release automation does not.
- Current crate release:
0.5.2. - Keep
CHANGELOG.mdcurrent as work lands. - Use
RELEASE.mdas the source of truth when preparing a public release. - Run
make pre-releasebefore tagging. - Runtime and application integration use only the bundled static assets and the Rust crate.
- Version bump targets in
Makefilecurrently usenpx commit-and-tag-version. - The GitHub and Forgejo release workflows trigger only after the generated
v*tag is pushed. - Release and publish validation otherwise run through Cargo and GitHub Actions.
If you are cutting a release locally, make sure Node.js with npx is available before using the bump-* targets. After the bump completes, push the release commit and tag with git push --follow-tags or an equivalent tag-push command so the release automation actually starts.
Package Verification
Use make package-verify to inspect the exact crate contents that would be published.
The verification step checks that required bundled assets and crate metadata are present, and that development-only sources such as css-src/, js-src/, scripts/, and screenshots are not shipped in the published crate.
Bundling writes both stable compatibility assets (static/sf/sf.css,
static/sf/sf.js) and versioned assets (static/sf/sf.<version>.css,
static/sf/sf.<version>.js).
Demo Fixtures
Runnable demo fixtures live in demos/.
demos/full-surface.htmlexercises the primary shipped component surface together.demos/timeline.htmlis the focused dense scheduling example built withSF.rail.createTimeline(), including additive overview summaries and inline expand/collapse.demos/timeline-dense.htmlis the repeatable 28-day, 100-lane, 1500-item dense validation fixture for hospital-like schedule acceptance.demos/rail.htmlfocuses on the low-level rail primitives: resource cards, blocks, gauges, and changeovers.make demo-serveserves the repository athttp://localhost:8000/demos/for local validation.make test-browserruns browser-level smoke tests against the shipped demo fixtures and refreshes the timeline acceptance screenshots inscreenshots/.- Run
make browser-setuponce on a machine to install the Playwright test dependency and Chromium.
Acknowledgments
solverforge-ui builds on these excellent open-source projects:
| Project | Use | License | Link |
|---|---|---|---|
| Font Awesome Free | Icons (Solid subset) | CC BY 4.0 (icons), SIL OFL (fonts), MIT (code) | github |
| Frappe Gantt | Interactive Gantt chart | MIT | github |
| Split.js | Resizable split panes | MIT | github |
| Leaflet | Interactive maps (optional module) | BSD-2-Clause | github |
| Space Grotesk | Body typeface | SIL Open Font License 1.1 | github |
| JetBrains Mono | Monospace typeface | SIL Open Font License 1.1 | github |
| Axum | Rust web framework | MIT | github |
| include_dir | Compile-time file embedding | MIT | github |
License
Apache-2.0