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

@ptengine/ui-angular

v0.3.1

Published

Ptengine 基础组件的 Angular 包装层(standalone)。由 @ptengine/ui 构建时自动生成,不手写。

Readme

@ptengine/ui-angular

@ptengine/ui 的 Angular 包装层(standalone components)。 由构建自动生成,不手写 —— src/directives/ 下的文件是 Stencil 的 Angular output target 在 pnpm build 时产出的。

最低支持 Angular 19:output target 1.x 起要求 standalone 组件的现代写法。

安装

npm i @ptengine/ui-angular

样式表

不用手动引:第一个组件连上页面时,会把设计变量(ptengine-ui.css 的内容)自动挂到 document 上。

服务端渲染的项目建议手动引一次,否则 JS 到达之前首屏没有样式、会闪一下。引了的话自动注入会跳过。 放在 angular.json 的 styles 里,并把 @ptengine/ui 装成直接依赖(npm i @ptengine/ui,pnpm 下间接依赖找不到):

"styles": ["node_modules/@ptengine/ui/dist/ptengine-ui/ptengine-ui.css", "src/styles.css"]

用法

import { PtButton, PtInput, TextValueAccessor } from '@ptengine/ui-angular';

@Component({
  standalone: true,
  imports: [FormsModule, PtButton, PtInput, TextValueAccessor],
  template: `
    <pt-input [(ngModel)]="value" name="q"></pt-input>
    <pt-button variant="brand" (click)="submit()">提交</pt-button>
  `
})
export class FormComponent {
  value = '';
}

事件转成 Angular 的 Output:(ptChange)、(ptClose)。

[!WARNING] 别忘了 value accessor。 standalone 组件必须在 imports 里显式带上用到的 accessor, 否则 ngModel 找不到 accessor, 整棵变更检测会在第一次渲染就抛异常 —— 症状是「所有绑定都不更新」, 很容易误判成组件本身坏了。

| accessor | 绑定的属性 | 覆盖的元素 | | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------- | | TextValueAccessor | value | input、textarea、select、radio-group、tabs、accordion、menu-group、toggle-group、slider、calendar | | BooleanValueAccessor | checked | checkbox、switch | | PressedValueAccessor | pressed | toggle | | OpenValueAccessor | open | collapsible |

响应式表单同样可用:

imports: [ReactiveFormsModule, PtInput, TextValueAccessor];
<pt-input [formControl]="keyword"></pt-input>

轻提示(toast)

命令式的 toast() 从 @ptengine/ui/toast 导入。 <pt-toaster>(imports 里带上 PtToaster)挂在根组件末尾一次即可;不挂也能用, toast() 会在 <body> 末尾建一个:

import { PtToaster } from '@ptengine/ui-angular';
import { toast } from '@ptengine/ui/toast';

// 根组件模板里:<pt-toaster position="top-center" rich-colors></pt-toaster>
toast.success('已保存');

action.onClick / onDismiss / onAutoClose 这些回调由 toaster 自己的点击与计时触发,而包装层让组件在 NgZone 之外渲染,回调也就跑在 zone 外:里面改组件状态要包一层 ngZone.run(() => …),否则界面要等下一次 别的变更检测才刷新。

版本

与 @ptengine/ui 锁步发版、共用一个版本号。