@hadoku/watchparty-ui

中文文档
0.45.102发布于 2026/11/17MITTypeScriptES Module近 30 天下载 2.3万

React UI components for the Hadoku Watch Party application.

原始使用文档
文档目录10 节
  1. Installation
  2. Usage
  3. Basic Setup
  4. Configuration
  5. Development
  6. Publishing
  7. Development Notes
  8. Runtime Server Integration (Phase 2)
  9. CSS Reset / Preflight
  10. Dark Theme Lock / Extension Interference

@wolffm/watchparty-ui

React UI components for the Hadoku Watch Party application.

Installation

This package is published to GitHub Packages. To install:

  1. Configure npm to use GitHub Packages by creating/updating .npmrc:
@wolffm:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
  1. Install the package:
npm install @wolffm/watchparty-ui
# or
pnpm add @wolffm/watchparty-ui

Usage

Basic Setup

import { WatchPartyProvider, WatchPartyRoom } from '@wolffm/watchparty-ui';
import '@wolffm/watchparty-ui/dist/style.css';

function App() {
  return (
    <WatchPartyProvider serverOrigin="https://your-server.com">
      <WatchPartyRoom defaultRoomKey="your-room-key" />
    </WatchPartyProvider>
  );
}

Configuration

The UI components can be configured via props:

  • serverOrigin: WebSocket server URL (default: /)
  • defaultRoomKey: Room to join on mount (optional)

Development

To work on this package locally:

# Install dependencies
pnpm install

# Run dev server
pnpm dev

# Build for production
pnpm build

Publishing

This package is automatically published to GitHub Packages on every push to main that affects the UI code.

The version is CI's, never a commit's: publish-packages.yml sets it to one patch above the registry's newest (WolffM/hadoku-actions/next-version), in the CI workspace only, in lockstep with @wolffm/rooms-protocol and @wolffm/rooms-server. Never edit it by hand.


Development Notes

Phase 0 scaffold (React 19 + Vite) is in place.

Key config:

  • Base path: /watchparty/
  • Router basename: /watchparty
  • Tailwind + Zustand + socket.io-client

Runtime Server Integration (Phase 2)

The UI now auto-joins a placeholder room key demo when the user presses "Join Room" in the Identity drawer. It sends a Socket.IO join payload containing { room_key:'demo', leader_key?, name, sprite }.

Configure a different backend origin (if UI served from a different host) via environment:

VITE_SERVER_ORIGIN=https://api.example.com

If omitted, the client connects relative to current origin (/watchparty/ws).

Duplicate joins are suppressed (if me.clientId already populated). This interim flow will be replaced once a room selection / creation UX exists.

CSS Reset / Preflight

Tailwind v4 preflight is disabled to eliminate console warnings about legacy vendor selectors. A minimal custom reset is applied in src/styles.css. The theme uses CSS variables from @wolffm/themes mapped in the @theme block.

Dark Theme Lock / Extension Interference

The app enforces a permanent dark theme to avoid color inversion by extensions like Dark Reader:

  • Added <meta name="color-scheme" content="dark"> & data-theme="dark" on <html>.
  • Set data-darkreader-skip on <html> and <body> to hint Dark Reader not to transform.
  • Declared stable color CSS variables (--wp-*) and color-scheme: dark to reduce heuristics.
  • Explicit black background ensures no flash when extension toggles.

If future light mode is desired, introduce a controlled theme switch and remove data-darkreader-skip selectively rather than allowing uncontrolled extension mutation.

版本与发布记录

@hadoku/watchparty-ui 共发布 127 个版本,首次发布于 2026/10/28;过去 12 个月发布了 127 个版本。

版本发布日期距今
0.45.102latest2026/11/17今天
0.45.1012026/11/17今天
0.45.1002026/11/17今天
0.45.992026/11/17今天
0.45.982026/11/17今天
0.45.972026/11/17今天

关于 @hadoku/watchparty-ui 的常见问题

@hadoku/watchparty-ui 是什么?

React UI components for the Hadoku Watch Party application.

如何安装 @hadoku/watchparty-ui?

在项目目录运行 npm install @hadoku/watchparty-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.2.0)、react-dom(^19.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@hadoku/watchparty-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@hadoku/watchparty-ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@hadoku/watchparty-ui 可以商用吗?

@hadoku/watchparty-ui 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@hadoku/watchparty-ui 的下载量有多少?

根据 npm 官方下载统计,@hadoku/watchparty-ui 在 2026/10/17 – 2026/11/15 这 30 天内被下载 23,137 次,日均约 771 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@hadoku/watchparty-ui 还在维护吗?

最新版本 0.45.102 发布于 2026/11/17(今天);至今共发布 127 个版本,其中过去 12 个月发布了 127 个;首次发布于 2026/10/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。