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

@lytjs/core-vnode

v6.9.6

Published

Lyt.js Core - VNode rendering mode only

Readme

@lytjs/core-vnode

LytJS 核心应用 API(VNode 渲染模式),适合传统模板渲染场景

安装

npm install @lytjs/core-vnode

与 @lytjs/core 的区别

| 特性 | @lytjs/core-vnode | @lytjs/core | | -------- | ----------------- | --------------------- | | 渲染模式 | 仅 VNode | VNode + Signal 双模式 | | 包体积 | 更小 | 完整功能 | | 适用场景 | 传统模板应用 | 需要双模式切换的应用 |

核心 API

createApp

创建 VNode 模式应用实例:

import { createApp, defineComponent, ref, h } from '@lytjs/core-vnode';

const App = defineComponent({
  setup() {
    const count = ref(0);

    const increment = () => {
      count.value++;
    };

    return () =>
      h('div', [h('p', `Count: ${count.value}`), h('button', { onClick: increment }, 'Increment')]);
  },
});

const app = createApp(App);
app.mount('#app');

使用模板

import { createApp, defineComponent, ref } from '@lytjs/core-vnode';

const App = defineComponent({
  template: `
    <div>
      <p>Count: {{ count }}</p>
      <button @click="increment">Increment</button>
    </div>
  `,
  setup() {
    const count = ref(0);
    const increment = () => count.value++;
    return { count, increment };
  },
});

createApp(App).mount('#app');

生命周期钩子

import {
  onMounted,
  onUnmounted,
  onUpdated,
  onBeforeMount,
  onBeforeUnmount,
  onBeforeUpdate,
  onErrorCaptured,
} from '@lytjs/core-vnode';

const App = defineComponent({
  setup() {
    onMounted(() => {
      console.log('组件已挂载');
    });

    onUnmounted(() => {
      console.log('组件已卸载');
    });

    onErrorCaptured((err, instance, info) => {
      console.error('捕获到错误:', err, info);
      return false; // 阻止错误传播
    });
  },
});

内置组件

import {
  KeepAlive,
  Suspense,
  Transition,
  TransitionGroup,
  Teleport,
  ErrorBoundary,
} from '@lytjs/core-vnode';

// KeepAlive 缓存组件
// Suspense 处理异步组件
// Transition/TransitionGroup 过渡动画
// Teleport 传送内容
// ErrorBoundary 错误边界

响应式 API

从 @lytjs/reactivity 重导出:

import {
  // 基础响应式
  ref,
  reactive,
  computed,
  watch,
  watchEffect,
  // 工具函数
  toRef,
  toRefs,
  unref,
  toValue,
  // 类型守卫
  isRef,
  isReactive,
  isReadonly,
  isProxy,
} from '@lytjs/core-vnode';

组合式 API

import {
  useSlots,
  useAttrs,
  useModel,
  useTemplateRef,
  useId,
  useCssModule,
  useCssVars,
} from '@lytjs/core-vnode';

类型定义

import type {
  App,
  AppConfig,
  Component,
  ComponentOptions,
  ComponentPublicInstance,
  VNode,
  VNodeChildren,
} from '@lytjs/core-vnode';

相关包