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

@calenderjs/core

v0.0.2

Published

CalenderJS 核心日历组件库 - 基于 Web Components

Readme

@calenderjs/core

CalenderJS 核心日历组件库,支持基于 Appointment DSL 的渲染。

安装

pnpm add @calenderjs/core @calenderjs/event-dsl

使用示例

基础用法

<!DOCTYPE html>
<html>
<head>
  <script type="module">
    import { Calendar } from '@calenderjs/core';
    
    // 注册组件
    customElements.define('wsx-calendar', Calendar);
    
    // 使用组件
    const calendar = document.querySelector('wsx-calendar');
    calendar.setAppointments([
      {
        id: '1',
        title: '团队会议',
        startTime: new Date('2024-12-20T10:00:00'),
        endTime: new Date('2024-12-20T11:00:00'),
        color: '#4285f4'
      }
    ]);
  </script>
</head>
<body>
  <wsx-calendar></wsx-calendar>
</body>
</html>

使用 DSL 渲染

import { Calendar } from '@calenderjs/core';
import { AppointmentDSLCompiler, AppointmentDSLRuntime } from '@calenderjs/event-dsl';
import { meetingAppointmentType } from './appointment-types';

// 定义 DSL
const dsl = {
  types: [meetingAppointmentType]
};

// 编译 DSL
const compiler = new AppointmentDSLCompiler();
const compiled = compiler.compile(dsl);

// 创建运行时
const runtime = new AppointmentDSLRuntime(compiled);

// 使用组件
const calendar = document.querySelector('wsx-calendar') as Calendar;
calendar.setDSLRuntime(runtime);
calendar.setAppointments([
  {
    id: '1',
    type: 'meeting',
    title: '团队会议',
    startTime: new Date('2024-12-20T10:00:00'),
    endTime: new Date('2024-12-20T11:00:00'),
    dslData: {
      attendees: ['[email protected]', '[email protected]'],
      location: '会议室 A'
    }
  }
]);

API

Calendar 类

方法

  • setDSLRuntime(runtime: AppointmentDSLRuntime): 设置 DSL 运行时
  • setAppointments(appointments: Appointment[]): 设置预约列表

属性

  • default-view: 默认视图('month' | 'week' | 'day')
  • data-appointments: JSON 格式的预约列表

特性

  • ✅ 基于 Web Components 标准
  • ✅ 支持月/周/日三种视图
  • ✅ 支持 DSL 渲染
  • ✅ 支持拖拽和调整大小(待实现)
  • ✅ 响应式设计