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

@seed-design/stylesheet

v1.0.4

Published

## 설치

Downloads

2,465

Readme

@seed-design/stylesheet

설치

npm install @seed-design/stylesheet
yarn add @seed-design/stylesheet

가이드

HTML 메타태그 삽입하기

참고: https://web.dev/i18n/ko/color-scheme/#color-scheme

애플리케이션이 지원하는 컬러 스킴을 브라우저에게 여러 방법으로 알릴 수 있습니다. 그 중 메타태그를 사용하는 것이 가장 빠른 방법이므로 가능한 경우 명시하는 것을 권장합니다.

<meta name="color-scheme" content="light dark" />

CSS 스타일시트 로딩하기 (DOM)

웹 브라우저에서 실행되는 경우 Seed Design 의 모든 속성 정의는 CSS Variables를 통해 제공됩니다.

Seed Design의 스타일시트 리소스를 사용할 수 있도록 우선 로딩 해야합니다.

<!-- 브라우저가 자산을 우선적으로 처리하도록 preload 표시 -->
<link rel="preload" href="uri/to/global.css" as="style" />

<link rel="stylesheet" href="uri/to/global.css" />

웹팩 등 자바스크립트 번들러에 의해 처리되는 경우, MiniCssExtractPlugin 등으로 사전에 추출되어 주요 렌더링 경로에 배치해야합니다.

import "@seed-design/stylesheet/global.css";

루트 엘리먼트(<html>) 초기화

Seed Design 에서 제공하는 속성은 사용하기 전에 명시적인 초기화가 필요합니다.

  • 페이지 루트 요소에 data-seed 어트리뷰트를 지정합니다.
  • 사용자가 선호하는 컬러 스킴에 따라 data-seed-scale-color 어트리뷰트를 지정합니다.
  • 시스템 폰트에 적합한 타이포그래피를 적용하기 위해 data-seed-scale-letter-spacing 어트리뷰트를 지정합니다.
    • ios
    • android

예시) HTML (light-only)

<html
  lang="ko"
  data-seed="light-only"
  data-seed-scale-color="light"
  data-seed-scale-letter-spacing="ios"
>
  <head>
    <meta name="color-scheme" content="light" />
  </head>
</html>

예시) DOM API로 동적 초기화

(CSS-in-JS 라이브러리 통합 시, 또는 pre-hydration 스크립트에서 수행 될 수 있습니다)

(function () {
  function isIOS() {
    return /iphone|ipad|ipod/i.test(window.navigator.userAgent.toLowerCase());
  }
  var ios = isIOS();
  var prefersLight = window.matchMedia("(prefers-color-scheme: light)");
  var prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
  var el = document.documentElement;

  el.dataset.seedScaleLetterSpacing = ios ? "ios" : "android";
  el.dataset.seed = "";

  if (prefersLight.matches) {
    if ("addEventListener" in prefersLight) {
      prefersLight.addEventListener("change", apply);
    } else if ("addListener" in prefersLight) {
      prefersLight.addListener(apply);
    }
  } else if (prefersDark.matches) {
    if ("addEventListener" in prefersDark) {
      prefersDark.addEventListener("change", apply);
    } else if ("addListener" in prefersDark) {
      prefersDark.addListener(apply);
    }
  }

  function apply() {
    document.documentElement.dataset.seedScaleColor = prefersDark.matches
      ? "dark"
      : "light";
  }

  apply();
})();