@livenetworks/ashlar
v2.5.1
Published
AI-native, DOM-first frontend framework built with Vanilla JavaScript and SCSS
Maintainers
Readme
🚀 ln-ashlar
AI-Native, DOM-First Web Application Architecture for Long-Lived Systems.
Unlike mainstream JS frameworks that treat the DOM as a passive output projection of an in-memory JavaScript state tree,ln-ashlarleverages the native W3C DOM as an authoritative runtime state surface. Built with zero runtime npm dependencies for maximum speed, longevity, AI-agent efficiency, and security.
🌐 Website: ashlar.software · Live Demo: demo.ashlar.software · Docs: docs.ashlar.software · npm: @livenetworks/ashlar
📋 Releases & Changelog: GitHub Releases · Changelog · Release Notes
🏛️ The Paradigm: DOM as the Runtime State Surface
ln-ashlar rejects the mainstream premise that the UI must be mirrored into a secondary tree in JavaScript memory (Virtual DOM diffing, or a component tree from which the real DOM is re-derived). Instead, it establishes DOM-First Architecture:
- 🔍 Control State Lives on the DOM: Every piece of state that drives component behavior — open/closed, active, sort direction, mode, validation status — lives openly on the element's
data-ln-*attributes, never inside a private closure. Application data (records, caches, sync queues) lives where data belongs:ln-data-storeand IndexedDB. The split is deliberate — the control plane is inspectable, the data plane is efficient. - 🎛️ Zero Virtual DOM Hydration Mismatch: Because there is only one state store (the DOM) rather than two (the server's HTML output vs. the client's JS memory), the entire class of "server rendered one tree, client hydrated a mismatched tree" errors is structurally eliminated.
- 🎛️ DevTools Inspector as the Control Plane: Modifying any attribute directly in browser DevTools immediately activates the component's behavior in real-time. Native
MutationObserverinstantly synchronizes the internal engine, updates the DOM, and dispatches lifecycle events. - 🤖 AI-Native & Contract-Driven: AI agents (via MCP,
.agents/, anddocs-mcp/) generate declarative, schema-validated HTML contracts rather than complex JavaScript program trees. - 🔌 The DOM Is the Bus: Components never import one another. They communicate through bubbling
CustomEvents (ln-{component}:{action}), so a trigger neither knows nor cares what handles it — and the DOM tree, rather than a global registry, defines the scope. Any backend, template engine, or third-party script can take part by dispatching an event, with no package to install.
🎛️ Beyond CRUD: The Project Coordinator Model (data-ln-* + data-{project}-*)
A frequent misconception is that DOM-First architecture is restricted to standard form-heavy business portals or admin CRUD. In reality, ln-ashlar functions as an orchestration runtime for complex, highly interactive frontend applications through its Three-Layer Architecture:
┌─────────────────────────────────────────────────────────────┐
│ Layer 2: Coordinator / Domain Logic (data-myapp-*) │ ← Audio Decks, Playlists, Medical EHR, POS flows
├─────────────────────────────────────────────────────────────┤
│ Layer 1: Component / Ashlar Infrastructure (data-ln-*) │ ← Modals, Accordions, Sortable, Forms, Toasts
├─────────────────────────────────────────────────────────────┤
│ Layer 3: ln-ashlar Core (ln-core primitives) │ ← Registry, fill(), buildDict(), storage & DOM bus
└─────────────────────────────────────────────────────────────┘
▲ Built directly on Native W3C DOM & Browser Standards (zero Virtual DOM)- Ashlar Primitives Are Domain-Agnostic: Generic components (
data-ln-modal,data-ln-accordion,data-ln-sortable,data-ln-form) manage DOM state, layout mechanics, and ARIA semantics. They neither know nor care what a "DJ deck", "audio track", or "patient chart" is. - Your Project Builds Its Own Language: Your application implements its own Project Coordinator and declarative domain attributes (e.g.,
data-mixer-*,data-crm-*,data-pos-*). The coordinator mediates between external engines (Web Audio API, specialized libraries, WebSockets), IndexedDB caches, and the DOM. - Real-World Flagship Showcase —
ln-mixer: A production-grade, 2-deck DJ audio mixer application featuring real-time audio waveform visualization, drag-and-drop playlist reordering, loop cues, and offline PWA capability. It orchestrates the entire application withln-ashlarand only one single runtime dependency (wavesurfer.js) — with zero React/Vue, zero Virtual DOM, and zero state-synchronization bloat.
📊 Architectural Positioning & Trade-offs
| Dimension | Component-Tree Frameworks (React / Vue / Angular) | DOM-First Architecture (ln-ashlar) |
| :--- | :--- | :--- |
| Primary State Surface | In-memory JS component tree & reactive state. | Direct W3C DOM (data-ln-* attribute surface). |
| Primary Code Artifact | JavaScript program (JSX, hooks, signals, state closures). | Declarative Semantic HTML Contract. |
| AI Agent Suitability | Must generate full program logic, state handlers & reactivity trees. | Resolves intent directly to declarative markup contracts. |
| Runtime Dependencies | Framework core + extensive npm package ecosystem. | Zero runtime npm dependencies (pure native Web APIs). |
| Observability & Inspection | Requires specialized DevTools extensions to inspect hidden memory state. | Control plane fully inspectable: every behavioral state is a visible data-ln-* attribute in the native DOM inspector. |
| Long-Term Longevity | Managed via framework LTS cycles and automated refactoring (ng update). | Built directly on permanent W3C browser standards (<dialog>, Popover API, CustomEvent). |
| Server & Client Harmony | Primarily JSON/SPA focused; SSR requires complex hydration pipelines. | Dual-Core: Native SSR progressive enhancement (Laravel, Go, Django) & SPA (ln-router). |
| Optimal Use Cases | High-frequency continuous client state (collaborative editors, games, canvas). | Enterprise CRUD, Admin Panels, ERPs, long-lived apps with strong backend integration, and complex interactive tools via Project Coordinators (e.g. ln-mixer). |
For the complete 17-category breakdown and CTO decision matrix, see our Architecture Philosophy.
💡 Declarative HTML at a Glance
Combine autonomous components directly in semantic HTML — zero initialization scripts, full accessibility, and automatic MutationObserver binding:
<!-- Trigger Button with Tooltip and Icon -->
<button type="button" data-ln-modal-for="user-modal" data-ln-tooltip="Add new user">
<svg class="ln-icon" aria-hidden="true"><use href="#ln-user-plus"></use></svg> Create User
</button>
<!-- Native Modal Dialog with Form Validation -->
<dialog class="ln-modal" data-ln-modal id="user-modal">
<form method="dialog">
<header>
<h3>Create User</h3>
<button type="button" data-ln-modal-close aria-label="Close">
<svg class="ln-icon" aria-hidden="true"><use href="#ln-x"></use></svg>
</button>
</header>
<main>
<div class="form-element">
<label for="email">Email Address</label>
<input id="email" name="email" type="email" required minlength="5" data-ln-validate>
<ul data-ln-validate-errors>
<li class="hidden" data-ln-validate-error="required">Email is required</li>
<li class="hidden" data-ln-validate-error="typeMismatch">Invalid email format</li>
</ul>
</div>
</main>
<footer>
<button type="button" data-ln-modal-close>Cancel</button>
<button type="submit">Submit</button>
</footer>
</form>
</dialog>What happens automatically under the hood:
data-ln-modal-for="user-modal"binds the trigger button to toggle the native<dialog>without writing JS listeners (ln-modal).data-ln-tooltipmounts an accessible top-layer tooltip on hover and focus (ln-tooltip).<use href="#ln-*">fetches SVG icons on-demand from CDN and caches them inlocalStorage(ln-icon).data-ln-validateintercepts the form submit gate, validates native browserValidityState, and toggles.hiddenon corresponding error messages without external validation libraries (ln-validate).data-ln-modal-closesafely dismisses the modal and restores focus (ln-modal).
🛡️ The Three Core Pillars
1. 🏛️ Dual-Core Architecture (SSR + Client-Side SPA)
- Backend-First Progressive HTML Enhancement (SSR): Your backend (Laravel, Go, Django, Rails) delivers indexable, semantic HTML. Elements auto-activate via attributes (
data-ln-modal,data-ln-filter,data-ln-table). - Client-Side Single-Page Applications (SPA / JSON Mode): Built-in client router (
ln-router), compound hash-state codec (hash.js), 3-tier local storage (ln-data-store), and microtask-batched state rendering (createBatcher,renderList) when client JSON APIs are required.
2. 🤖 AI-Native & MCP Surface
- Machine-Readable Component Corpus (
docs-mcp/): Schema-validated documentation served directly to AI agent workflows via Model Context Protocol (MCP). - Inference-Time Contracts: AI generation thrives because it does not need to hallucinate JS hook rules, framework version conflicts, or missing npm packages. It simply instantiates a known, declarative HTML contract served in real-time during inference.
- MCP Component Router: Decision matrix resolving user intent into declarative components before generating markup.
- In-Repo Agent Protocols (
.agents/,CLAUDE.md,DOCTRINE.md): Strict architectural rules, component templates, and lifecycle constraints loaded automatically into AI coding sessions.
3. 🔒 Longevity & Zero Supply-Chain Risk
- Zero Runtime npm Dependencies: Eliminates supply-chain vulnerabilities, breaking transitive updates, and framework EOL cycles.
- W3C Web Standards First: Relies on native browser primitives (
<dialog>, Popover API,:has(),@container,CustomEvent, Web Crypto API).
⚡ Quick Start
ln-ashlar ships both prebuilt distribution bundles (dist/ exported from package.json) and raw source exports (theme/*, components/*) so you can either drop in the compiled assets or bundle directly from source.
1. Install via npm
npm install @livenetworks/ashlarOption A — Import prebuilt bundles:
import '@livenetworks/ashlar'; // JS components (auto-init)
import '@livenetworks/ashlar/full.css'; // Full CSS (or ./core.css, ./theme.css, ./tailwind.css)Option B — Import from source (for custom SCSS tokens/mixins or selective bundling):
// main.scss - Import SCSS tokens, mixins, and defaults
@use '@livenetworks/ashlar/theme/ln-ashlar.scss';
// main.js - Import and auto-initialize JS components
import '@livenetworks/ashlar/components/index.js';2. Install as a Git Submodule (Alternative)
git submodule add .../ln-ashlar.git resources/ln-ashlarThen reference the submodule paths:
@use 'resources/ln-ashlar/theme/ln-ashlar.scss';import 'resources/ln-ashlar/components/index.js';3. Build & Watch (Library Development)
If you are developing inside this repository, compile the dist/ package bundles, standalone component IIFEs, and static demo assets:
npm run build # Produces dist/* + demo/dist/* + syncs schemas/events/tokens + builds demos
npm run dev # Watch mode (automatic compilation on SCSS or JS changes)Note: dist/ holds the published package exports declared in package.json, while demo/dist/ serves the local repository demo pages.
🌐 Browser Support
ln-ashlar targets evergreen browsers with native support for the Popover API, since ln-modal, ln-dropdown, ln-tooltip, ln-toast, ln-popover, and ln-router rely on it (via dialog.showModal() and popover) for top-layer rendering.
| Browser | Minimum Version | |---|---| | Chrome / Edge | 114+ | | Safari | 17.4+ | | Firefox | 125+ |
📐 Core Architecture Specifications
Deep architectural blueprints detailing the engine driving ln-ashlar.
| Specification | Contents |
|:---|:---|
| 📜 Ashlar Engineering Doctrines | Mandatory 3-Layer architecture, component authoring doctrines, CQS event conventions, and state observability rules. |
| 📖 Architecture Philosophy | The DOM-First engineering manifesto detailing computing cycles, framework EOL risks, performance, security, and full 17-category comparison tables. |
| 🔄 Data Flow Architecture | Rules governing how data moves. Splits responsibilities into four isolated concerns: Data (ln-data-store + ln-data-coordinator), Render (ln-table), Submit (ln-form), and Validate (ln-validate). Details the parallel fan-out write pipeline with Mermaid sequence diagrams. |
| 🧭 3-Tier Local-First Storage Specs | Technical reference for decoupling storage caches (ln-data-store), network gateways (ln-*-connector), and data transformations (ln-mapper). |
| ⚡ Reactive Architecture Reference | Blueprint on how components manage state using microtask batching (createBatcher), DOM bindings (fill, renderList), and attribute-to-state bridges. |
| 📐 Design System Specifications | Complete styling specs covering CSS Custom Properties, layout grids, buttons, responsive breakpoints, typography hierarchies, dark mode theming, and icons. |
| 🛡️ Security & Threat Mitigation | Deep architectural security analysis covering Web Crypto API encryption-at-rest, strict CSP compliance (no dynamic eval), sensitive DOM attribute protections, and the same-origin AJAX fragment trust boundary. |
| 🧠 Architect Overview Guide | Master developer guide introducing the DOM-First doctrine, component inventories, override architectures, and new project integration pipelines. |
📚 General Documentation Index
For detailed manual instructions, properties, attributes, and events of individual components:
- 📚 Complete Documentation Index — Master roadmap containing direct links to each module's usage guide and architecture reference.
CSS Layer Reference
| Guide | Scope |
|---|---|
| 🎨 Design Tokens | All CSS custom properties: colors, spacing, borders, typography scale, z-index. |
| 🎛️ Mixins Reference | Extensive list of all SCSS @include recipes available for semantic styling. |
| 📑 Forms | Declarative layout patterns, spacing, grids, and input validation states. |
| 📇 Cards | Custom properties and mixins for basic card structures and section headers. |
| 📊 Tables | Tabular layout patterns, striped themes, and responsive screen-overflow. |
| 🗺️ Navigation | Semantic navigation bar mixins, sidebar layouts, and collapsible drawer states. |
| 📏 Layout | Flexbox, grid utilities, container query states, and collapsible selectors. |
| 📁 Sections | Visual separation blocks and responsive layout containers. |
| 🧭 Breadcrumbs | Horizontal navigation trail styling mixins. |
| 📦 Container Queries | Mobile-first component layouts reacting to the width of their parent container. |
JS Components Reference
| Component | Usage Guide (HTML Attributes / Events) | Technical Architecture (State / Render Loops) | |---|---|---| | Core Utilities | — | 🛠️ Core helpers reference | | Component Pattern | — | 🧠 JS Component Design Guide | | SVG Icons | 🏷️ Icon SVG Sprite Reference | 🌐 On-Demand CDN routing & injection | | Toggle | 🎚️ ln-toggle docs | 📄 toggle architecture | | Accordion | 📂 ln-accordion docs | 📄 accordion architecture | | Modal | 🪟 ln-modal docs | 📄 modal architecture | | UI Coordinator | 🎛️ ln-ui-coordinator docs | 📄 ui-coordinator architecture | | Tabs | 🔖 ln-tabs docs | 📄 tabs architecture | | Toast | 🔔 ln-toast docs | 📄 toast architecture | | Dropdown | 🔽 ln-dropdown docs | 📄 dropdown architecture | | Popover | 💬 ln-popover docs | 📄 popover architecture | | Tooltip (JS) | 💬 ln-tooltip docs | 📄 tooltip architecture | | Keyboard Shortcuts | ⌨️ ln-key docs | 📄 key architecture | | Navigation | 🗺️ ln-nav docs | 📄 nav architecture | | Router | 🧭 ln-router docs | 📄 router architecture | | Filter | 🔍 ln-filter docs | 📄 filter architecture | | Search | 🔎 ln-search docs | 📄 search architecture | | Table | 📊 ln-table docs | 📄 table architecture | | Table Coordinator | 🎛️ ln-table-coordinator docs | 📄 table-coordinator architecture | | Sort | ⇅ ln-sort docs | 📄 sort architecture | | Sortable | 🔃 ln-sortable docs | 📄 sortable architecture | | List | 📋 ln-list docs | 📄 list architecture | | Progress | 📈 ln-progress docs | 📄 progress architecture | | Circular Progress | 📈 ln-circular-progress docs | 📄 circular-progress architecture | | Stat | 📈 ln-stat docs | 📄 stat architecture | | Chart | 📊 ln-chart docs | 📄 chart architecture | | Link | 🔗 ln-link docs | 📄 link architecture | | Confirm | ⚠️ ln-confirm docs | 📄 confirm architecture | | Upload | 📤 ln-upload docs | 📄 upload architecture | | AJAX | 🔄 ln-ajax docs | 📄 ajax architecture | | Include | 📥 ln-include docs | 📄 include architecture | | HTTP | — | 📄 http service architecture | | API Queue | 🚦 ln-api-queue docs | 📄 api-queue architecture | | Store | 🗄️ ln-data-store docs | 📄 store cache architecture | | Data Coordinator | 🎛️ ln-data-coordinator docs | 📄 data-coordinator architecture | | API Connector | 🔌 ln-api-connector docs | — | | CouchDB Connector | 🔌 ln-couchdb-connector docs | 📄 couchdb-connector architecture | | Form | 📝 ln-form docs | 📄 form lifecycle architecture | | Validate | ⚠️ ln-validate docs | 📄 validate architecture | | Fill | 🧩 ln-fill docs | 📄 fill architecture | | Options | ⚙️ ln-options docs | 📄 options architecture | | Slug | 🏷️ ln-slug docs | 📄 slug architecture | | Date | 📅 ln-date docs | 📄 date architecture | | Time | 🕒 ln-time docs | 📄 time architecture | | Number | 🔢 ln-number docs | 📄 number architecture | | Editor | ✍️ ln-editor docs | 📄 editor architecture | | Autosave | 💾 ln-autosave docs | 📄 autosave architecture | | Autoresize | ↕️ ln-autoresize docs (Pure CSS) | — | | Translations | 🗣️ ln-translations docs | 📄 translations architecture | | Repeater | 🔁 ln-repeater docs | 📄 repeater architecture | | External Links | 🌐 ln-external-links docs | 📄 external-links architecture | | Debug | 🐞 ln-debug docs | 📄 debug architecture |
🎨 Dual CSS Engine Architecture
ln-ashlar offers dual-engine visual styling with 100% design parity across all components and layouts:
- Native Ashlar SCSS: Class-free semantic HTML styling and design tokens. Optimized for minimal CSSOM invalidation by eliminating mixin selector explosions and
:not(:has())bottlenecks. - Tailwind CSS v4 Engine: Semantic component visual stylesheet compiled directly with Tailwind v4
@themetokens (npm run build:tailwind) with 100% class-free HTML markup parity.
See Theme Architecture & SCSS Guidelines for details.
🧪 Automated Testing & Performance Suite
ln-ashlar includes an automated headless verification and benchmarking harness comparing both CSS engines:
- Visual & Design Suite (
npm run test:visual): Validates responsive layout, horizontal overflow, and reactive UI across all 67 demo admin pages. - JS Performance Suite (
npm run test:perf): Benchmarks execution latency, DOM node churn, and JS heap memory across 46 interactive JS components. - Historical Comparison (
npm run test:perf:compare): Tracks performance trends across git commits and alerts on performance regressions (>20%).
See Headless Testing Documentation for full usage and options.
🖥️ Interactive Demo Site
ln-ashlar ships with a complete local dashboard environment inside demo/admin/. The demo is itself a project consuming ln-ashlar, showing real-world layout structures, component setups, and customized semantic SCSS:
demo/admin/index.html ← Dashboard Overview (cards, navigation, timelines)
demo/admin/mixins.html ← Interactive visual catalog of all SCSS mixins
demo/admin/icons.html ← Live SVG sprite icons browser (with live search/filter)
demo/admin/{component}.html ← Standalone interactive playground pages for JS components📄 License
ln-ashlar is dual-licensed:
- Open Source Projects: Free to use under the GNU General Public License v3.0 (GPLv3). Any project bundling or distributing ln-ashlar under this license must also make its source code available under GPLv3.
- Commercial / Closed-Source Projects: A commercial license is required to use ln-ashlar in proprietary applications, SaaS platforms, or client products without GPLv3 copyleft obligations.
For commercial licensing and enterprise support inquiries, please contact: [email protected] — see the LICENSE file for full details.
