Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

hov propの文字列指定がスペース区切りを受け付けず、set / utilと区切り文字の扱いが異なる

Closed
#665 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

Read packages/lism-css/src/lib/helper/mergeSet.ts and trace setHovProps in getLismProps.ts to understand their current splitting paths. Then inspect the listed tests for splitWithComma and the Japanese and English hov docs and examples. Done means both props accept space-separated values with comma compatibility, empty values are discarded, and the documented examples use spaces.

Written by the indexing model from the issue text.

Description

背景

<Lism>のset / util propはスペース区切り(カンマも互換で可)で複数指定できますが、hov propの文字列指定はカンマ区切りしか受け付けません。同じく複数の値を並べるpropなのに書き方がそろっておらず、hovをスペース区切りで書くと意図しないクラスが出力されます。

詳細

prop 分割処理 受け付ける区切り
set / util mergeSet(packages/lism-css/src/lib/helper/mergeSet.ts) スペースが基本。カンマも互換で可(/[,\s]+/で分割)
hov(文字列指定) getLismProps.tsのsetHovPropsから呼ぶsplitWithComma カンマのみ

set / utilは以前カンマ区切りでした。977150a85でスペース区切りに統一し、30a8e69c3でカンマを互換として戻しています。hovはこのときの変更に含まれていません。

ドキュメントの記述も分かれています。

  • set: スペース区切り(apps/site/src/content/ja/core-components/lism-props.mdx、skills/lism-css-guide/components-core.md)
  • hov: カンマ区切り(apps/site/src/content/ja/property-class/hov.mdx、skills/lism-css-guide/property-class.md、skills/lism-css-guide/property-class/hov.md)
スペース区切りで書いたときの挙動

hov="-c -bdc"は-hov:-c -bdcという1つの文字列として扱われます。最後にattsがスペースで分割するため、出力されるクラスは次の2つです(コードを読んだ結果で、実行しての確認はしていません)。

  • -hov:-c(意図どおり)
  • -bdc(ホバー用ではない余計なクラス)

エラーや警告は出ないため、気づきにくい状態です。

末尾カンマ

hov="-c,"のように末尾にカンマがあると、空の要素を除いていないため中身のない-hov:クラスが出力されます。

改善方法

  • mergeSet.ts内の分割処理(normalize。/[,\s]+/で分割し空要素を除く)を、独立したヘルパーsplitValuesとして切り出す。
  • mergeSetとsetHovPropsの両方からsplitValuesを呼ぶ。区切りのルールを1か所にまとめ、set / util / hovの書き方が再びずれないようにする。
  • splitWithComma.tsとそのテストを削除する。@lism-css/uiからは読み込まれていないため、互換の問題はない。
  • hovのドキュメントを、setと同じくスペース区切りを基本とする案内に直す。カンマ区切りの既存の用例(hov="-bgc,-c"など)もスペース区切りに書き換える。
    • apps/site/src/content/ja/property-class/hov.mdx / en/property-class/hov.mdx
    • apps/site/src/content/ja/ui/NavMenu.mdx / en/ui/NavMenu.mdx
    • apps/site/src/components/mdx/DocsLink.astro
    • skills/lism-css-guide/property-class.md
    • skills/lism-css-guide/property-class/hov.md

やらないこと

  • hovの分割にmergeSetをそのまま流用しない。mergeSetは-で始まる値を除外指定として扱いますが、hovの値は-cのように-で始まるため、正しく分割できません。分割処理だけを共用します。
  • setHovPropsの中に分割処理を直接書く案は採らない。mergeSetと同じ正規表現が2か所に分かれ、片方だけ直されて区切りがまたずれる余地が残るためです。
  • ヘルパー名に「token」は使わない。Lismではデザイントークンを指す言葉で紛らわしいためです。
Dominant language
TypeScript
Stars
283
Forks
8
Avg merge
6h 37m
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lism-css/core

All issues in lism-css/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.