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

@leejaehyeok/popup

v0.1.4

Published

팝업, 툴팁, 드롭다운 메뉴 등의 요소를 기준 요소(Reference)에 맞춰 자동으로 배치해주는 라이브러리입니다.

Readme

popup

팝업, 툴팁, 드롭다운 메뉴 등의 요소를 기준 요소(Reference)에 맞춰 자동으로 배치해주는 라이브러리입니다.

특징

  • 12가지 위치 지원: 상하좌우 및 각 모서리를 포함한 다양한 배치 옵션.
  • 자동 위치 조정 (auto mode): 화면 밖으로 벗어날 경우 자동으로 최적의 위치를 찾아 재배치.
  • 스크롤 및 리사이즈 감지: 윈도우 스크롤이나 크기 변경 시 위치 자동 업데이트.
  • 옵션: 간격(gap), 이벤트 감지 설정 등 제어 가능.

설치 (Installation)

npm install @leejaehyeok/popup

사용 방법 (Usage)

기본 사용법 (Basic Example)

<!-- 기준 요소 (Reference) -->
<div id="reference">기준 요소 (Ref)</div>

<!-- 팝업 요소 (Popup) -->
<div id="popup">
  <h3>Popup Title</h3>
  <p>생성된 팝업입니다.</p>
</div>

<script>
  const reference = document.querySelector("#reference");
  const popup = document.querySelector("#popup");

  const myPopup = createPopup(reference, popup, {
    placement: "left-top",
    mode: {
      auto: true,
    },
    gap: 12,
  });
</script>

API

createPopup(reference, popup, options)

팝업 인스턴스를 생성하는 함수입니다.

  • Parameters
    • reference: HTMLElement - 팝업의 기준이 되는 요소.
    • popup: HTMLElement - 배치될 팝업 요소.
    • options: Options (Optional) - 설정 옵션 객체.
  • Returns: Popup 인스턴스

Popup Methods

  • setOptions(options: Options): 생성 후 옵션을 동적으로 변경하고 위치를 업데이트합니다.
    popupInstance.setOptions({ placement: "top", gap: 20 });
    w

설정 옵션 (Options)

interface Options {
  placement?: Placement;
  gap?: number;
  mode?: Mode;
  event?: Event;
}

1. placement (Default: 'right-top')

팝업이 기준 요소의 어디에 위치할지 결정합니다.

| 분류 | 옵션 값 | 설명 | | ---------- | --------------------------------------- | ----------------------------------- | | Top | top, top-left, top-right | 위쪽 (중앙/왼쪽 정렬/오른쪽 정렬) | | Bottom | bottom, bottom-left, bottom-right | 아래쪽 (중앙/왼쪽 정렬/오른쪽 정렬) | | Left | left, left-top, left-bottom | 왼쪽 (중앙/위쪽 정렬/아래쪽 정렬) | | Right | right, right-top, right-bottom | 오른쪽 (중앙/위쪽 정렬/아래쪽 정렬) |

2. gap (Default: 10)

기준 요소(Reference)와 팝업 요소(Popup) 사이의 간격(px)을 설정합니다.

3. mode

팝업의 동작 모드를 설정합니다.

interface Mode {
  auto?: boolean; // 화면 밖으로 벗어날 경우 여유 공간으로 자동 배치 (Default: true)
}

4. event

위치 업데이트를 트리거할 이벤트를 설정합니다.

interface Event {
  resize?: boolean; // 윈도우 크기 변경 시 업데이트 (Default: true)
  scroll?: boolean; // 스크롤 시 업데이트 (Default: true)
}