@happyvertical/smrt-playground

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

Shared playground discovery, runtime, and host components for SMRT UI packages

原始使用文档
文档目录4 节
  1. Purpose
  2. Surface Model
  3. Package-Owned Playground Modules
  4. Relationship To smrt playground

@happyvertical/smrt-playground

Shared playground discovery, runtime helpers, and host components for s-m-r-t UI packages.

Purpose

@happyvertical/smrt-playground powers the shared smrt playground experience. It discovers package-owned playground modules and renders them in a common host without forcing those packages to share a single route tree.

This package is about previews, not app routing.

Surface Model

s-m-r-t UI packages can expose three different surfaces:

  • ./svelte for reusable components
  • ./playground for preview metadata
  • package-local page shells under src/svelte/routes and src/routes when needed

@happyvertical/smrt-playground consumes ./playground, not package route trees.

For this release, most UI packages should stop at ./svelte and ./playground. Route/page shells can stay package-local until there is a concrete downstream need to standardize a public route contract.

For the full convention, see docs/ui-surfaces.md.

Package-Owned Playground Modules

Packages opt in by defining src/svelte/playground.ts.

That module should:

  • export stable preview entry IDs
  • point at real package components
  • provide mock fixtures or live configuration
  • stay importable from workspace source for smrt playground list

The shared host discovers these modules and renders them. Package pages do not need to be mounted into the shared playground.

PlaygroundHost accepts a qualified entry ID through selectedEntryId. When a parent changes a non-null controlled selection to null, the host restores its default module and entry. This keeps reactive route state aligned in both directions without remounting the host.

Relationship To smrt playground

The smrt playground CLI commands are the public entry point.

  • smrt playground init
  • smrt playground dev
  • smrt playground list

This package provides the runtime and host implementation behind those commands.

版本与发布记录

@happyvertical/smrt-playground 共发布 365 个版本,首次发布于 2026/06/23;过去 12 个月发布了 365 个版本。

版本发布日期距今
0.62.1latest2026/11/17今天
0.62.02026/11/17今天
0.61.62026/11/161 天前
0.61.52026/11/161 天前
0.61.42026/11/161 天前
0.61.32026/11/152 天前

关于 @happyvertical/smrt-playground 的常见问题

@happyvertical/smrt-playground 是什么?

Shared playground discovery, runtime, and host components for SMRT UI packages

如何安装 @happyvertical/smrt-playground?

在项目目录运行 npm install @happyvertical/smrt-playground,或使用 pnpm add / yarn add / bun add。

@happyvertical/smrt-playground 支持 TypeScript 吗?

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

@happyvertical/smrt-playground 支持 ESM 还是 CommonJS?

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

@happyvertical/smrt-playground 可以商用吗?

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

@happyvertical/smrt-playground 的下载量有多少?

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

@happyvertical/smrt-playground 还在维护吗?

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