npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@helloworl1926/easy-ts

v0.2.18

Published

A minimalist reactive TypeScript framework

Readme

Easy.ts

License: MIT

一个简易的TypeScript框架

本人不太会写README.md

How to use

  1. 在package.json中:
  • 加入依赖:@helloworl1926/easy-tsvite
  • 添加:
 "scripts": {
   "dev": "vite",
   "build": "vite build"
 }
  1. 复制src/main.ts (如果你是在npmjs上看的README,请去代码仓库
  2. 在同一目录新建“App.ts”,写代码
  3. 运行:
npm install
npm run dev
  1. 浏览器打开http://localhost:5173

⚠️ 内测警告:JSX 支持目前处于内测阶段,仍不稳定。
生产环境推荐使用 createNode API。

注:如果您要用Easy.ts,请必须使用Vite来运行,否则您请另寻其他框架

Functions

createNode(tag: keyof HTMLElementTagNameMap | Component, props?: object, children?: (ElNode | string | Ref<any>) | string)

内部实现是复杂函数签名,这里先简化^^^^

创建节点

例如:

createNode("div", {style: { backgroundColor: "gray" }}, [
    "test",
    createNode("h6", {}, "test")
])

框架专有props:

  • text: 文本内容,支持ref
  • on+事件名: 事件绑定,不支持ref
  • class: 可以是数组、string、或其他支持toString的对象。不支持传ref
  • style: 传对象而不是字符串,支持ref

createRef<T>(initial: T)

创建响应式变量

例如:

const count = createRef<number>(0) 

createNode("h3", {onclick() {count.value++}}, [
    "Count is ",
    count
])

Ref.toString() - 相当于Ref.value.toString(),会触发getter

computed<T>(fn: () => T): Ref<T>

派生,在fn中的值变化时重新计算并更新ref

例如:

const count1 = createRef(0)
const count2 = createRef(0)
const total = computed(() => count1.value + count2.value) 

createNode("h3", {onclick() {count1.value++}}, [
    "Count 1 is ",
    count1
])

createNode("h3", {onclick() {count2.value++}}, [
    "Count is ",
    count2
])

createNode("h3", {}, [
    "Total: ",
    total
])

effect(fn: () => void)

创建ref监听器,先调用一次fn,之后fn内部使用的ref变化时,自动调用

例如:

const ref = createRef("")

effect(() => {
    console.log("ref 变了:", ref.value)
})

如果内部没有使用到ref,在组件或App挂载时执行一次

Null

占位符组件

例子在条件渲染里面

condition(condition: boolean | Ref<boolean>, trueNode: ElNode, falseNode: ElNode = createNode(Null))

条件渲染

支持普通boolean

例如:

const ref = createRef(true)

createNode("h3", {}, [
    condition(ref, 
        createNode("p", {}, "content")
    )
])

falseNode默认值是Null组件

官方推荐文件夹结构

project src App.ts // 或tsx main.ts index.html tsconfig.json package.json package-lock.json // 其他……

Example

最小可用App.ts模板:

import { ElNode, createRef, createNode } from "@helloworl1926/easy-ts"

function App(): ElNode {
    const count = createRef(0)

    return createNode("div", {}, [
        createNode("h2", {}, "Hello, Easy.ts!"),
        createNode("h2", {onclick() {count.value++}}, [
            "Count is ",
            count
        ])
    ])
}

协议

MIT © helloworl1926