hov propの文字列指定がスペース区切りを受け付けず、set / utilと区切り文字の扱いが異なる
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.mdxapps/site/src/content/ja/ui/NavMenu.mdx/en/ui/NavMenu.mdxapps/site/src/components/mdx/DocsLink.astroskills/lism-css-guide/property-class.mdskills/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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lism-css/core
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
将来的に検討
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Automattic/data-liberation-agent#1115 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
CSS enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pychess/pychess-variants#2448 ·
Maintainers usually reply within 1 day
-
[architect] Stale planning/scratch files at repo root (COMPONENT_SPLIT_SUMMARY.md etc.) describe already-completed workPossibly taken @hivecommons-hive claimed this today. Openagent/architect architecture help wanted stage/040-covered-by-pr tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
kubestellar/console#24716 ·
Maintainers usually reply within 1 day
-
helm-knative-apply.sh fails with Helm 4Possibly taken A pull request linked to this issue is open or already merged. Openarea: triage theme: undefined
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
jhipster/generator-jhipster#35895 ·
Maintainers usually reply within 1 day