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

@antglobal/copilot-cards-mini-program

v1.0.3

Published

Mini-program native renderer for copilot bot card SDK — adapts to WeChat / Alipay / DingTalk mini-program templates

Downloads

953

Readme

@antglobal/copilot-cards-mini-program

Native renderer for schema-driven cards in Alipay and WeChat mini-programs. It converts the same card schema used by the Web renderer into mini-program data trees and native component templates.

The package includes platform adapters, action integration, incremental streaming, and ready-to-register native components.

Installation

npm install @antglobal/copilot-cards-mini-program

@antglobal/copilot-cards-core is installed automatically.

Quick start

import {
  AlipayAdapter,
  renderForMiniProgram,
} from "@antglobal/copilot-cards-mini-program";

const adapter = new AlipayAdapter();

const card = renderForMiniProgram(schema, {
  adapter,
  data: { userName: "Alice" },
  onEmit: (eventName, payload) => {
    console.log(eventName, payload);
  },
});

this.setData(card.getData());

await card.handleEvent(nodeId, eventName, detail);
this.setData(card.getData());

card.dispose();

Use WeChatAdapter instead of AlipayAdapter in WeChat mini-programs.

Register native components

Register the components used by your pages in app.json or the page-level JSON file:

{
  "usingComponents": {
    "card-root": "@antglobal/copilot-cards-mini-program/components/card-root/index",
    "card-node": "@antglobal/copilot-cards-mini-program/components/card-node/index",
    "card-text": "@antglobal/copilot-cards-mini-program/components/card-text/index",
    "card-button": "@antglobal/copilot-cards-mini-program/components/card-button/index",
    "card-image": "@antglobal/copilot-cards-mini-program/components/card-image/index",
    "card-icon": "@antglobal/copilot-cards-mini-program/components/card-icon/index",
    "card-input": "@antglobal/copilot-cards-mini-program/components/card-input/index",
    "card-divider": "@antglobal/copilot-cards-mini-program/components/card-divider/index"
  }
}

The npm package contains both Alipay .axml/.acss assets and WeChat .wxml/.wxss assets.

Supported components

| Component | Schema type | Purpose | | --- | --- | --- | | card-root | Root | Owns the renderer instance and event bridge | | card-node | Layout node | Recursively renders the card tree | | card-text | Text | Styled text content | | card-button | Button | Interactive button variants | | card-image | Image | Images with fit modes | | card-icon | Icon | Built-in SVG names, external sources, or emoji fallback | | card-input | Input | Text input and variable synchronization | | card-divider | Divider | Horizontal separators |

Platform adapters

AlipayAdapter and WeChatAdapter implement a shared interface for:

  • HTTP requests
  • toast notifications
  • page navigation
  • system information
  • clipboard access

You can supply your own MiniProgramAdapter when integrating another compatible runtime.

Events and actions

handleEvent(nodeId, eventName, detail) maps native mini-program events back to schema actions. Supported action behavior is shared with @antglobal/copilot-cards-core, including requests, emitted events, variable updates, toast notifications, navigation, and copy actions.

The package exports event-name maps and createEventDetail for custom component integration.

Streaming

Use createStreamingCardInstance for incrementally generated cards:

import {
  createStreamingCardInstance,
  WeChatAdapter,
} from "@antglobal/copilot-cards-mini-program";

const stream = createStreamingCardInstance({
  adapter: new WeChatAdapter(),
});

for (const patch of stream.feed(chunk)) {
  this.setData(patch.data);
}

for (const patch of stream.flush()) {
  this.setData(patch.data);
}

Streaming returns minimal setData patches instead of mutating a browser DOM.

Related packages

  • @antglobal/copilot-cards-core — shared schema, expression, action, lifecycle, icon, and streaming logic.
  • @antglobal/copilot-cards-web — browser and WebView renderer.

License

MIT