Skip to content
Projekte

Über uns

Build-freies MVVM-Frontend-Framework und progressives Microfrontend-Framework.

Web- und App-Entwicklung

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

ofa.js

License: MIT Discussions 中文文档 繁體中文文件 English docs 日本語ドキュメント Documentación en español

Write components as plain HTML.

ofa.js is a zero-build, zero-runtime-dependency Web Components framework. One HTML file is one component or page, and the browser runs it directly—no npm, Node.js, bundler, or compilation step required.

Why ofa.js?

  • Zero build — .html files are the source and the artifact. Deploy them to any static server.
  • Native Web Components — components are real Custom Elements with Shadow DOM and standards-based templates.
  • Reactive without a compiler — data, watch, computed getters, o-if, and keyed o-fill work directly in HTML.
  • Applications when you need them — o-app provides a page stack, nested layouts, animations, and olink navigation.
  • Runs anywhere — CDN or local files; no server-side runtime required.
  • AI-friendly — plain HTML, explicit data flow, and reproducible browser tests instead of a compilation black box.

Quick start

Load ofa.js from jsDelivr:

<script
  type="module"
  src="https://cdn.jsdelivr.net/gh/ofajs/ofa.js@5/dist/ofa.min.mjs"
></script>

Create a page module:

<!-- hello.html -->
<template page>
  <h1>Hello, {{name}}</h1>
  <button on:click="count++">Clicked {{count}} times</button>

  <script>
    export default async () => ({
      data: {
        name: "ofa.js",
        count: 0,
      },
    });
  </script>
</template>

Run it with a single page element:

<o-page src="./hello.html"></o-page>

For multiple pages, use an app:

<o-app src="./app.mjs"></o-app>

app.mjs configures the home page, page transitions, and optional routing behavior. Each URL can also be a real HTML document when using scsr.

Version range

Use @5 to follow the latest published 5.x build. For a fully pinned version, use the exact release number:

https://cdn.jsdelivr.net/gh/ofajs/[email protected]/dist/ofa.min.mjs

The classic UMD build is available at dist/ofa.min.js and exposes the global $.

Repository layout

This repository is a monorepo containing the framework and its core building blocks:

Package Description
packages/drill Browser-side module loader (lm / l-m)
packages/stanz Proxy-based reactive data and watchers
packages/xhear Web Components runtime and template compiler
packages/ofajs Application layer: components, pages, routing, context
packages/router Hash-routing bridge (o-router)
packages/scsr Real-path routing bridge (SCSR)
packages/plugins Optional plugins: formData, inject-host, body-ghost, global-link
docs/website Multilingual docs, tutorial, API reference and blog

The runtime packages are source-only ESM. The published ofa.js bundle is built with rollup into the root dist/ directory.

Documentation and playground

The documentation site is built from docs/origin/<locale>. Traditional Chinese is generated from the Simplified source with opencc-js, not hand-translated:

npm run sync:t-cn       # optional: regenerate docs/origin/t-cn
npm run build:website   # build cn + t-cn + en into docs/website
npm run server:website  # preview at http://localhost:3348

Open:

Each language includes guides, API reference, a 20-lesson interactive tutorial, and a blog. The Traditional Chinese version is converted from the Simplified source with opencc-js (see scripts/sync-t-cn.mjs); the Japanese version is an AI-assisted translation. Spanish is also AI-translated from the English source. The playground edits and runs real ofa.js examples in the browser.

Sources live in docs/origin; generated pages live in docs/website. See docs/website/README.md for the site architecture and translation workflow.

Development

Requirements:

  • Node.js 20 or newer (recommended)
  • npm
  • Playwright browser binaries for the full test suite
npm install
npx playwright install   # first time, for the test suite

npm test                 # all packages, chromium + firefox + webkit
npm run build            # build root dist/ bundles
npm run server           # static server at http://localhost:3348

Run a focused suite:

npm run test:drill
npm run test:stanz
npm run test:ofajs
npm run test:scsr
npm run test:router
npm run test:plugins

On macOS, if Firefox crashes with sandbox_init() failed, run:

MOZ_DISABLE_CONTENT_SANDBOX=1 npm test

If Playwright reports Could not find profile folder, point Firefox's app-data root at a temporary directory:

mkdir -p /tmp/ffhome/Library/Application\ Support
CFFIXED_USER_HOME=/tmp/ffhome npm test

Benchmarks

Benchmarks are manual tools, not part of the normal test gate:

npm run bench:drill
npm run bench:stanz
npm run bench:xhear
npm run bench:ofajs
npm run bench:cross   # ofa.js vs Vue vs React

See packages/ofajs/CONTEXT.md for benchmark methodology and the latest v4→v5 results.

AI skill package

The repository keeps the agent skill as plain files in .agents/skills/ofajs-docs. To package it for distribution or for agents that accept a ZIP upload:

npm run build:skill
# → .agents/skills/ofajs-docs.zip

Published archive URL (after it is committed to main):

https://raw.githubusercontent.com/ofajs/ofa.js/main/.agents/skills/ofajs-docs.zip

The default archive contains a top-level ofajs-docs/ directory, matching the layout expected by Claude Skills (<skill-name>/SKILL.md):

ofajs-docs/
  SKILL.md
  references/...

Install it locally by extracting into .agents/skills:

unzip .agents/skills/ofajs-docs.zip -d .agents/skills

Some agents expect SKILL.md directly at the ZIP root; generate that variant with:

npm run build:skill -- --flat
# → .agents/skills/ofajs-docs-flat.zip

The packager uses only Node.js built-ins, preserves paths, and writes a deterministic ZIP (fixed timestamps, sorted entries). The archives live next to the skill folder in .agents/skills/.

Philosophy

ofa.js keeps the web platform as the runtime:

  • HTML is the component format.
  • CSS stays in the component.
  • JavaScript stays in the browser.
  • URLs stay real.
  • No compilation step sits between what you write and what runs.

That constraint is what makes the framework small, debuggable, and easy to deploy—and it is why v5 focuses on rendering correctness, list performance, and clear module boundaries rather than adding a build pipeline.

License

MIT © 2018–2026 ofa.js

Ähnliche Projekte entdecken

Wird geladen…