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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@floatsheep/tg-talker

v2.0.0-alpha2.5

Published

中文(简体)| [English](README.md)

Downloads

6

Readme

TGTalk-Frontend

中文(简体)| English

TL;DR

  1. 部署 API

  2. 部署前端

    • 使用 CDN 部署项目

    • 引入样式文件和 Vue.js

    • 在 HTML 中添加显示内容的容器

    • 引入并初始化 tgTalker

  3. 示例代码

    <html>
      <head>
        <!--样式文件-->
        <link
          rel="stylesheet"
          href="https://registry.npmmirror.com/@floatsheep/tg-talker/latest/files/dist/style.css"
        />
      </head>
      <body>
        ...
        <!--显示内容的容器-->
        <div id="talk-container"></div>
        <!--显式引用 Vue.js-->
        <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
        <script src="https://registry.npmmirror.com/@floatsheep/tg-talker/latest/files/dist/tgTalker.umd.js"></script>
        <script>
          const talker = new tgTalker({
            serverUrl: "https://dev-tgtalk.floatsheep.workers.dev", // API
            selector: "#talk-container", // 显示内容的容器
            zoom: true, // 是否启用图片缩放
          });
          talker.init(); // 在容器中注入 talker
        </script>
      </body>
    </html>
  4. 配置

关于分支

我会使用一些新的工具来构建这个项目,这个分支储存了开发文件,但是最好不在生产环境使用

关于项目

这是一个使用 Vue.jsVite 重构的 TGTalk-Frontend

同时,本项目的 umd 格式文件打包体积与 v1 相比,减少了 ~54% 的包体积

TGTalk-Frontend v2 中,已不再提供 Markdown 的渲染支持

因为 Telegram 默认会渲染 Markdown,但本项目会处理一些 Telegram 的特殊标签

TGTalk-Frontend v2 中,已不再支持自定义模板

如有需要,可以克隆本项目进行自定义

如何使用

首先,你需要部署 API

参阅 API 部署

第二,你需要在网站上部署前端

你可以使用 CDN 来部署这个项目

<html>
  <head>
    <!--样式文件-->
    <link
      rel="stylesheet"
      href="https://registry.npmmirror.com/@floatsheep/tg-talker/latest/files/dist/style.css"
    />
  </head>
  <body>
    ...
    <!--显示内容的容器-->
    <div id="talk-container"></div>
    <!--为了显着减少包大小,我们没有将 vue 打包,因此您需要显式引用它-->
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://registry.npmmirror.com/@floatsheep/tg-talker/latest/files/dist/tgTalker.umd.js"></script>
    <script>
      const talker = new tgTalker({
        serverUrl: "https://dev-tgtalk.floatsheep.workers.dev", // API
        selector: "#talk-container", // 显示内容的容器
        zoom: true, // 是否启用图片缩放
      });
      talker.init(); // 在容器中注入 talker
    </script>
  </body>
</html>

配置详见:配置解析

项目依赖

  • 前端框架: Vue.js

  • 构建工具: Vite

  • 懒加载: vue3-lazy

  • 类 GitHub 评价:emaction

    • 由于 emaction 默认前端使用 Web Components 技术,考虑到兼容性问题,本项目中将其转换为 Vue SFC

      • 仅作 转换 并继承 bug
  • 图片缩放:v-viewer

  • 后端 API:在 ChenYFan 大佬基础上进行修改的 TGTalk-worker.js