Skip to content

Instantly share code, notes, and snippets.

@yuheiy
yuheiy / App.tsx
Last active March 15, 2026 12:20
Unavailable ActionButton in s2
import { useId, useState } from 'react';
import {
ActionButton,
Content,
ContextualHelpPopover,
DialogTrigger,
Heading,
Switch,
Text,
} from '@react-spectrum/s2';
@yuheiy
yuheiy / README.md
Last active February 5, 2026 13:30
React SpectrumใซใŠใ‘ใ‚‹ใƒ—ใƒญใƒ‘ใƒ†ใ‚ฃใ”ใจใฎremๅ˜ไฝใจpxๅ˜ไฝใฎไฝฟใ„ๅˆ†ใ‘

React SpectrumใซใŠใ‘ใ‚‹ใƒ—ใƒญใƒ‘ใƒ†ใ‚ฃใ”ใจใฎremๅ˜ไฝใจpxๅ˜ไฝใฎไฝฟใ„ๅˆ†ใ‘

ใƒ—ใƒญใƒ‘ใƒ†ใ‚ฃ ๅ˜ไฝ
border-spacing rem
flex-basis rem
gap rem
height rem
width rem
contain-intrinsic-width rem

Tailwind CSS ใƒ†ใƒผใƒžๅค‰ๆ•ฐใฎ้ †ๅบใ‚ฌใ‚คใƒ‰

ใ‚ฝใƒผใƒˆๅŽŸๅ‰‡

  1. ๆฉŸ่ƒฝ็š„ใ‚ฐใƒซใƒผใƒ—ๅŒ–: ้–ข้€ฃใ™ใ‚‹ๅค‰ๆ•ฐใ‚’่ซ–็†็š„ใซใ‚ฐใƒซใƒผใƒ—ๅŒ–
  2. property-order.tsใจใฎๆ•ดๅˆๆ€ง: CSSใƒ—ใƒญใƒ‘ใƒ†ใ‚ฃใฎๅ‡บๅŠ›้ †ๅบใจไธ€่‡ด
  3. ใ‚ตใ‚คใ‚บ้ †: ๅŒใ˜ใ‚ซใƒ†ใ‚ดใƒชๅ†…ใงใฏๅฐโ†’ๅคงใฎ้ †ๅบ๏ผˆxs โ†’ sm โ†’ md โ†’ lg โ†’ xl๏ผ‰
  4. ่‰ฒ็›ธ้ †: ใ‚ซใƒฉใƒผใƒ‘ใƒฌใƒƒใƒˆใฏ่ตคโ†’็ดซใฎใ‚นใƒšใ‚ฏใƒˆใƒซ้ †
  5. ใƒ‡ใƒ•ใ‚ฉใƒซใƒˆๅ€คใฏๆœ€ๅพŒ: --default-*ๅค‰ๆ•ฐใฏๆœ€ๅพŒใซ้…็ฝฎ
@yuheiy
yuheiy / README.md
Last active July 10, 2025 04:25
Tailwind CSS Border-Width Detector

Tailwind CSS Border-Width Detector

A Node.js CLI tool to detect and list Tailwind CSS border-width related classes in your project files with their exact locations.

Features

  • ๐Ÿ” Detects all border-width related Tailwind CSS classes
  • ๐Ÿ“ Shows exact file paths and line numbers
  • ๐ŸŽฏ Supports multiple file formats (HTML, JSX, Vue, PHP, etc.)
  • โšก Fast scanning with built-in file filtering
@yuheiy
yuheiy / README.md
Last active July 11, 2025 05:01
Tailwind Breakpoint Replacer

Tailwind Breakpoint Replacer

A CLI tool to replace Tailwind CSS breakpoint variants from sm:/md:/lg:/xl:/2xl: to max-sm:/max-md:/max-lg:/max-xl:/max-2xl: with precise class extraction based on Tailwind's official extractor logic.

Features

  • Precise extraction: Uses the same logic as Tailwind CSS's Rust-based extractor for accurate class detection
  • Safe replacements: Only replaces within class and className attributes
  • Smart filtering:
    • Skips classes that already have max- prefix
@yuheiy
yuheiy / alt-requirements.md
Last active May 18, 2025 14:39
https://html.spec.whatwg.org/multipage/images.html#alt ใฎไธ€้ƒจใ‚’ๅ‰ŠใฃใŸใ†ใˆใงๆ•ดๅฝขใ—ใŸใ‚‚ใฎ

4.8.4.4 Requirements for providing text to act as an alternative for images

4.8.4.4.1 General guidelines

Except where otherwise specified, the alt attribute depend on what the image is intended to represent, as described in the following sections.

The most general rule to consider when writing alternative text is the following: the intent is that replacing every image with the text of its alt attribute does not change the meaning of the page.

So, in general, alternative text can be written by considering what one would have written had one not been able to include the image.

function App() {
return (
<>
{(() => {
const [isOpen, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>First</Button>
<Popover isOpen={isOpen} onOpenChange={setOpen}>
...
function HooksSeparator<T>({
setup,
children,
}: {
setup: () => T;
children: (prop: T) => ReactNode;
}) {
return children(setup());
}
import type { Dispatch, DispatchWithoutAction, ReactNode, SetStateAction } from 'react';
import { useCallback, useState } from 'react';
/**
* The implement a hooks version of React PowerPlugโ€™s `<State />`.
* https://renatorib.github.io/react-powerplug/#/docs-components-state
*
* @example
* <State initial={false}>
* {({ state: isOpen, setState: setOpen }) => (

ใชใ‚“ใงใ‚‚ใชใ„ใ‚ˆใ†ใชใ“ใจใ‚’ๆ›ธใใŸใ„ใ€‚ๅฐ‘ใ—่€ƒใˆใฆใฟใฆใ€ใใ‚ŒใŒไปŠใฎๅƒ•ใฎๆฑ‚ใ‚ใฆใ„ใ‚‹ใ‚‚ใฎใ ใจๆฐ—ใฅใ„ใŸใ€‚ๆ„ๅ‘ณใจใ‹ใ€็†็”ฑใจใ‹ใ€ใใ†ใ„ใ†็›ฎ็š„ใ‚ใ‚Šใใฎๆ€่€ƒใƒ‘ใ‚ฟใƒผใƒณใฎๅค–ใงใ€ใŸใ ใชใซใ‹ใ‚’ๆ„Ÿใ˜ใ‚‰ใ‚Œใ‚‹ใ‚ˆใ†ใซใชใ‚ŠใŸใ„ใ€‚

ๅƒ•ใฏๆ˜”ใ‹ใ‚‰ใ€ๆญฃใ—ใ•ใ‚’ๆŽขใ—ใฆใ„ใŸใ€‚ใŸใถใ‚“็‰ฉๅฟƒใŒใคใ„ใŸใใ‚‰ใ„ใฎใ“ใ‚ใ‹ใ‚‰ใ—ใฐใ‚‰ใใ€ใ‚ใ‚‰ใ‚†ใ‚‹็‰ฉไบ‹ใซใฏๆญฃใ—ใ„ใ‚„ใ‚Šๆ–นใŒใ‚ใ‚Šใ€ๅ”ฏไธ€ใฎ็ญ”ใˆใŒใ‚ใ‚‹ใจใ„ใ†ไธ–็•Œ่ช่ญ˜ใ‚’ใ—ใฆใ„ใŸใ€‚็†ๅฑˆใฃใฝใ‹ใฃใŸใ—ใ€ใใ“ใ‹ใ‚‰้€ธ่„ฑใ™ใ‚‹ใ“ใจใŒๆฐ—ๆŒใกๆ‚ชใ‹ใฃใŸใ€‚

ใชใซใ‹ใตใ–ใ‘ใŸใ“ใจใ‚’ใ™ใ‚‹ใจใใซใฏใ€ใใฎใƒขใƒผใƒ‰ใซๅ…ฅใ‚‹ใŸใ‚ใฎใ‚นใ‚คใƒƒใƒใ‚’ๆ„่ญ˜็š„ใซๅˆ‡ใ‚Šๆ›ฟใˆใชใ‘ใ‚Œใฐใชใ‚‰ใชใ‹ใฃใŸใ€‚ใ‚ชใƒณใ‹ใ‚ชใƒ•ใฎ2ๆ–นๅ‘ใ—ใ‹ใชใ„ใ€้–“ใฎใชใ„ๆฉŸๆขฐ็š„ใชใƒกใ‚ซใƒ‹ใ‚บใƒ ใ€‚ใ—ใ‹ใ—ใใฎๅ…ˆใซใ‚‚ๆญฃใ—ใ•ใ‹ใ‚‰ใฎ้€ธ่„ฑใฏใชใใ€ไปŠใ‚ใ‚‹ใฎใจใฏๅˆฅใฎใ‚‚ใ†ไธ€ใคใฎๆญฃใ—ใ•ใฎไฝ“็ณปใŒใ‚ใ‚‹ใ ใ‘ใ ใฃใŸใ€‚

ๅญฆๆ กใฎ่ชฒ้กŒใงไธ€็•ช่‹ฆๆ‰‹ใชใฎใฏไฝœๆ–‡ใ ใฃใŸใ€‚ใฉใ‚Œใใ‚‰ใ„ใฎใ‚‚ใฎใ‹ใจ่จ€ใ†ใจใ€ไธ€ๆ–‡ๅญ—ใ‚‚ๆ›ธใ‘ใชใ„ใพใพๆ•ฐๆ™‚้–“ใƒ•ใƒชใƒผใ‚บใ—ใฆใ—ใพใ†็จ‹ๅบฆใซใฏๆ›ธใ‘ใชใ‹ใฃใŸใ€‚็ญ”ใˆใŒใ„ใ‚ใ„ใ‚ใ‚ใ‚‹ใจใ„ใ†ใ“ใจใ‚‚็†็”ฑใฎไธ€ใคใงใฏใ‚ใฃใŸใŒใ€ใ„ใพ่€ƒใˆใ‚‹ใจใ€่‡ชๅˆ†ใŒใ‚คใƒกใƒผใ‚ธใงใใ‚‹ๆญฃ่งฃใฎ็ทšใŒ่ฆ‹ใคใ‹ใ‚‰ใชใ‹ใฃใŸใ‹ใ‚‰ใ ใจๆ€ใ†ใ€‚ใ‚‚ใกใ‚ใ‚“ใ€ไธ€ๆ–‡ๅญ—ใฎ็ถปใณใ‚‚ใชใ„ๅฎŒๅ…จใช่งฃ็ญ”ใŒๅญ˜ๅœจใ™ใ‚‹ใจใพใงใฏ่€ƒใˆใฆใ„ใชใ‹ใฃใŸใŒใ€ใใ‚Œใงใ‚‚ใ€ใ“ใ†ใ„ใ†ๅ ดๅˆใซใฏใ“ใ†ใ„ใ†ใ“ใจใ‚’ๆ›ธใใ‚‚ใ‚“ใ ใ€ใจใ„ใ†ๆญฃ่งฃใƒ‘ใ‚ฟใƒผใƒณใฎๅž‹ใŒๅธธใซๅญ˜ๅœจใ™ใ‚‹ใ‚ˆใ†ใซใฏๆ€ใฃใฆใ„ใŸใ€‚

ใใฎๅž‹ใ‚’่ฆ‹ใ„ๅ‡บใ—ใฆๅฎŸๆผ”ใงใใ‚‹ใ ใ‘ใฎๆŠ€้‡ใชใฉใฏๅˆฐๅบ•ใชใ‹ใฃใŸใ€‚ใ‘ใ‚ŒใฉๅฎŒ็’งไธป็พฉ่€…ใฎๅƒ•ใซใจใฃใฆใฏใ€ไธๆ ผๅฅฝใงใ‚‚ใจใ‚Šใ‚ใˆใšใ‚„ใฃใฆใฟใฆ60็‚นใฎ่งฃ็ญ”ใ‚’็›ฎๆŒ‡ใ™ใ‚ˆใ‚Šใฏใ€ๅคฑๆ•—ใฎๅฝข่ทกใ‚’ๆฎ‹ใ•ใšใซ0็‚นใ‚’ๅ‡บใ—ใŸๆ–นใŒ่‡ชๅฐŠๅฟƒใ‚’ๅ‚ทใคใ‘ใšใซๆธˆใ‚“ใ ใ€‚ๅฝ“ๆ™‚ใ€ๅ›ฝ่ชžใฎๆˆ็ธพใฏใ‚€ใ—ใ‚่‰ฏใ„ๆ–นใ ใฃใŸใ€‚