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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vvix-cli

v0.1.15

Published

a lite vue-like reactive jsx framework

Downloads

3

Readme

vvix-cli

请不要在真实开发下使用 vvix,还未稳定 !!!!!!!!!!!!!!!!!!!!!!!!!

如果你实在喜欢这种写法,请使用Vue3 !!!!!!!!!!!!!!!!!!!!!!!!!

DO NOT USE IN REAL PRODUCT, IT'S STILL NOT STABLE!!!!!!!!!!!!!!!!!!!!

If you really like this style, please use Vue3 !!!!!!!!!!!!!!

轻量级玩具 响应式 JSX/TSX 框架

vvix 可以让你使用:

  • ts 支持
  • vue 响应式 api 大部分支持
  • 更加 vue 的 react,更加 react 的 vue
  • 和 vue3 类似的 diff 算法

vvix brings you:

  • ts support
  • most of "vue" reactive apis
  • reactive react, jsx in vue
  • more efficient diff algorithm than react

使用/Usage:

挂载 App 根组件到 id 为 root 的 dom 节点上

render App on the dom whose id is "root"

demo 地址

import {createApp} from 'vvix'

const App = () => () =>
  <div>hello world</div>

createApp(<App />).mount("#root")

基础的计数器

Simple counter demo

demo 地址

const Counter = () => {
  const counter = ref(0)
  const click = () => {
    counter.value++
  }
  return () => <div onClick={click}>
    counter: {counter.value}
  </div>
}

createApp(<Counter />).mount("#app")

组件的嵌套

parent and child components

demo 地址

interface Props {
  title: string;
  content: string;
}

const enum Status {
  Success,
  Pending,
  Fail,
  Normal
}

const Item: FC<Props> = ({ title, content }) => () => (
  <div>
    <h1>{title}</h1>
    <p>{content}</p>
  </div>
);

const MsgItem = () => {
  const [status, data, retry] = useRequest<
    Array<{ id: number; title: string; content: string }>
  >();
  return () => (
    <>
      <button onClick={retry}>retry</button>
      {
        status.value === Status.Pending
        ? "loading..."
        : status.value === Status.Fail
          ? "oops, something wrong !"
          : data.value?.map((item) => (
            <Item
              key={item.id}
              title={item.title}
              content={item.content}
            />
          ))
      }
    </>
  );
};

组件传送门(让组件挂载在其它 dom 上)

portal(mount the component on another dom)

demo 地址

import { createPortal } from "vvix";

const Portal = createPortal<{
  msg: string;
}>(({ msg }) => {
  return () => <div>{msg}</div>;
}, "#portal");

const App = () => {
  return () => (
    <div>
      <Portal msg="portal render success" />
    </div>
  );
};

demo

Api

createApp

挂载根组件到 dom 上

mount root component on the dom

/*
  nodeOps: an plain object which includes some  platform apis, for example:
  {
    getElement(parent, child) {
      return parent.querySelector(child)
    },
    appendChild(parent, child) {
      parent.appendChild(child)
    },
    ...
  }
  if you just want to render it on the dom, just don't care the second parameter
*/

createApp(vnode: VNode, nodeOps?: NodeOps).mount(container: Dom | string)

ref & reactive

ref(value?)
reactive(obj)

const count = ref(0);
count.value++
console.log(cont.value) // update render

const state = reactive({
  list: [],
  users: {}
})
state.list.push({ msg: hello }) // update render

expose

import {expose, onMounted} from 'vvix'

const Child = () => {
  const count = ref(0)
  expose({
    count: count
  })
  return <div>child</div>
}
const Parent = () => {
  const childComponent = ref()
  onMounted

}

作者大学生佛系更新,欢迎提出好的 PR/issue 和 star ^_^

I won't guarantee when will it be finished, welcome you PR, issue and Star ^_^

github: https://github.com/JSerFeng/vvix