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

tqsk-draw-sdk

v1.0.7

Published

A react library developed with dumi

Readme

tqsk-draw-sdk

NPM 安装并使用

  • NPM 引入
npm i -S tqsk-draw-sdk
  • 使用
import tqskDrawSdk from 'tqsk-draw-sdk';

// 初始化
const tqskDrawInstance = await tqskDrawSdk.init(
  document.getElementById('tqsk-draw'),
);
// 或者
tqskDrawSdk
  .init(document.getElementById('tqsk-draw'))
  .then(function (tqskDrawInstance) {
    console.log(tqskDrawInstance);
  });

// tqskDrawInstance获取到后,可用于后续操作

浏览器安装并使用

  • 浏览器引入
<script src="https://unpkg.com/tqsk-draw-sdk"></script>
  • 使用
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
    </style>
    <script src="https://unpkg.com/tqsk-draw-sdk"></script>
  </head>
  <body>
    <div id="tqsk-draw"></div>

    <script>
      tqskDrawSdk
        .init(document.getElementById('tqsk-draw'), {
          width: '100vw', // 默认 100%,
          height: '100vh', // 默认 100%,
        })
        .then(function (tqskDrawInstance) {
          // 获取的实例,可用于后续操作
          console.log(tqskDrawInstance);
        });
    </script>
  </body>
</html>

开发代理

  • 浏览器访问的 tqsk-draw 服务地址,代理到 tqsk-draw 服务地址,确保能获取到 tqskDrawInstance
{
  "/tqsk-draw": {
    "target": "您的tqsk-draw服务地址",
    "changeOrigin": true,
    "pathRewrite": { "^/tqsk-draw": "" }
  }
}

部署

  • Nginx 配置代理
location ~* /tqsk-draw/(.*)$ {
   proxy_pass http://您的tqsk-draw IP地址/$1?$args ;
   proxy_set_header  Host 您的tqsk-draw服务地址;
   proxy_max_temp_file_size 0;
}

tqskDrawSdk

| 参数 | 说明 | 类型 | 默认值 | 版本 | | ---- | ---------- | -------------------------------------------------- | ------ | ----- | | init | 初始化实例 | (root, optionsConfig) => Promise | - | 1.0.0 |

  • optionsConfig

| 参数 | 说明 | 类型 | 默认值 | 必填 | | -------- | ------------------------ | ------ | --------------------- | ---- | | width | 宽度 | string | 100% | 否 | | height | 高度 | string | 100% | 否 | | src | tqsk-draw 服务地址 | string | /tqsk-draw/index.html | 否 | | loadTime | 加载成功并获取实例的延迟 | number | 200 | 否 |

tqsk-draw 服务地址需要与当前页面部署在同一个域名下,否则会出现跨域问题。可代理/tqsk-draw 到自己应用的域名下

tqskDrawInstance

| 参数 | 说明 | 类型 | 默认值 | 版本 | | ------------- | ------------------------------- | ---------------------------------------------------- | ------ | ----- | | getSmiles | 获取 Smiles 码 | (isExtended = false): Promise | - | 1.0.0 | | getMolfile | 获取 Mol 码 | (): Promise | - | 1.0.0 | | getInchiKey | 获取 InchiKey | (): Promise | - | 1.0.0 | | setMolecule | 设置 Mol 码或 Smiles 码到编辑器 | (structure: string, options?: Object): Promise | - | 1.0.0 | | layout | 内容重新排版 | (): Promise | - | 1.0.0 | | generateImage | 生成图片 | (data: string, options?: Object): Promise | - | 1.0.0 |

  • 生成图片
generateImage(data: string, options: {
    outputFormat: 'png' | 'svg';
    backgroundColor: string;
    bondThickness: number;
}): Promise<Blob>