涟漪:优雅的TypeScript UI框架
Ripple: The Elegant TypeScript UI Framework

原始链接: https://jsdev.space/meet-ripple/

## Ripple:一种新型的TypeScript UI开发方法 Ripple 是一种编译器优先的 TypeScript UI 框架,旨在解决现代前端开发日益增长的复杂性。虽然 AI 工具可以提升代码*创建*效率,但保持质量和一致性仍然是一个挑战。Ripple 优先考虑简洁性、清晰性和响应性,目标是编写“按其运行方式阅读”的代码。 主要特性包括 TypeScript 优先的方法、使用 `track()` 和 `@` 进行直接操作的响应式变量,以及细粒度的 DOM 更新——避免完全组件重新渲染。它消除了对 `useState`、refs 或 signals 的需求,从而降低认知负担和样板代码。编译器通过 DOM 依赖分析、删除无用 CSS 和作用域样式来优化性能。 Ripple 的语法简洁直观,通过一个响应式待办事项列表示例进行了演示。它具有降低维护成本、直接响应性和编译器强制约束等优势。与 React、Vue 和 Svelte 相比,Ripple 拥有极小的运行时大小和高度的 AI 友好性。 Ripple 非常适合 AI 辅助项目、仪表盘、企业应用程序以及寻求更少工程化、更易于维护的 UI 解决方案的开发者。它提出了一个问题:“如果 UI 可以在没有繁文缛节的情况下实现响应式,会怎样?”并提供了一个引人注目的答案。

Ripple: 优雅的 TypeScript UI 框架 (jsdev.space) 3 分,由 javatuts 1 小时前发布 | 隐藏 | 过去 | 收藏 | 2 条评论 reactordev 5 分钟前 | 下一个 [–] 很久以来,我第一次真正喜欢它的外观。这就像 htmx 和 jsx 联手征服世界。我喜欢组件关键字作为一等公民。我也喜欢绑定和事件处理。天哪,我得试试这个。回复 zareith 5 分钟前 | 上一个 [–] 最终结果似乎非常接近带有符文的 svelte,但学习曲线更低,因为我们没有为循环、条件等事物使用特殊语法。回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Ripple is a compiler-first TypeScript UI framework for building fast, clean, reactive applications with minimal boilerplate and optimal performance.

Why the Frontend World Needs Ripple in 2026

Front-end development has reached an unusual point in its history:
writing code is easy — maintaining it is hard.

AI accelerated code output, but did not solve code quality, consistency, or review overhead.

Traditional frameworks are powerful but often come with:

  • verbose state handling
  • over-rendering components
  • heavy abstraction layers
  • confusing refs/signals/hooks
  • bloated bundle sizes

Ripple was designed for this moment. It prioritizes simplicity, clarity, and reactivity.

“Code should read like it does.”


What is Ripple?

Ripple is a compiler-first, fine-grained reactive UI framework with:

  • TypeScript-first components
  • reactive variables with track() + @
  • no Virtual DOM
  • automatic dependency tracking
  • inline control flow
  • scoped CSS

Ripple’s Design Goals

1. Compiler Before Runtime

The compiler performs:

  • DOM dependency analysis
  • dead CSS removal
  • scoped styling
  • code transformation

2. Reactive by Default

let count = track(0);
<button onClick={() => @count++}>{@count}</button>

No useState, ref(), .value, $:, or signals.

3. Low Cognitive Load

Less to memorize. Business logic remains obvious.

4. Granular DOM Updates

Only updated nodes mutate — not whole components.


Getting Started

Initialize a new project:

npx create-ripple-app ripple-todo-app

Move inside:

If integrating manually:

npm install ripple ripple-compiler ripple-dom

Scripts

npm run dev
npm run build
npm run preview

Folder Structure

my-ripple-app/
├─ src/
│  ├─ App.ripple
│  ├─ index.tsx
│  └─ components/
├─ public/
├─ ripple.config.ts
├─ tsconfig.json
├─ package.json

Verify Setup

component App() {
  <h1>{"Hello Ripple"}</h1>
}

If it renders, you’re ready.


Ripple in 2 Minutes: Core Syntax

Reactive Variables

Read + Write

<button onClick={() => @count++}>{@count}</button>

Reactive Collections

const todos = #[];
const user = #{ name: "Tom" };

Components

component Greeting({ name }) {
  <h1>{"Hello "}{name}</h1>;
}

Inline Control Flow

for (const item of items) {
  <Item data={item}/>
}

Productivity Advantages

Ripple reduces maintenance cost by:

  • fewer primitives
  • direct reactivity
  • compiler constraints
  • minimal boilerplate
  • tiny runtime

Building a Real Demo: Todo List

We’ll demonstrate Ripple’s power with a fully reactive Todo List.

TodoInput Component

import { track } from "ripple";

component TodoInput({ onAdd }) {
  let text = track("");

  function submit() {
    const v = @text.trim();
    if (v) {
      onAdd(v);
      @text = "";
    }
  }

  <div class="input">
    <input
      placeholder="Add a task..."
      value={@text}
      onInput={(e) => @text = e.target.value}
      onKeyDown={(e) => { if (e.key === "Enter") submit(); }}
    />
    <button onClick={submit}>{"Add"}</button>
  </div>
}

TodoItem Component

component TodoItem({ todo, onToggle, onDelete }) {
  <li>
    <input type="checkbox" checked={todo.completed} onChange={onToggle} />
    <span class={todo.completed ? "done" : ""}>{todo.text}</span>
    <button onClick={onDelete}>{"×"}</button>
  </li>
}

App Component

export component App() {
  const todos = #[];

  function add(text) {
    todos.push(#{ id: Date.now(), text, completed: false });
  }

  function toggle(t) {
    t.completed = !t.completed;
  }

  function remove(id) {
    const idx = todos.findIndex(t => t.id === id);
    if (idx >= 0) todos.splice(idx, 1);
  }

  const remaining = () => todos.filter(t => !t.completed).length;

  <div class="app">
    <h1>{"Todo List"}</h1>

    <TodoInput onAdd={add} />

    <ul>
      for (const t of todos) {
        <TodoItem
          todo={t}
          onToggle={() => toggle(t)}
          onDelete={() => remove(t.id)}
        />
      }
    </ul>

    <p>{todos.length}{" total / "}{remaining()}{" remaining"}</p>
  </div>
}

Framework Comparison

FeatureRippleReactVue 3Svelte
State modeltrack() + @Hooksref() / reactiveStores
DOM updatesFine-grainedVDOM diffVDOM diffCompile
BoilerplateVery lowHighMediumLow
CSSScopedModulesSFC ScopedScoped
AI-friendlyHighMediumMediumHigh
Runtime sizeSmallLargeMediumTiny

Who Should Use Ripple?

Ripple is ideal for:

  • AI-assisted codebases
  • dashboards & realtime UIs
  • enterprise maintainability
  • mobile/web hybrid UIs
  • developers who dislike overengineering


Final Thoughts

If React gave us JSX, Vue gave us SFCs, and Svelte gave us compilation, Ripple asks:

“What if UI could be reactive without ceremony?”

And it answers convincingly.

联系我们 contact @ memedata.com