gea README

项目的 README,来自 github.com/dashersw/gea。合并为一个 markdown 文件:README.md。

Gea

npm version License: MIT

Gea

A compiler-first reactive JavaScript UI framework. No virtual DOM. Compile-time JSX transforms. Proxy-based stores. Surgical DOM patching. A hello-world production build is 121 B brotli; an equivalent interactive todo ships 4.9 kb of brotli JavaScript.

Gea compiles your JSX into efficient HTML string templates at build time, tracks state changes through deep proxies, and patches only the DOM nodes that actually depend on the changed data — no diffing, no reconciliation overhead.

Svelte made "compile the framework away" famous. Gea takes the phrase literally: in a static hello-world app, the framework runtime disappears from the bundle.

Compile To Almost Nothing

In a fresh Vite production hello-world build, Gea ships 121 B of brotli JavaScript. The equivalent Solid build ships 3.6 kB, Svelte ships 8.5 kB, Vue ships 20.7 kB, and React ships 50.8 kB.

Framework Version Raw minified JS Brotli JS Brotli vs Gea
Gea 1.3.0 214 B 121 B 1.0x
Solid 1.9.12 10,196 B 3,601 B 29.8x
Svelte 5.55.5 23,461 B 8,537 B 70.6x
Vue 3.5.33 58,174 B 20,711 B 171.2x
React 19.2.5 / React DOM 19.2.5 189,717 B 50,816 B 420.0x

Measured from fresh Vite 8.0.10 production apps, summing JavaScript assets only. Gea used the compiled component output; React, Vue, and Svelte used equivalent minimal hello-world components.

Stays Lean When The App Does Work

Hello world proves the compiler can disappear. Todo proves the runtime stays lean when the app actually does something.

In an equivalent interactive todo app with reactive state, input handling, filtering, item updates, and identical CSS, Gea ships 4.9 kB of brotli JavaScript. Solid ships 5.7 kB, Svelte ships 13.7 kB, Vue ships 22.6 kB, and React ships 51.5 kB.

Framework Version Minified JS raw Minified JS brotli Total raw JS+CSS Total brotli JS+CSS
Gea 1.3.0 15,364 B 4,896 B 18,075 B 5,664 B
Solid 1.9.12 16,181 B 5,721 B 18,892 B 6,485 B
Svelte 5.55.5 38,812 B 13,661 B 41,523 B 14,429 B
Vue 3.5.33 63,676 B 22,585 B 66,387 B 23,411 B
React 19.2.5 / React DOM 19.2.5 192,330 B 51,460 B 195,041 B 52,287 B

Measured from fresh Vite production builds in /tmp/gea-todo-framework-size-compare. CSS was identical across all builds: 2,711 B raw, 746 B brotli.

// counter-store.ts
import { Store } from '@geajs/core'

class CounterStore extends Store {
  count = 0
  increment() { this.count++ }
  decrement() { this.count-- }
}

export default new CounterStore()
// app.tsx
import { Component } from '@geajs/core'
import counterStore from './counter-store'

export default class App extends Component {
  template() {
    return (
      <div>
        <h1>{counterStore.count}</h1>
        <button click={counterStore.increment}>+</button>
        <button click={counterStore.decrement}>-</button>
      </div>
    )
  }
}
// main.ts
import App from './app'

new App().render(document.getElementById('app'))

Getting Started

npm create gea@latest my-app
cd my-app
npm install
npm run dev

This scaffolds a Vite-powered project with TypeScript, a sample store, class and function components, and hot module replacement — ready to build on.

Packages

Package Description Version
@geajs/core Core framework — stores, components, reactivity, DOM patching npm
@geajs/ui Headless UI primitives — accessible, composable components built on Zag.js npm
@geajs/mobile Mobile UI primitives — views, navigation, gestures, layout npm
@geajs/ssr Server-side rendering — streaming HTML, hydration, store isolation npm
@geajs/vite-plugin Vite plugin — JSX transform, reactivity wiring, HMR npm
create-gea Project scaffolder — npm create gea@latest npm
gea-tools VS Code / Cursor extension — completions, hover, diagnostics —

Philosophy

JavaScript code should be simple and understandable. Gea is built on the belief that a framework should not force you to learn a new programming model. You shouldn't need signals, dependency arrays, compiler directives, or framework-specific primitives to build a reactive UI. You should write regular JavaScript — classes, functions, objects, getters — and it should just work.

Gea finds the right mix of object-oriented and functional style. Stores are classes with state and methods. Components are classes with a template() that returns JSX. Function components are true plain functions with no side-effects. Computed values are getters. There is nothing to learn that isn't already JavaScript.

The only "magic" is under the hood: the Vite plugin analyzes your ordinary code at compile time and wires up the reactivity for you. You write this.count++ and the DOM updates. You don't call a setter, you don't wrap values in a signal, and you don't declare dependencies. The framework stays invisible.

Gea is built on the philosophy of the beautifully simple erste.js and regie libraries, carrying forward their core ideas — minimal abstraction, class-based components, and direct DOM ownership — while adding compile-time JSX transforms, deep proxy reactivity, and a modern build toolchain.

Why Gea?

How It Compares

Gea is the fastest compiled UI framework — closer to hand-written vanilla JavaScript than any other framework in the js-framework-benchmark (weighted geometric mean: 1.02). It gives you reactive state management, a component model, routing, and JSX without making the runtime the center of the story. Simple components can compile down to almost nothing; apps pay for the pieces they actually import.

Gea React Vue
Bundle size 121 B brotli hello world / 4.9 kB brotli todo JS 50.8 kB brotli hello world / 51.5 kB brotli todo JS 20.7 kB brotli hello world / 22.6 kB brotli todo JS
What's included Compiler output + imported Gea features React + React DOM Vue runtime
Virtual DOM No Yes Yes
Reactivity Proxy-based, automatic Explicit (setState, hooks) Proxy-based (ref/reactive)
JSX classes class className class (templates)
Event syntax click={fn} onClick={fn} @click="fn" (templates)
Props (objects/arrays) Two-way (same proxy) One-way (callbacks up) One-way (emit/v-model up)

See the full comparisons: React vs Gea | Vue vs Gea | Full benchmark report

Examples

Example Description
flight-checkin Multi-step check-in flow with multiple stores, conditional views, and E2E tests
todo Classic todo app demonstrating lists, filtering, and computed values
router-v2 Client-side routing with RouterView, Link, guards, layouts, and dynamic params
kanban Kanban board with drag semantics
mobile-showcase Mobile UI showcase using @geajs/mobile components
jira_clone Jira-style issue tracker with rich text, tabs, and @geajs/ui
ecommerce E-commerce storefront with cart and checkout flow
sheet-editor Spreadsheet-style editor with formula-like cells
showcase Component and pattern showcase

Documentation

Full documentation is available in the docs directory, covering:

AI-Assisted Development

Install the Gea AI skills with:

npx skills add dashersw/gea

This repository includes agent skills that teach AI coding assistants how to work with Gea. In compatible environments, this gives your editor the context it needs to understand Gea's stores, components, JSX conventions, and reactivity model so you can scaffold and iterate on Gea apps with much better AI assistance.

Contributing

Contributions are welcome. The repo is a standard npm workspaces monorepo:

git clone https://github.com/dashersw/gea.git
cd gea
npm install
npm run build

Each package has its own build script. The root npm run build builds all packages.

License

MIT — Copyright (c) 2017-present Armagan Amcalar

Star History

Star History Chart

gea (dashersw/gea)

正在搜索数据库…

1.3K ·GitHub
这是什么?Gea 是一个以编译器为核心的响应式 JavaScript UI 框架。它在构建时把 JSX 编译为 DOM 补丁,而不是使用虚拟 DOM,因此应用体积很小:一个 hello-world 构建的 brotli 压缩 JavaScript 仅为 121 B。
这是一个单一框架,还是一组包?它是一个单仓库多包(monorepo)项目:@geajs/core 负责 store 和响应式机制,@geajs/ui 提供无障碍的无样式(headless)组件,@geajs/mobile 提供移动端 UI 基础组件,@geajs/ssr 负责服务端渲染,@geajs/vite-plugin 负责 JSX 编译和响应式连接。
我该如何运行一个 Gea 项目?运行 npm create gea@latest,即可生成一个基于 Vite 的项目,包含 TypeScript、示例 store、类组件和函数组件,以及热模块替换(HMR),开箱即可开始开发。
这必须使用 Vite 吗?是的。响应式和 JSX 编译由 @geajs/vite-plugin 实现,它在构建时分析你的普通 JavaScript 代码并连接 DOM 更新,因此 Vite 是核心依赖,而不是可选工具。
Gea 的 JSX 和 React 完全一样吗?不完全一样,语法上有一些小的差异:你需要使用 class 而不是 className,事件则使用小写属性,如 click、input、change,而不是 onClick 之类的写法,因此直接复制粘贴 React 的 JSX 代码需要做一些调整。
Gea 为什么比 React 或 Vue 的包体积小这么多?它完全跳过了虚拟 DOM,而是让编译器在构建时生成精准的 DOM 补丁。因此一个 hello-world 应用发布的 brotli 压缩 JS 仅为 121 B,而 React 为 50.8 kB,Vue 为 20.7 kB;一个可交互的待办应用为 4.9 kB,而 React 版本为 51.5 kB。
管理状态需要学习信号(signals)或 hooks 吗?不需要。状态存放在普通的 JavaScript 类中,属性由 Proxy 包装;你可以直接写 this.count++,编译器生成的代码会自动更新 DOM,无需 setter 方法、信号或依赖数组。
我能用 Gea 构建移动端风格的 UI 吗?可以。@geajs/mobile 包提供视图管理、iOS 风格的导航转场、返回手势、侧边栏、标签页以及下拉刷新,让界面更有移动应用的体验。
Gea 开箱即用就包含路由和服务端渲染吗?是的。路由 API 内置,并支持 tree-shaking(摇树优化),一个带路由的 hello-world 约为 7.3 kB(gzip 压缩后)。独立的 @geajs/ssr 包负责流式 HTML 输出、水合(hydration)以及 store 隔离。
Gea 对 AI 编程助手有什么特别的支持吗?仓库中附带了可安装的 agent skills(智能体技能),用于向 AI 编程助手介绍 Gea 的 store、组件、JSX 约定和响应式模型,使兼容的 AI 编辑器在搭建和迭代 Gea 应用时拥有更好的上下文。
有哪些类似的项目?svelte, core, riot, solid, core, mitosis, vue, react
作者
dashersw
大小
15.5 MB
星标
1.3K
时长
8个月
提交 · 90 天