@bluefission/reactor
v0.1.0
Published
Frontend primitives, bindings, and browser adapters for Blue Fission applications.
Maintainers
Readme
Reactor
Reactor is the shared frontend foundation for Blue Fission applications and compatible browser projects.
It exists to replace copied, project-local JavaScript with a package that has a clear API, a stable mental model, and a practical migration path from current Blue Fission frontend code. Today that means supporting legacy jQuery-heavy screens while moving reusable behavior into framework-agnostic primitives.
What Reactor is
Reactor is a small frontend library for:
- normalizing Blue Fission response payloads
- calling backend APIs with a reusable transport and CRUD layer
- expressing request and response flows with DevElation-style service objects
- managing module lifecycle for admin and dashboard screens
- modeling evented state and record collections without locking into one framework
- binding lightweight reactive state to the DOM
- rehoming legacy helpers such as templates, record sets, panels, and portlets
- bridging current jQuery-first applications into a more structured architecture
What Reactor is not
Reactor is not trying to be:
- a full UI framework
- a complete replacement for every current dashboard widget
- a forced rewrite away from jQuery
- a compiled frontend runtime with heavy build requirements
The point is to centralize the stable patterns first, then modernize the rest from a safer base.
Why this repository exists
Right now, Blue Fission frontend behavior is split across several places:
- reusable utility code in existing internal frontend modules
- app-level modules in
framework/resource/src/js/modules/app - dashboard behavior in
framework/resource/src/js/modules/dashboard-ui - project-specific copies and forks
Those codebases share the same ideas:
- CRUD API wrappers
- response parsing
- reactive record state
- dashboard module bootstrapping
- jQuery event wiring
- screen swapping and notices
They just do it inconsistently. Reactor is the consolidation layer for those ideas.
Current documentation quality
At the moment, Reactor is reasonably documented for architecture and intent, but still early in operational guidance.
It already has:
- a library-level overview in this file
- scope and acceptance criteria in
SPEC.md - a system view in
ARCHITECTURE.md - a roadmap in
ROADMAP.md - migration notes for legacy module composition
It was missing:
- a better explanation of how the pieces fit together
- a clear quick-start path
- a public API reference
- a stronger voice about what the library is trying to become
This README and the supporting docs are meant to close that gap.
The Reactor mental model
Reactor is organized around three layers:
- Core primitives Primitive helpers, response normalization, transport, state, and module lifecycle.
- Browser binding Small DOM helpers for simple reactive behavior without introducing a full renderer.
- Adapters Compatibility layers for Blue Fission conventions, jQuery-heavy screens, and extracted legacy patterns.
That separation matters. It lets us keep legacy integration support without hard-coding legacy assumptions into the permanent center of the library.
Package surface
The current public surface is:
src/core/response.jsnormalizeResponse,BlueFissionResponsesrc/core/primitives.jsValue,Arr,Obj,Str,Num,Primitive,toList,getPath,setPath,joinClassNames,toNumber, and related value helperssrc/core/transport.jscreateTransport,createResource,createResourceFromDefinition,createResourceRegistrysrc/core/signals.jsSignal,createSignal,computedsrc/core/module.jscreateModule,createModuleManagersrc/core/binding-contract.jscreateBindingContract,createBindingManifestsrc/core/behavior.jsEvents,States,BehavioralObject,createBehavioralObjectsrc/dom/binder.jsselect,selectAll,bindText,bindValue,interpolate,onsrc/dom/framework.jslegacy-compatibleEl,get,set,assign,createsrc/dom/template.jslightweight selector-based template renderingsrc/net/http.jsHttpRequest,HttpResponse,createHttpClientsrc/services/service.jscreateGateway,createServiceClientsrc/data/record-set.jsRecordSet,createRecordSetsrc/ui/panels.jscreatePanelRegistrysrc/ui/dashboard-shell.jscreateDashboardShell,normalizeRoutesrc/ui/forms.jsFormStatus,createFormController,serializeFormInput,normalizeFormErrorssrc/ui/surface-contract.jsSurfaceFamilies,SurfaceUpdateSources,createSurfaceContract,createSurfaceManifest,createSurfacePulsesrc/ui/portlet.jscreatePortletControllersrc/html/helpers.jsescapeHtml,renderHtml,renderHtmlPage,HtmlThemeClasses,renderElement,renderTable,renderForm,renderFormField,renderXml, and small HTML utility helperssrc/adapters/jquery.jscreateJQueryBridge,createJQueryNotifiersrc/adapters/bluefission.jscreateBlueFissionApi,createBlueFissionAppsrc/adapters/resource-crud.jscreateRecordModel,createCrudPanelModulesrc/browser/activity.jscreateActivityTrackersrc/browser/socket.jsSocketStates,createSocketClient
Quick start
The package manifest is fixed at 0.1.0. Once that version is available from the configured npm registry, consume it with an exact constraint:
npm install --save-exact @bluefission/[email protected]Then build an app with explicit resources and state:
import {
createBlueFissionApp,
createSignal,
bindText,
bindValue
} from "@bluefission/reactor";
const app = createBlueFissionApp({
apiBaseUrl: "/api",
resources: {
user: "users",
report: "reports"
}
});
const message = createSignal("Loading...");
bindText("[data-role='message']", message);
bindValue("[name='message']", message);
app.resources.user.read(1).then((response) => {
message.value = response.data.realname;
});For direct browser usage inside internal repos, ESM imports also work:
<script type="module">
import { createBlueFissionApp } from "./src/index.js";
const app = createBlueFissionApp({
apiBaseUrl: "/api"
});
window.app = app;
</script>Extracted CRUD Pattern
One concrete compatibility adapter in Reactor is a repeated CRUD admin panel flow.
That adapter captures the recurring shape used by many internal screens:
- a reactive record model
- listing and edit screens
- read, save, and delete actions
- jQuery event handling through a bridge
- optional DataTables reload behavior
- shared success and error notices
Relevant files:
src/adapters/resource-crud.jsexamples/crud-panel-module.jsdocs/legacy-crud-migration.md
General Module Composition
Reactor supports a general module composition pattern through:
- action-aware resource definitions on
createBlueFissionApiandcreateBlueFissionApp - legacy-style
app.get,app.set,app.assign, andapp.computedhelpers RecordSetfor list-oriented statecreatePanelRegistryfor panel bootstrappingcreatePortletControllerfor portlet collapse and removal behaviorTemplatefor selector-addressed render-and-swap flows
Relevant files:
examples/primitives.jsexamples/resource-workspace.jsdocs/primitives.mddocs/module-composition.mddocs/develation-alignment.mddocs/develation-integration.md
Primitive Helpers
Reactor exposes first-class primitive helpers for JavaScript-side value, list, object, string, and number normalization:
import { Obj, Arr, Num, Str } from "@bluefission/reactor";
const query = {
page: Num.toInteger(input.page, 1, { min: 1 }),
tags: Arr.toList(input.tags, { split: true }),
owner: Obj.getPath(input, "record.owner.name", "Unknown"),
className: Str.joinClassNames("resource-row", input.active && "is-active")
};These helpers are aligned with DevElation's upstream primitive vocabulary without becoming a browser-side clone of the PHP classes. The goal is consistent input normalization and mutation-free object access across Reactor modules.
HTML Helper Compatibility
The HTML helper group is intentionally small, but it now represents the reusable concepts from the upstream HTML utilities:
- text formatting, href/base href normalization, images, files, pagination, result tables, lists, and bar graphs
- form open/close, fields, dropdowns, date splitting/joining, and validation metadata
- table rendering from row data
- template/runtime output normalization through
renderHtml(...) - XML-like node rebuilding through
renderXml(...)
renderHtml(...) accepts rendered strings as-is so output from parsing and runtime readers, including Vibrato Reader::output(), can be passed directly. Structured payloads can also use html, output, rendered, renderedOutput, rendered_output, markdown, text, records, rows, fields, items, nodes, fragments, blocks, or children.
For text safety, use { text: value }, table rows, and form field values; those are escaped by default. Use { html: value } only when the caller owns the trust boundary.
For a consistent optional baseline stylesheet, import @bluefission/reactor/html.css and wrap generated fragments with renderHtmlPage(...) or a root element using class="bf-reactor-html". The stylesheet is intentionally scoped to that root and bf-rx-* helper classes, so it can coexist with app, framework, or platform CSS without acting as a global reset.
import "@bluefission/reactor/html.css";
import { renderHtmlPage, renderResults } from "@bluefission/reactor";
const page = renderHtmlPage(renderResults(records), {
title: "Resource index",
density: "compact"
});Relevant files:
examples/html-output-contracts.jsexamples/develation-integration.jssrc/html/theme.cssdocs/api-reference.mddocs/develation-alignment.mddocs/develation-integration.md
Legacy script coverage
I also checked older shared script patterns and pulled reusable concepts into Reactor:
framework.jsnow represented bysrc/dom/framework.jstemplate.jsnow represented bysrc/dom/template.jsactivity.jsnow represented bysrc/browser/activity.jswebsocket.jsnow represented bysrc/browser/socket.js
These are compatibility-minded rehomes, not fragile line-for-line copies.
Design stance
Reactor is deliberately pragmatic:
- jQuery support stays available because current products need it
- jQuery is treated as an adapter, not the permanent core
- npm installation is preferred, but direct inclusion remains possible
- exact version constraints are preferred for production adoption
- backend compatibility matters more than frontend fashion
- migration is favored over rewrite theater
This is a platform library. Its value is not novelty. Its value is reducing drift across projects while giving us a cleaner path forward.
Reactor is a public MIT-licensed companion to DevElation for JavaScript and browser-facing concerns.
License
Reactor is available under the MIT License. See LICENSE.
Document map
README.mdproject overview and usage entry pointdocs/getting-started.mdfirst practical steps and composition patternsdocs/socket-lifecycle.mdauthenticated bootstrap, reconnect, heartbeat, queue, ordering, and teardown contractsdocs/releasing.mdpublic npm publication, trusted publishing, provenance, and versioning workflowdocs/api-reference.mdcurrent public API summarydocs/module-composition.mdgeneral composition guidance for resources, records, panels, and optional compatibility adaptersdocs/primitives.mdfirst-class value, list, object, string, and number helper contractsdocs/binding-contracts.mdreusable frontend binding contract shape and ownership boundariesdocs/surface-contracts.mdreusable rich-surface component, state, event, and pulse contract shapedocs/dialog-flows.mdmodal and confirmation request/result contractsdocs/table-list-adapters.mdtable/list query, row lookup, refresh, loading, and selection contractsdocs/notification-adapters.mdnormalized notification payload and dispatch conventionsdocs/develation-alignment.mdhow Reactor aligns with DevElation service, net, html, and object patternsdocs/develation-integration.mdpractical DevElation service, parser, HTML, XML, and object integration examplesdocs/legacy-script-coverage.mdmapping from the originalscriptsutilities to Reactor equivalentsdocs/dashboard-ui-interop.mdstatus of legacydashboard-uifeatures and how they relate to jQuerydocs/dashboard-utility-map.mdmethod-level ownership map for legacy dashboard utility extractiondocs/legacy-crud-migration.mdcompatibility notes for older CRUD-oriented module patternsdocs/crud-validation.mdvalidation notes for the extracted CRUD adapter and its remaining general gapsSPEC.mdproduct scope, users, and acceptance criteriaARCHITECTURE.mdstructural and layering decisionsROADMAP.mdnear-term and long-term direction
Current status
Reactor is in its foundation phase.
It now has:
- a coherent package structure
- first-class primitive helper exports for consistent normalization
- a documented architectural direction
- a Blue Fission-oriented transport and app bootstrap layer
- a DevElation-aligned request, response, and gateway layer
- evented object and record-set primitives for legacy dashboard migrations
- a lightweight signal and DOM binding model
- an extracted CRUD panel adapter
- dashboard shell, form helper, surface contract, and CRUD adapter coverage
- baseline automated tests for response normalization, service gateways, evented objects, and Blue Fission API bootstrap
It still needs:
- broader automated coverage for DOM helpers, templates, record sets, and UI adapters
- reusable table, modal, and notification adapter slices
- method-level dashboard interop mapping for the remaining legacy utility surface
Those items are intentionally tracked as follow-up work rather than hidden as vague future intent.
