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

@over-ui/core

v1.1.0

Published

`core` 패키지는, `over-ui` 패키지 전체에서 사용하는 훅, 유틸, 타입을 모아둔 패키지입니다. 내부에서만 사용하는 패키지입니다.

Downloads

16

Readme

over-ui/core

core 패키지는, over-ui 패키지 전체에서 사용하는 훅, 유틸, 타입을 모아둔 패키지입니다. 내부에서만 사용하는 패키지입니다.

Usage

core/poly

poly는, 컴포넌트를 다형적으로 이용할 수 있는 type 입니다.
아래와 같이, 사용해 컴포넌트를 작성한다면 해당 tag에 맞는 attribute만을 받고
존재하지 않는 attribute를 사용하게 된다면 typescript에서 오류가 발생합니다.

import * as React from 'react';
import { Poly } from '@over-ui/core';

type DemoProps = {
  children?: React.ReactNode;
  // Props type
};

const DEFAULT_DEMO_TAG = 'li';

const Demo: Poly.Component<typeof DEFAULT_DEMO_TAG, DemoProps> = React.forwardRef(
  <T extends React.ElementType = typeof DEFAULT_DEMO_TAG>(
    props: Poly.Props<T, DemoProps>,
    forwardedRef: Poly.Ref<T>
  ) => {
    const { as, children, ...restProps } = props;

    const Component = as || DEFAULT_DEMO_TAG;

    return (
      <Component {...restProps} ref={forwardedRef}>
        {children}
      </Component>
    );
  }
);

const DemoPage = () => {
  const liRef = React.useRef<HTMLLIElement>(null);
  const divRef = React.useRef<HTMLDivElement>(null);
  const videoRef = React.useRef<HTMLVideoElement>(null);

  return (
    <>
      {/* 
      <Demo ref={videoRef}>poly component</Demo>
      // error
       */}
      <Demo as="video" ref={videoRef} />
      <Demo as="div" ref={divRef} />
      <Demo ref={liRef} />

      {/* span 태그의 경우 대부분의 ref 타입을 받을 수 있어 오류가 나지 않습니다. */}
      <span ref={videoRef}>some fancy text</span>
    </>
  );
  /* as prop을 이용해, 해당 컴포넌트의 태그를 바꿀 수 있습니다. */
  /* as prop으로 사용한 태그에 알맞는 ref 타입만을 받을 수 있습니다. */
};

export default DemoPage;

core/composeEvent

외부에서 주입한 이벤트와 내부에 미리 선언되어있는 이벤트를 합성해주는 유틸 함수입니다.

import * as React from 'react';
import { Poly, composeEvent } from '@over-ui/core';

type DemoProps = {
  children?: React.ReactNode;
};

const DEFAULT_DEMO_TAG = 'div';

const Demo: Poly.Component<typeof DEFAULT_DEMO_TAG, DemoProps> = React.forwardRef(
  <T extends React.ElementType = typeof DEFAULT_DEMO_TAG>(
    props: Poly.Props<T, DemoProps>,
    forwardedRef: Poly.Ref<T>
  ) => {
    const { as, children, onClick, ...restProps } = props;
    /* onClick 이벤트를 새로운 props으로 받을 수 있습니다. */
    const Component = as || DEFAULT_DEMO_TAG;

    const handleClick = () => {
      console.log('clicked!');
    };
    /* 기존 이벤트와 새롭게 추가된 이벤트를 합성합니다 */
    return (
      <Component onClick={composeEvent(handleClick, onClick)} {...restProps}>
        {children}
      </Component>
    );
  }
);

Demo.displayName = 'Demo';

const DemoPage = () => {
  const handleClick = () => {
    console.log('in outside');
  };
  return <Demo onClick={handleClick}>poly component</Demo>;
};

export default DemoPage;

core/useSafeContext

const ToggleContext = React.createContext<any>(null);

const MultiItem = (props: singItemPRops) => {
  const { children, value, ...restProps } = props;
  const { pressedValue, setPressedValue } = useSafeContext(ToggleContext, 'Toggle.MultiItem');
  // useSafeContext를 사용해, 개별적은 useToggleContext 등의 훅을 작성하지 않아도 됩니다.
  const isPressed = pressedValue === value;
  const ariaProps = {
    role: 'radio',
    'aria-pressed': undefined,
    'aria-checked': isPressed,
  };
  return (
    <Toggle
      tabIndex={-1}
      pressed={isPressed}
      onPressedChange={(pressed) => (pressed ? setPressedValue(value) : setPressedValue(''))}
      {...ariaProps}
      {...restProps}
    >
      {children}
    </Toggle>
  );
};