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

@libs-ui/components-minimap

v0.2.356-1

Published

> Thêm bản đồ thu nhỏ (Minimap) cho các vùng chứa có nội dung lớn hoặc cuộn.

Readme

@libs-ui/components-minimap

Thêm bản đồ thu nhỏ (Minimap) cho các vùng chứa có nội dung lớn hoặc cuộn.

Giới thiệu

LibsUiComponentsMinimapDirective là một standalone directive giúp tạo ra một trải nghiệm chuyển hướng trực quan cho người dùng trong các bảng vẽ (canvas), sơ đồ hoặc các vùng nội dung rộng lớn. Nó tự động theo dõi thay đổi trong DOM và đồng bộ hóa vị trí cuộn giữa nội dung chính và bản đồ thu nhỏ.

Tính năng

  • Standalone Directive: Dễ dàng tích hợp vào bất kỳ phần tử nào có thuộc tính cuộn.
  • Đồng bộ hai chiều: Cuộn nội dung chính cập nhật Minimap, kéo viewport trên Minimap cập nhật nội dung chính.
  • Theo dõi thay đổi: Sử dụng MutationObserver để tự động cập nhật hình ảnh trên Minimap khi nội dung thay đổi.
  • Tùy biến cao: Cho phép cấu hình vị trí, kích thước, màu sắc và z-index của cả Minimap và Viewport.
  • Hỗ trợ Scale: Khả năng nhận diện tỷ lệ phóng to/thu nhỏ của nội dung để hiển thị chính xác.

Khi nào sử dụng

  • Khi có các vùng chứa nội dung lớn vượt quá kích thước màn hình (sơ đồ, bản đồ văn phòng, editor đồ họa).
  • Khi người dùng cần cái nhìn tổng quan về cấu trúc nội dung và khả năng di chuyển nhanh chóng đến các vùng cụ thể.
  • Thay thế hoặc hỗ trợ cho thanh cuộn truyền thống trên các giao diện phức tạp.

Cài đặt

# npm
npm install @libs-ui/components-minimap

# yarn
yarn add @libs-ui/components-minimap

Import

import { LibsUiComponentsMinimapDirective } from '@libs-ui/components-minimap';

@Component({
  standalone: true,
  imports: [LibsUiComponentsMinimapDirective],
  // ...
})
export class YourComponent {}

Ví dụ

Cơ bản

<div
  class="w-full h-[500px] overflow-auto"
  LibsUiComponentsMinimapDirective>
  <!-- Nội dung lớn ở đây -->
  <div class="w-[2000px] h-[2000px]">...</div>
</div>

Với cấu hình Styles và Controls

<div
  class="scroll-container"
  LibsUiComponentsMinimapDirective
  [styleImageElement]="{ bottom: 20, right: 20, width: 200, height: 120 }"
  [styleRectangleElement]="{ border: '2px solid #3b82f6' }"
  (outFunctionControls)="controls = $event">
  ...
</div>

<button (click)="controls.toggle()">Bật/Tắt Minimap</button>

API

[LibsUiComponentsMinimapDirective]

Inputs

| Property | Type | Default | Description | | ----------------------------- | --------------------- | -------------------------------------- | ---------------------------------------------------- | | [elementScroll] | HTMLElement | Host Element | Phần tử đích để theo dõi cuộn (nếu khác host). | | [styleImageElement] | IMiniMapStyleConfig | undefined | Cấu hình phong cách và vị trí cho khung Minimap. | | [styleRectangleElement] | IMiniMapStyleConfig | undefined | Cấu hình cho khung Viewport trên Minimap. | | [timerStartDrawMinimap] | number | 250 | Thời gian chờ (ms) trước khi bắt đầu vẽ Minimap. | | [classNameFlagElementScale] | string | 'libs-ui-minimap-flag-element-scale' | Class name để xác định phần tử chứa scale transform. |

Outputs

| Property | Type | Description | | ----------------------- | --------------------------------------- | ---------------------------------------------------- | | (outFunctionControls) | EventEmitter<IMiniMapFunctionControl> | Phát ra bộ điều khiển để điều khiển Minimap từ code. |

Methods (via Controls)

| Method | Parameters | Description | | ---------- | ---------- | ------------------------------- | | show() | - | Hiển thị Minimap. | | hidden() | - | Ẩn Minimap. | | toggle() | - | Chuyển đổi trạng thái hiển thị. |

Types & Interfaces

export interface IMiniMapStyleConfig {
  zIndex?: number;
  border?: string;
  borderRadius?: number;
  background?: string;
  top?: number;
  left?: number;
  bottom?: number;
  right?: number;
  width?: number;
  height?: number;
  x?: number;
  y?: number;
}

export interface IMiniMapFunctionControl {
  show: () => void;
  hidden: () => void;
  toggle: () => void;
}

Công nghệ

| Technology | Purpose | | ---------------- | ------------------------- | | Angular 18+ | Framework chính | | Angular Signals | Quản lý trạng thái nội bộ | | MutationObserver | Theo dõi thay đổi DOM | | DOM Cloning | Tạo hình ảnh thu nhỏ |

License

MIT