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

@photon-link/sdk

v1.1.0

Published

PhotonLink(光子互联)SDK - 基于 WebHID 的游戏外设通信库

Readme

PhotonLink SDK

光子互联 - 基于 WebHID 的游戏外设通信 SDK。

✨ 特性

  • 🔌 WebHID 通信 - 原生浏览器 HID 设备通信
  • 📦 多协议支持 - HP / BY / XSYDV2 协议
  • 🎯 TypeScript - 完整的类型定义
  • 🔧 模块化设计 - 按需导入,支持 Tree Shaking

📦 安装

pnpm add @photon-link/sdk

🚀 快速开始

import { HP } from '@photon-link/sdk';

const sdk = new HP.SDK({
  filters: [
    { vendorId: 0x3402, productId: 0x0300, usage: 0x01, usagePage: 0xff00 },
  ],
});

const device = await sdk.requestDevice();
if (device) {
  await sdk.connect(device.id);
  
  const info = await sdk.system.getDeviceInfo();
  console.log(info);
  
  await sdk.disconnect();
}

📖 API 结构

import { HP } from '@photon-link/sdk';

// SDK 主类
const sdk = new HP.SDK({ filters: [...] });

// 功能模块
sdk.system       // 系统
sdk.light        // 灯光
sdk.key          // 按键
sdk.advancedKey  // 高级键
sdk.performance  // 性能
sdk.macro        // 宏
sdk.update       // 固件升级

// 协议枚举
HP.Command.CMD_SYS_SYNC
HP.Profile.PROFILE_1
HP.LightAreaType.MAIN_RGB_DOWN

🔧 功能示例

系统

const info = await sdk.system.getDeviceInfo();
await sdk.system.restoreFactorySettings([HP.Profile.PROFILE_1]);
await sdk.system.setLockWin(HP.LockWinSubCommand.LOCK);
await sdk.system.setReportRate(1000);

灯光

const areas = await sdk.light.getLightArea();
const config = await sdk.light.getLightConfig(HP.LightAreaType.MAIN_RGB_DOWN);
await sdk.light.setLightAreaRGB(HP.LightAreaType.MAIN_RGB_DOWN, data);

按键

const layout = await sdk.key.getFullLayout(0, 6, 16);
await sdk.key.setKey(0, 0, 0, 0x04);

固件升级

await sdk.update.enterBoot();
await sdk.update.updateFirmware(data, (cur, total) => console.log(`${cur}/${total}`));
await sdk.update.checkFirmware();
await sdk.update.jumpToApp();

📦 导出内容

import {
  HP,           // HP 协议
  BY,           // BY 协议
  XSYDV2,       // XSYDV2 协议
  
  SDKError,     // 错误类
  TimeoutError,
  
  DeviceStatus, // 设备状态
  DeviceEvent,
  
  Logger,       // 日志
  LogLevel,
  
  SDK_VERSION,  // 版本
} from '@photon-link/sdk';

📁 输出格式

dist/
├── esm/    # ES Module
├── cjs/    # CommonJS
└── umd/    # UMD

浏览器使用

<script src="dist/umd/index.min.js"></script>
<script>
  const sdk = new PhotonLink.HP.SDK({ filters: [...] });
</script>

📄 License

MIT