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

@uneven/tpl-runtime

v0.1.0

Published

SWP TP4 cross-platform medical device template runtime

Readme

@uneven/tpl-runtime

TP4 医疗设备模板的无框架 DOM 运行时。核心包不依赖 Vue、Pinia 或业务 API,可用于 Vue 2.7、Vue 3 和纯 Web 设备页面。

当前能力

  • TP4/旧模板版本路由;旧模板通过宿主 legacyAdapter 回退现有 ParserV3。
  • editor.bounds 精确布局,缺失时回退 0-based Grid。
  • fixed 逻辑画布等比缩放。
  • primitive.text/image/rect 与 Renderer Registry。
  • 数据路径解析与按数据源增量区域刷新。
  • Android/Linux/Harmony Platform Adapter。
  • bed/door/beside/whiteboard/watchboard Device Profile。
  • HCareLabel 与自由 representativeElements
  • 可复制的诊断信息,不因未知组件导致整页崩溃。

安装与发布

cd packages/template-runtime
pnpm install
pnpm test
pnpm build
npm publish

构建输出:ESM、UMD/CJS 和 TypeScript 声明。

基础使用

import {
  AndroidPlatformAdapter,
  BedDeviceProfile,
  createTemplateRuntime,
} from '@uneven/tpl-runtime'

const runtime = createTemplateRuntime({
  container: document.querySelector('#template-root')!,
  template: templateContent,
  platformAdapter: new AndroidPlatformAdapter(fileUrlPrefix),
  deviceProfile: new BedDeviceProfile(),
  legacyAdapter: {
    mount(template, container) {
      // 交给 medical-device-v2 的 ParserV3 宿主组件。
      mountExistingParserV3(template, container)
    },
  },
})

await runtime.mount()
runtime.updateDataBatch({
  bedDeviceInfoVo: device.bedDeviceInfoVo,
  bedSickInfoVo: device.bedSickInfoVo,
  bedSickNursingLabelList: device.bedSickNursingLabelList,
})

medical-device-v2 接入

参考 examples/medical-device-v2.ts。推荐在现有 src/pages/home/index.tsx 外增加版本路由:TP4 挂载本包,旧 JSON 继续渲染 ParserV3。Pinia 只由宿主 Adapter 读取,本包不直接依赖设备 Store。

Android/Linux 的文件前缀、JSBridge、本地资源和交互差异放入 PlatformAdapter;床头机/门口机等数据整形和专用组件放入 DeviceProfile

扩展组件

registry.register('whiteboard.module', whiteboardRenderer)
registry.registerLegacy('HVideo', videoRenderer)

扩展设备类型时新增 DeviceProfile,扩展系统端时新增 PlatformAdapter,不要修改 Parser。

生命周期

设备页面卸载时必须调用 runtime.destroy(),释放 ResizeObserver、数据订阅和 Platform Adapter。

当前边界

  • 当前内置基础组件与护理标签;白板/看板业务组件通过插件注册。
  • responsive 布局预留,当前 fixed 模式完整实现。
  • transforms 结构已保留,业务变换函数可在后续版本注册。