@covet-pics/covet-pics-widget

中文文档
0.180.0发布于 2026/11/03MITTypeScriptESM + CJS近 30 天下载 5278

Covet.pics Widget System

原始使用文档
文档目录10 节
  1. Getting Started
  2. Components Overview
  3. covet-pics-widget
  4. covet-pics-gallery-grid
  5. covet-pics-gallery-slider
  6. covet-pics-gallery-popup
  7. covet-pics-gallery-item
  8. Using Covet.pics Widget components
  9. Script tag
  10. Node Modules

Built With Stencil

Covet.pics Widget

Standalone Covet.pics Web Component built using Stencil.

Getting Started

Clone this repo to a new directory:

git clone https://github.com/SpaceSquirrelApps/covet-pics-widget.git covet-pics-widget
cd covet-pics-widget

and run:

npm install
npm start

To build the component for production, run:

npm run build

To run the unit tests for the components, run:

npm test

Need help? Check out Stencil docs here.

Components Overview

covet-pics-widget

This component will grab gallery embed data from Covet.pics API and parse settings to determine gallery layout (grid, slider, collage) and other settings, like colors, sizes, paddings, etc. It will then render appropriate components

This is a Grid layout with options to render "highlighted" images. There are two main layout modes supported (grid or collage) and can be toggled through property layout. Items in grid are <covet-pics-gallery-item>.

On initialization, element will also create <covet-pics-popup> and inject it just before </body>. This is done so that popup will always be on top of the any page element.

This is a Slider (also known as slideshow) layout. Same as <covet-pics-gallery-grid>, items in slider are <covet-pics-gallery-item> and slider is creating <covet-pics-popup> and injecting just before </body>.

This is a popup component that's used in tandem with <covet-pics-gallery-grid> & <covet-pics-gallery-slider>.

This is essential building block and child element for <covet-pics-gallery-grid> or <covet-pics-gallery-slider>

Using Covet.pics Widget components

Script tag

  • Publish to NPM
  • Put a script tag similar to this <script src='https://unpkg.com/@covet-pics/covet-pics-widget@latest/dist/covet-pics-widget/covet-pics-widget.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc.
  • Typical usage would be to render a gallery. For this you need to know Gallery Embed ID and then you can embed only covet-pics-widget and that component will take care of loading all necessary elements, for eg. this is what embed code markup would look like:
<body>

  ...

  <covet-pics-widget gallery-embed-id="XYZ"></covet-pics-widget>

  ...

</body>

After component is loaded, markup could looks like this (if it's grid layout):

<body>

  ...

  <covet-pics-widget gallery-embed-id="XYZ">
    <covet-pics-gallery-grid>
      <covet-pics-gallery-item>...</covet-pics-gallery-item>
      <covet-pics-gallery-item>...</covet-pics-gallery-item>
      <covet-pics-gallery-item>...</covet-pics-gallery-item>
      <covet-pics-gallery-item>...</covet-pics-gallery-item>
      <covet-pics-gallery-item>...</covet-pics-gallery-item>
      <covet-pics-gallery-item>...</covet-pics-gallery-item>
    </covet-pics-gallery-grid>
  </covet-pics-widget>

  ...

  <covet-pics-popup>
    ...
  </covet-pics-popup>

</body>

Node Modules

  • Run npm install covet-pics-widget --save
  • Put a script tag similar to this <script src='node_modules/covet-pics-widget/dist/covet-pics-widget.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Testing

  • To update snapshots run: npm test -u or yarn test -u or npm run test --updateSnapshot

CDN

We use jsDelivr.com, full URL: https://cdn.jsdelivr.net/npm/@covet-pics/covet-pics-widget@latest/dist/covet-pics-widget/covet-pics-widget.esm.js

After each new version is released, purge cache on jsDeliver: https://www.jsdelivr.com/tools/purge

版本与发布记录

@covet-pics/covet-pics-widget 共发布 909 个版本,首次发布于 2020/08/26;过去 12 个月发布了 57 个版本。

版本发布日期距今
0.180.0latest2026/11/037 天前
0.179.6beta2026/11/037 天前
0.179.52026/10/071 个月前
0.179.42026/09/221 个月前
0.179.32026/09/111 个月前
0.179.22026/09/111 个月前

关于 @covet-pics/covet-pics-widget 的常见问题

@covet-pics/covet-pics-widget 是什么?

Covet.pics Widget System

如何安装 @covet-pics/covet-pics-widget?

在项目目录运行 npm install @covet-pics/covet-pics-widget,或使用 pnpm add / yarn add / bun add。

@covet-pics/covet-pics-widget 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@covet-pics/covet-pics-widget 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@covet-pics/covet-pics-widget 可以商用吗?

@covet-pics/covet-pics-widget 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@covet-pics/covet-pics-widget 的下载量有多少?

根据 npm 官方下载统计,@covet-pics/covet-pics-widget 在 2026/10/11 – 2026/11/09 这 30 天内被下载 5,278 次,日均约 176 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@covet-pics/covet-pics-widget 还在维护吗?

最新版本 0.180.0 发布于 2026/11/03(7 天前);至今共发布 909 个版本,其中过去 12 个月发布了 57 个;首次发布于 2020/08/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。